diff options
author | Matt Wilson <msw@redhat.com> | 2000-12-13 20:12:52 +0000 |
---|---|---|
committer | Matt Wilson <msw@redhat.com> | 2000-12-13 20:12:52 +0000 |
commit | cc9ad5fa4b76f6f9402258cfa1112199729dcaae (patch) | |
tree | 42f86f93c9d48140b9ffd4bc8b1a8d6ac61074dd /losetup-stub | |
parent | b878d4bbbba830c6a36e8b5d6b143214fbadbd09 (diff) | |
download | anaconda-cc9ad5fa4b76f6f9402258cfa1112199729dcaae.tar.gz anaconda-cc9ad5fa4b76f6f9402258cfa1112199729dcaae.tar.xz anaconda-cc9ad5fa4b76f6f9402258cfa1112199729dcaae.zip |
add losetup stub per erik's request
Diffstat (limited to 'losetup-stub')
-rwxr-xr-x | losetup-stub | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/losetup-stub b/losetup-stub new file mode 100755 index 000000000..fed047d97 --- /dev/null +++ b/losetup-stub @@ -0,0 +1,40 @@ +#!/usr/bin/python + +import os +import sys + +# for testing +if (os.path.exists('isys')): + sys.path.append('isys') + +sys.path.append('/usr/lib/anaconda') + +import isys +from sys import argv + +def usage(): + print "usage: losetup [-d] /dev/loopN [image]" + sys.exit(1) + +if len(argv) < 3: + usage() + +if argv[1] == "-d" and len(argv[2] > 4) and argv[2][-5:-1] == "loop": + try: + isys.makeDevInode(argv[2][-5:], argv[2]) + isys.unlosetup(argv[2]) + except SystemError, (errno, msg): + print msg + sys.exit (1) + sys.exit(0) + +if len(argv[1] > 4) and argv[1][-5:-1] == "loop": + try: + isys.makeDevInode(argv[1][-5:], argv[1]) + isys.losetup(argv[1], argv[2]) + except SystemError, (errno, msg): + print msg + sys.exit (1) + sys.exit(0) + +usage() |