diff options
author | Jeremy Katz <katzj@redhat.com> | 2002-12-11 21:00:55 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2002-12-11 21:00:55 +0000 |
commit | 76d773709c5f9a37191ceb08bda8075762c94c78 (patch) | |
tree | 98af51ae5b5d4917815b13c2eeb29f9477ce9a99 | |
parent | 7052155189de312d53a2e9514155b178916d2837 (diff) | |
download | anaconda-76d773709c5f9a37191ceb08bda8075762c94c78.tar.gz anaconda-76d773709c5f9a37191ceb08bda8075762c94c78.tar.xz anaconda-76d773709c5f9a37191ceb08bda8075762c94c78.zip |
add mknod stub
-rw-r--r-- | command-stubs/Makefile | 2 | ||||
-rwxr-xr-x | command-stubs/mknod-stub | 50 |
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() |