summaryrefslogtreecommitdiffstats
path: root/command-stubs
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>2000-12-13 20:12:52 +0000
committerMatt Wilson <msw@redhat.com>2000-12-13 20:12:52 +0000
commitcc9ad5fa4b76f6f9402258cfa1112199729dcaae (patch)
tree42f86f93c9d48140b9ffd4bc8b1a8d6ac61074dd /command-stubs
parentb878d4bbbba830c6a36e8b5d6b143214fbadbd09 (diff)
downloadanaconda-cc9ad5fa4b76f6f9402258cfa1112199729dcaae.tar.gz
anaconda-cc9ad5fa4b76f6f9402258cfa1112199729dcaae.tar.xz
anaconda-cc9ad5fa4b76f6f9402258cfa1112199729dcaae.zip
add losetup stub per erik's request
Diffstat (limited to 'command-stubs')
-rwxr-xr-xcommand-stubs/losetup-stub40
1 files changed, 40 insertions, 0 deletions
diff --git a/command-stubs/losetup-stub b/command-stubs/losetup-stub
new file mode 100755
index 000000000..fed047d97
--- /dev/null
+++ b/command-stubs/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()