summaryrefslogtreecommitdiffstats
path: root/command-stubs
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2002-12-11 21:00:55 +0000
committerJeremy Katz <katzj@redhat.com>2002-12-11 21:00:55 +0000
commit76d773709c5f9a37191ceb08bda8075762c94c78 (patch)
tree98af51ae5b5d4917815b13c2eeb29f9477ce9a99 /command-stubs
parent7052155189de312d53a2e9514155b178916d2837 (diff)
downloadanaconda-76d773709c5f9a37191ceb08bda8075762c94c78.tar.gz
anaconda-76d773709c5f9a37191ceb08bda8075762c94c78.tar.xz
anaconda-76d773709c5f9a37191ceb08bda8075762c94c78.zip
add mknod stub
Diffstat (limited to 'command-stubs')
-rw-r--r--command-stubs/Makefile2
-rwxr-xr-xcommand-stubs/mknod-stub50
2 files changed, 51 insertions, 1 deletions
diff --git a/command-stubs/Makefile b/command-stubs/Makefile
index 64ff41062..e68983bba 100644
--- a/command-stubs/Makefile
+++ b/command-stubs/Makefile
@@ -1,7 +1,7 @@
include ../Makefile.inc
STUBS = raidstart-stub raidstop-stub kudzu-probe-stub list-harddrives-stub \
- loadkeys-stub losetup-stub pump-stub
+ loadkeys-stub losetup-stub pump-stub mknod-stub
all:
@echo "Nothing to do"
diff --git a/command-stubs/mknod-stub b/command-stubs/mknod-stub
new file mode 100755
index 000000000..ff9f5312d
--- /dev/null
+++ b/command-stubs/mknod-stub
@@ -0,0 +1,50 @@
+#!/usr/bin/python
+
+import sys
+import isys
+import string
+import stat
+
+def usage():
+ sys.stderr.write("Usage: %s <path> [b|c] <major> <minor> or\n" %(sys.argv[0],))
+ sys.stderr.write("Usage: %s <path>\n" %(sys.argv[0],))
+ sys.exit(1)
+
+def main():
+ if len(sys.argv) < 2:
+ usage()
+
+ if (sys.argv[1] == '-h') or (sys.argv[1] == '--help'):
+ usage()
+
+ path = sys.argv[1]
+ if (len(sys.argv) == 2):
+ drive = path
+ # strip off any path elements up until what's useful for making the
+ # inode
+ while (drive.find('/') != -1):
+ if (drive.startswith("cciss") or drive.startswith("ida") or
+ drive.startswith("rd") or drive.startswith("ataraid")):
+ break
+ drive = drive[drive.find('/') + 1:]
+ isys.makeDevInode(drive, path)
+ sys.exit(0)
+
+ if len(sys.argv) < 5:
+ usage()
+
+ if (sys.argv[2] == 'b'):
+ type = stat.S_IFBLK
+ elif (sys.argv[2] == 'c'):
+ type = stat.S_IFCHR
+ else:
+ usage()
+
+ major = int(sys.argv[3])
+ minor = int(sys.argv[4])
+ path = sys.argv[1]
+
+ isys.mknod(path, 0644 | type, isys.makedev(major, minor))
+
+if __name__ == "__main__":
+ main()