[Fedora-livecd-list] 2 commits - imgcreate/creator.py tools/livecd-iso-to-disk.sh
Jeremy Katz
katzj at fedoraproject.org
Thu May 29 21:04:51 UTC 2008
imgcreate/creator.py | 37 ++++++++++++++++++++-----------------
tools/livecd-iso-to-disk.sh | 6 +++++-
2 files changed, 25 insertions(+), 18 deletions(-)
New commits:
commit fd5652933c0a49f8961d17bee5f0526bf1676a14
Author: Jeremy Katz <katzj at redhat.com>
Date: Thu May 29 17:04:41 2008 -0400
Allow isos to be blockdevs or regular files
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 9676633..69e97e3 100644
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -188,7 +188,11 @@ done
ISO=$(readlink -f "$1")
USBDEV=$2
-if [ -z "$ISO" -o ! -f "$ISO" ]; then
+if [ -z "$ISO" ]; then
+ usage
+fi
+
+if [ ! -b "$ISO" -a ! -f "$ISO" ]; then
usage
fi
commit 6e221ba27ed5a6c5a79ac1fbb7cfc5e11566e080
Author: Jeremy Katz <katzj at redhat.com>
Date: Thu May 29 08:53:25 2008 -0400
Move minimal /dev creation into a method
diff --git a/imgcreate/creator.py b/imgcreate/creator.py
index fc4298b..5d010a1 100644
--- a/imgcreate/creator.py
+++ b/imgcreate/creator.py
@@ -403,6 +403,24 @@ class ImageCreator(object):
fstab.write(self._get_fstab())
fstab.close()
+ def __create_minimal_dev(self):
+ """Create a minimal /dev so that we don't corrupt the host /dev"""
+ origumask = os.umask(0000)
+ devices = (('null', 1, 3, 0666),
+ ('urandom',1, 9, 0666),
+ ('random', 1, 8, 0666),
+ ('full', 1, 7, 0666),
+ ('ptmx', 5, 2, 0666),
+ ('tty', 5, 0, 0666),
+ ('zero', 1, 5, 0666))
+ for (node, major, minor, perm) in devices:
+ os.mknod(self._instroot + "/dev/" + node, perm | stat.S_IFCHR, os.makedev(major,minor))
+ os.symlink('/proc/self/fd', self._instroot + "/dev/fd")
+ os.symlink('/proc/self/fd/0', self._instroot + "/dev/stdin")
+ os.symlink('/proc/self/fd/1', self._instroot + "/dev/stdout")
+ os.symlink('/proc/self/fd/2', self._instroot + "/dev/stderr")
+ os.umask(origumask)
+
def mount(self, base_on = None, cachedir = None):
"""Setup the target filesystem in preparation for an install.
@@ -444,25 +462,10 @@ class ImageCreator(object):
if kickstart.selinux_enabled(self.ks):
self.__bindmounts.append(BindChrootMount("/selinux", self._instroot, None))
- # Create minimum /dev
- origumask = os.umask(0000)
- devices = [('null', 1, 3, 0666),
- ('urandom',1, 9, 0666),
- ('random', 1, 8, 0666),
- ('full', 1, 7, 0666),
- ('ptmx', 5, 2, 0666),
- ('tty', 5, 0, 0666),
- ('zero', 1, 5, 0666)]
- for (node, major, minor, perm) in devices:
- os.mknod(self._instroot + "/dev/" + node, perm | stat.S_IFCHR, os.makedev(major,minor))
- os.symlink('/proc/self/fd', self._instroot + "/dev/fd")
- os.symlink('/proc/self/fd/0', self._instroot + "/dev/stdin")
- os.symlink('/proc/self/fd/1', self._instroot + "/dev/stdout")
- os.symlink('/proc/self/fd/2', self._instroot + "/dev/stderr")
- os.umask(origumask)
-
self._do_bindmounts()
+ self.__create_minimal_dev()
+
os.symlink("../proc/mounts", self._instroot + "/etc/mtab")
self.__write_fstab()
More information about the Fedora-livecd-list
mailing list