Makefile | 2 - imgcreate/creator.py | 70 ++++++++++++----------------------------- imgcreate/kickstart.py | 3 + imgcreate/live.py | 3 + tools/livecd-iso-to-disk.sh | 44 ++++++++++++++++--------- tools/livecd-iso-to-pxeboot.sh | 20 ++++++++--- 6 files changed, 70 insertions(+), 72 deletions(-)
New commits: commit b218b8a5187500d6bcce64d81c8b96aad56e16c2 Author: Brian C. Lane <[email protected]> Date: Fri Aug 26 13:30:04 2011 -0700 Version 16.4 diff --git a/Makefile b/Makefile index 98d73f2..7cc3d23 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -VERSION = 16.3 +VERSION = 16.4 INSTALL = /usr/bin/install -c INSTALL_PROGRAM = ${INSTALL} commit 04b59479cb9f3e1e4769168694762bb3335a84ee Author: Brian C. Lane <[email protected]> Date: Tue Aug 23 17:17:21 2011 -0700 Use copyFile on the iso diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh index d6adeeb..43c825e 100755 --- a/tools/livecd-iso-to-disk.sh +++ b/tools/livecd-iso-to-disk.sh @@ -1055,7 +1055,7 @@ if [ \( "$srctype" = "installer" -o "$srctype" = "netinst" \) ]; then done fi if [ "$srctype" = "installer" -a -z "$skipcopy" ]; then - cp "$SRC" $TGTMNT/ + copyFile "$SRC" $TGTMNT/ fi sync fi commit b4edb0e6b1f64d3c1448a852d624f636b7241558 Author: Brian C. Lane <[email protected]> Date: Tue Aug 23 15:01:59 2011 -0700 Use rsync to copy if available diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh index b35255c..d6adeeb 100755 --- a/tools/livecd-iso-to-disk.sh +++ b/tools/livecd-iso-to-disk.sh @@ -640,6 +640,10 @@ cp_p() { } copyFile() { + if [ -x /usr/bin/rsync ]; then + rsync -P "$1" "$2" + return + fi if [ -x /usr/bin/gvfs-copy ]; then gvfs-copy -p "$1" "$2" return commit deb258aa8b74fc75112fd40d64ac7e7e4ed95f08 Author: Bruno Wolff III <[email protected]> Date: Thu Aug 11 15:55:59 2011 -0700 Quote $SRC so iso's with spaces will work (#694915) diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh index 209f858..b35255c 100755 --- a/tools/livecd-iso-to-disk.sh +++ b/tools/livecd-iso-to-disk.sh @@ -856,9 +856,9 @@ fi # FIXME: would be better if we had better mountpoints SRCMNT=$(mktemp -d /media/srctmp.XXXXXX) -if [ -b $SRC ]; then +if [ -b "$SRC" ]; then mount -o ro "$SRC" $SRCMNT || exitclean -elif [ -f $SRC ]; then +elif [ -f "$SRC" ]; then mount -o loop,ro "$SRC" $SRCMNT || exitclean else echo "$SRC is not a file or block device." @@ -969,7 +969,7 @@ fi # Verify available space for DVD installer if [ "$srctype" = "installer" ]; then if [ -z "$skipcopy" ]; then - srcsize=$(du -s -B 1M $SRC | awk {'print $1;'}) + srcsize=$(du -s -B 1M "$SRC" | awk {'print $1;'}) else srcsize=0 fi @@ -984,8 +984,8 @@ if [ "$srctype" = "installer" ]; then if [ -e $TGTMNT/$imgpath ]; then tbd=$(du -s -B 1M $TGTMNT/$imgpath | awk {'print $1;'}) fi - if [ -e $TGTMNT/$(basename $SRC) ]; then - tbd=$(($tbd + $(du -s -B 1M $TGTMNT/$(basename $SRC) | awk {'print $1;'}))) + if [ -e $TGTMNT/$(basename "$SRC") ]; then + tbd=$(($tbd + $(du -s -B 1M $TGTMNT/$(basename "$SRC") | awk {'print $1;'}))) fi echo "Size of DVD image: $srcsize" echo "Size of $imgpath: $installimgsize" @@ -1051,7 +1051,7 @@ if [ \( "$srctype" = "installer" -o "$srctype" = "netinst" \) ]; then done fi if [ "$srctype" = "installer" -a -z "$skipcopy" ]; then - cp $SRC $TGTMNT/ + cp "$SRC" $TGTMNT/ fi sync fi @@ -1094,20 +1094,20 @@ if [ -n "$efi" ]; then exitclean else # dump the eltorito image with dumpet, output is $SRC.1 - dumpet -i $SRC -d + dumpet -i "$SRC" -d EFIMNT=$(mktemp -d /media/srctmp.XXXXXX) - mount -o loop $SRC.1 $EFIMNT + mount -o loop "$SRC".1 $EFIMNT if [ -f $EFIMNT$EFI_BOOT/+(BOOT|boot)?*.efi ]; then cp $EFIMNT$EFI_BOOT/+(BOOT|boot)?*.efi $TGTMNT$EFI_BOOT else echo "No BOOT*.efi found in eltorito image. EFI will not boot" umount $EFIMNT - rm $SRC.1 + rm "$SRC".1 exitclean fi umount $EFIMNT - rm $SRC.1 + rm "$SRC".1 fi fi fi commit 5a89d6518a49ef15f2610d46d478a9528f9da275 Author: Daniel Walsh <[email protected]> Date: Thu Aug 11 10:35:34 2011 -0700 Handle move to /sys/fs/selinux (#728576) selinux mountpoint has moved, read the mountpont from /proc/mountinfo or fall back to /sys/fs/selinux diff --git a/imgcreate/creator.py b/imgcreate/creator.py index 675dcf6..0492c81 100644 --- a/imgcreate/creator.py +++ b/imgcreate/creator.py @@ -83,6 +83,15 @@ class ImageCreator(object): self.__sanity_check() + # get selinuxfs mountpoint + self.__selinux_mountpoint = "/sys/fs/selinux" + with open("/proc/self/mountinfo", "r") as f: + for line in f.readlines(): + fields = line.split() + if fields[-2] == "selinuxfs": + self.__selinux_mountpoint = fields[4] + break + def __del__(self): self.cleanup() @@ -435,63 +444,25 @@ class ImageCreator(object): os.symlink(src, self._instroot + dest) os.umask(origumask) - def __getbooleans(self): - booleans = [] - if not kickstart.selinux_enabled(self.ks) or not os.path.exists("/selinux/enforce"): - return booleans - for i in selinux.security_get_boolean_names()[1]: - on = selinux.security_get_boolean_active(i) - booleans.append(("/booleans/%s" % i, "%d %d" % (on, on))) - return booleans - def __create_selinuxfs(self): - # if selinux exists on the host we need to lie to the chroot - if os.path.exists("/selinux/enforce"): - selinux_dir = self._instroot + "/selinux" - - # enforce=0 tells the chroot selinux is not enforcing - # policyvers=999 tell the chroot to make the highest version of policy it can - - files = [('/enforce', '0'), - ('/policyvers', '999'), - ('/commit_pending_bools', ''), - ('/mls', str(selinux.is_selinux_mls_enabled()))] - - for (file, value) in files + self.__getbooleans(): - fd = os.open(selinux_dir + file, os.O_WRONLY | os.O_TRUNC | os.O_CREAT) - os.write(fd, value) - os.close(fd) + arglist = ["/bin/mount", "--bind", "/dev/null", self._instroot + self.__selinux_mountpoint + "/load"] + subprocess.call(arglist, close_fds = True) - # we steal mls from the host system for now, might be best to always set it to 1???? - # make /load -> /dev/null so chroot policy loads don't hurt anything - os.mknod(selinux_dir + "/load", 0666 | stat.S_IFCHR, os.makedev(1, 3)) - - # selinux is on in the kickstart, so clean up as best we can to start if kickstart.selinux_enabled(self.ks): # label the fs like it is a root before the bind mounting arglist = ["/sbin/setfiles", "-F", "-r", self._instroot, selinux.selinux_file_context_path(), self._instroot] subprocess.call(arglist, close_fds = True) # these dumb things don't get magically fixed, so make the user generic - for f in ("/proc", "/sys", "/selinux"): + # if selinux exists on the host we need to lie to the chroot + if selinux.is_selinux_enabled(): + for f in ("/proc", "/sys"): arglist = ["/usr/bin/chcon", "-u", "system_u", self._instroot + f] subprocess.call(arglist, close_fds = True) def __destroy_selinuxfs(self): # if the system was running selinux clean up our lies - if os.path.exists("/selinux/enforce"): - for root, dirs, files in os.walk(self._instroot + "/selinux"): - for name in files: - try: - os.remove(os.path.join(root, name)) - except OSError: - pass - for name in dirs: - if os.path.join(root, name) == self._instroot + "/selinux": - continue - try: - os.rmdir(os.path.join(root, name)) - except OSError: - pass + arglist = ["/bin/umount", self._instroot + self.__selinux_mountpoint + "/load"] + subprocess.call(arglist, close_fds = True) def mount(self, base_on = None, cachedir = None): """Setup the target filesystem in preparation for an install. @@ -518,7 +489,7 @@ class ImageCreator(object): self._mount_instroot(base_on) - for d in ("/dev/pts", "/etc", "/boot", "/var/log", "/var/cache/yum", "/sys", "/proc", "/selinux/booleans"): + for d in ("/dev/pts", "/etc", "/boot", "/var/log", "/var/cache/yum", "/sys", "/proc"): makedirs(self._instroot + d) cachesrc = cachedir or (self.__builddir + "/yum-cache") @@ -527,13 +498,14 @@ class ImageCreator(object): # bind mount system directories into _instroot for (f, dest) in [("/sys", None), ("/proc", None), ("/dev/pts", None), ("/dev/shm", None), + (self.__selinux_mountpoint, self.__selinux_mountpoint), (cachesrc, "/var/cache/yum")]: self.__bindmounts.append(BindChrootMount(f, self._instroot, dest)) - self.__create_selinuxfs() - self._do_bindmounts() + self.__create_selinuxfs() + self.__create_minimal_dev() os.symlink("/proc/self/mounts", self._instroot + "/etc/mtab") @@ -619,7 +591,7 @@ class ImageCreator(object): # we need /usr/sbin/lokkit def __can_handle_selinux(self, ayum): file = "/usr/sbin/lokkit" - if not kickstart.selinux_enabled(self.ks) and os.path.exists("/selinux/enforce") and not ayum.installHasFile(file): + if not kickstart.selinux_enabled(self.ks) and selinux.is_selinux_enabled() and not ayum.installHasFile(file): raise CreatorError("Unable to disable SELinux because the installed package set did not include the file %s" % (file)) def install(self, repo_urls = {}): diff --git a/imgcreate/kickstart.py b/imgcreate/kickstart.py index 33859d6..345c638 100644 --- a/imgcreate/kickstart.py +++ b/imgcreate/kickstart.py @@ -23,6 +23,7 @@ import subprocess import time import logging import urlgrabber +import selinux try: import system_config_keyboard.keyboard as keyboard @@ -420,7 +421,7 @@ class SelinuxConfig(KickstartConfig): if not os.path.exists(self.path("/sbin/setfiles")): return - self.call(["/sbin/setfiles", "-e", "/proc", "-e", "/sys", "-e", "/dev", "-e", "/selinux", "/etc/selinux/targeted/contexts/files/file_contexts", "/"]) + self.call(["/sbin/setfiles", "-p", "-e", "/proc", "-e", "/sys", "-e", "/dev", selinux.selinux_file_context_path(), "/"]) def apply(self, ksselinux): if os.path.exists(self.path("/usr/sbin/lokkit")): commit a624a4668ca950126d6503d561d7e9cefdabf485 Author: Brian C. Lane <[email protected]> Date: Mon Aug 8 16:21:09 2011 -0700 Turn on the legacy_boot flag for EFI (#680563) This allows gptmbr to be able to boot on both EFI and BIOS. diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh index ff326a5..209f858 100755 --- a/tools/livecd-iso-to-disk.sh +++ b/tools/livecd-iso-to-disk.sh @@ -341,6 +341,8 @@ resetMBR() { echo "Could not find gptmbr.bin (syslinux)" exitclean fi + # Make it bootable on EFI and BIOS + parted -s $device set $partnum legacy_boot on else if [ -f /usr/lib/syslinux/mbr.bin ]; then cat /usr/lib/syslinux/mbr.bin > $device commit 1b9e30c0bc295b4f61b07e739a5bb9851546fb71 Author: Brian C. Lane <[email protected]> Date: Mon Aug 8 16:20:20 2011 -0700 Don't ask about replacing MBR when formatting diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh index 46e4abb..ff326a5 100755 --- a/tools/livecd-iso-to-disk.sh +++ b/tools/livecd-iso-to-disk.sh @@ -365,9 +365,11 @@ checkMBR() { mbrword=$(hexdump -n 2 $bs |head -n 1|awk {'print $2;'}) rm -f $bs if [ "$mbrword" = "0000" ]; then - echo "MBR appears to be blank." - echo "Press Enter to replace the MBR and continue or ctrl-c to abort" - read + if [ -z "$format" ]; then + echo "MBR appears to be blank." + echo "Press Enter to replace the MBR and continue or ctrl-c to abort" + read + fi resetMBR $1 fi commit a162dd4c0e8745ea37185742e9cd2e86565e1227 Author: Brian C. Lane <[email protected]> Date: Mon Aug 8 15:27:24 2011 -0700 Make MBR replacement message more clear diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh index 077e74f..46e4abb 100755 --- a/tools/livecd-iso-to-disk.sh +++ b/tools/livecd-iso-to-disk.sh @@ -366,8 +366,7 @@ checkMBR() { rm -f $bs if [ "$mbrword" = "0000" ]; then echo "MBR appears to be blank." - echo "Do you want to replace the MBR on this device?" - echo "Press Enter to continue or ctrl-c to abort" + echo "Press Enter to replace the MBR and continue or ctrl-c to abort" read resetMBR $1 fi commit 8e3e899aafcea71f9ba4452a33cd5dbae945abff Author: Brian C. Lane <[email protected]> Date: Mon Aug 8 15:18:06 2011 -0700 Ensure previous filesystems are wiped when formatting (#712553) Add wipefs step before partitioning the device. This will remove any previous filesystem signatures as well as iso9660's signature which has been known to cause problems. diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh index d5c3f65..077e74f 100755 --- a/tools/livecd-iso-to-disk.sh +++ b/tools/livecd-iso-to-disk.sh @@ -418,6 +418,7 @@ createGPTLayout() { echo "Press Enter to continue or ctrl-c to abort" read umount ${device}* &> /dev/null || : + wipefs -a ${device} /sbin/parted --script $device mklabel gpt partinfo=$(LC_ALL=C /sbin/parted --script -m $device "unit b print" |grep ^$device:) size=$(echo $partinfo |cut -d : -f 2 |sed -e 's/B$//') @@ -441,6 +442,7 @@ createMSDOSLayout() { echo "Press Enter to continue or ctrl-c to abort" read umount ${device}* &> /dev/null || : + wipefs -a ${device} /sbin/parted --script $device mklabel msdos partinfo=$(LC_ALL=C /sbin/parted --script -m $device "unit b print" |grep ^$device:) size=$(echo $partinfo |cut -d : -f 2 |sed -e 's/B$//') @@ -468,6 +470,7 @@ createEXTFSLayout() { echo "Press Enter to continue or ctrl-c to abort" read umount ${device}* &> /dev/null || : + wipefs -a ${device} /sbin/parted --script $device mklabel msdos partinfo=$(LC_ALL=C /sbin/parted --script -m $device "unit b print" |grep ^$device:) size=$(echo $partinfo |cut -d : -f 2 |sed -e 's/B$//') commit 75ce25e494ccb74b4bc19c807d1d789194e40f87 Author: Brian C. Lane <[email protected]> Date: Thu Jul 28 15:08:21 2011 -0700 Modify pxeboot script to work with F16 diff --git a/tools/livecd-iso-to-pxeboot.sh b/tools/livecd-iso-to-pxeboot.sh index 45a1ffe..83881d4 100755 --- a/tools/livecd-iso-to-pxeboot.sh +++ b/tools/livecd-iso-to-pxeboot.sh @@ -66,8 +66,6 @@ if [ -d tftpboot ]; then exit 1 fi -mkdir tftpboot - # Mount the ISO. # FIXME: would be better if we had better mountpoints CDMNT=$(mktemp -d /media/cdtmp.XXXXXX) @@ -76,11 +74,21 @@ mount -o loop "$ISO" $CDMNT || exitclean trap exitclean SIGINT SIGTERM # Does it look like an ISO? -if [ ! -d $CDMNT/isolinux -o ! -f $CDMNT/isolinux/initrd0.img ]; then +if [[ ( ! -d $CDMNT/isolinux ) || ( ! -f $CDMNT/isolinux/initrd0.img && ! -f $CDMNT/isolinux/initrd.img ) ]]; then echo "The ISO image doesn't look like a LiveCD ISO image to me." exitclean fi +if [[ -f $CDMNT/isolinux/initrd0.img ]]; then + INITRD=initrd0.img + VMLINUZ=vmlinuz0 +else + INITRD=initrd.img + VMLINUZ=vmlinuz +fi + +mkdir tftpboot + # Create a cpio archive of just the ISO and append it to the # initrd image. The Linux kernel will do the right thing, # aggregating both cpio archives (initrd + ISO) into a single @@ -89,10 +97,10 @@ ISOBASENAME=`basename "$ISO"` ISODIRNAME=`dirname "$ISO"` ( cd "$ISODIRNAME" && echo "$ISOBASENAME" | cpio -H newc --quiet -L -o ) | gzip -9 | - cat $CDMNT/isolinux/initrd0.img - > tftpboot/initrd0.img + cat $CDMNT/isolinux/$INITRD - > tftpboot/$INITRD # Kernel image. -cp $CDMNT/isolinux/vmlinuz0 tftpboot/vmlinuz0 +cp $CDMNT/isolinux/$VMLINUZ tftpboot/$VMLINUZ # pxelinux bootloader. if [ -f /usr/share/syslinux/pxelinux.0 ]; then @@ -115,7 +123,7 @@ DEFAULT pxeboot TIMEOUT 20 PROMPT 0 LABEL pxeboot - KERNEL vmlinuz0 + KERNEL $VMLINUZ APPEND rootflags=loop $APPEND ONERROR LOCALBOOT 0 EOF commit 3f82de5e4bffe2655127f6d1a9032c64605f002b Author: Martin Langhoff <[email protected]> Date: Tue Jul 19 23:59:59 2011 -0400 Add initial support for ARM architectures This allows us to get basic ARM builds going. It doesn't take care of booting facilities, but those vary widely in the ARM world. For the time being, setup for booting should be done in %post . diff --git a/imgcreate/live.py b/imgcreate/live.py index 655eb16..6ad9c5b 100755 --- a/imgcreate/live.py +++ b/imgcreate/live.py @@ -916,5 +916,8 @@ elif arch in ("ppc",): LiveImageCreator = ppcLiveImageCreator elif arch in ("ppc64",): LiveImageCreator = ppc64LiveImageCreator +elif arch.startswith('arm'): + LiveImageCreator = LiveImageCreatorBase + else: raise CreatorError("Architecture not supported!") commit 3c985ba4735dbf6e75b7e518413b0d02881b3d11 Author: Brian C. Lane <[email protected]> Date: Thu May 5 16:56:36 2011 -0700 Copy updates and product image files In order to properly support copying RHEL images to USB we need to include any updates.img or product.img files that are present on the original iso. diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh index 5261aab..d5c3f65 100755 --- a/tools/livecd-iso-to-disk.sh +++ b/tools/livecd-iso-to-disk.sh @@ -1038,7 +1038,11 @@ if [ \( "$srctype" = "installer" -o "$srctype" = "netinst" \) ]; then echo "Copying DVD image to target device." mkdir -p $TGTMNT/images/ if [ "$imgtype" = "install" ]; then - copyFile $SRCMNT/images/install.img $TGTMNT/images/install.img || exitclean + for img in install.img updates.img product.img; do + if [ -e $SRCMNT/images/$img ]; then + copyFile $SRCMNT/images/$img $TGTMNT/images/$img || exitclean + fi + done fi if [ "$srctype" = "installer" -a -z "$skipcopy" ]; then cp $SRC $TGTMNT/ -- livecd mailing list [email protected] https://admin.fedoraproject.org/mailman/listinfo/livecd
