Changes to 'refs/tags/livecd-tools-13.3'
by Brian C. Lane
Tag 'livecd-tools-13.3' created by Brian C. Lane <bcl(a)redhat.com> at 2011-06-01 21:55 +0000
Tag as livecd-tools-13.3
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
iQEVAwUATea1ThF+jBaO/jp/AQJR+QgAj4XjoCyiRmQTL0vnA4DI3OvOdRyhZRz2
VA0rnOZpdnE2D2x2QmgIwsfggVIxmOeH7TUzh8QgF4uwQJj2dFFjQ+bCym4h7XZH
9unkvPPxHaEmtwnNtzzJ1p10FaRSUk6910NvxB4G1JIeOmIZ0BJsUGgg2t/TzI3w
wwZUC9IUxhUeoOHsB01Q5YtNcFXhBEq7mz0d1kBDJbMR2aJU+0PkUUJesuyOPhUc
+lcLmSJQf/MEHIvW2VjKZM4vtO/xbNECbZQyfDUz+YC+i6TgRjE4AR226phtMl5v
eyQsr4DigAUx4pUI1RiCm1pqZY69kYlkML2TxcaAYlXTQ05YpJgO8w==
=K8Dm
-----END PGP SIGNATURE-----
Changes since livecd-tools-13.2:
Brian C. Lane (2):
extlinux doesn't support ext4 or btrfs on F13 (#709778)
Version 13.3
---
Makefile | 2 +-
tools/livecd-iso-to-disk.sh | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
---
12 years, 8 months
Branch 'f13-branch' - 9 commits - Makefile tools/livecd-iso-to-disk.sh
by Brian C. Lane
Makefile | 2 -
tools/livecd-iso-to-disk.sh | 71 ++++++++++++++++++++++++++++++++------------
2 files changed, 53 insertions(+), 20 deletions(-)
New commits:
commit 3583c1f548fbe7d1fabe1a76a9c9e26fa5bcf535
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Tue Aug 23 13:03:45 2011 -0700
Version 13.4
diff --git a/Makefile b/Makefile
index c62a6fa..c658b1d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-VERSION = 13.3
+VERSION = 13.4
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
commit e42b532ebe3859b8e43dd75565068666bee82f5e
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Tue Aug 23 16:16:52 2011 -0700
Use copyFile on the iso
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 8c4e7a1..1d2156c 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -746,7 +746,7 @@ if [ \( "$isotype" = "installer" -o "$isotype" = "netinst" \) ]; then
done
fi
if [ "$isotype" = "installer" -a -z "$skipcopy" ]; then
- cp $ISO $USBMNT/
+ copyFile $ISO $USBMNT/
fi
sync
fi
commit 949d0504973f4f4635c8258b749258ddbcb4e03a
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Wed Mar 16 17:22:30 2011 -0700
Add EFI support to netboot and DVD iso
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index ee4bebb..8c4e7a1 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -778,17 +778,25 @@ if [ "$LIVEOS" != "LiveOS" ]; then sed -i -e "s;liveimg;liveimg live_dir=$LIVEOS
# DVD Installer
if [ "$isotype" = "installer" ]; then
- sed -i -e "s;initrd=initrd.img;initrd=initrd.img ${LANG:+LANG=$LANG} repo=hd:$USBLABEL:/;g" $BOOTCONFIG $BOOTCONFIG_EFI
- sed -i -e "s;stage2=\S*;;g" $BOOTCONFIG $BOOTCONFIG_EFI
+ sed -i -e "s;initrd=initrd.img;initrd=initrd.img ${LANG:+LANG=$LANG} repo=hd:$USBLABEL:/;g" $BOOTCONFIG
+ sed -i -e "s;stage2=\S*;;g" $BOOTCONFIG
+ if [ -n "$efi" ]; then
+ # Images are in $SYSLINUXPATH now
+ sed -i -e "s;/images/pxeboot/;/$SYSLINUXPATH/;g" -e "s;vmlinuz;vmlinuz ${LANG:+LANG=$LANG} repo=hd:$USBLABEL:/;g" $BOOTCONFIG_EFI
+ fi
fi
# DVD Installer for netinst
if [ "$isotype" = "netinst" ]; then
if [ "$imgtype" = "install" ]; then
- sed -i -e "s;stage2=\S*;stage2=hd:$USBLABEL:/images/install.img;g" $BOOTCONFIG $BOOTCONFIG_EFI
+ sed -i -e "s;stage2=\S*;stage2=hd:$USBLABEL:/images/install.img;g" $BOOTCONFIG
else
# The initrd has everything, so no stage2
- sed -i -e "s;stage2=\S*;;g" $BOOTCONFIG $BOOTCONFIG_EFI
+ sed -i -e "s;stage2=\S*;;g" $BOOTCONFIG
+ fi
+ if [ -n "$efi" ]; then
+ # Images are in $SYSLINUXPATH now
+ sed -ie "s;/images/pxeboot/;/$SYSLINUXPATH/;g" $BOOTCONFIG_EFI
fi
fi
commit c2992a1b150dc42d2f205c7dc5142e5a0a7f2735
Author: Brian C. Lane <bcl(a)redhat.com>
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 fbb7d02..ee4bebb 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -384,6 +384,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 71623d5960938d8d87686edc836f5570433e0cfc
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Wed Mar 16 10:42:42 2011 -0700
Support /EFI/BOOT or /EFI/boot (#688258)
Some iso's use lower case. Upper case is correct, but both work.
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index c3f34e2..fbb7d02 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -395,6 +395,8 @@ copyFile() {
cp "$1" "$2"
}
+shopt -s extglob
+
cryptedhome=1
keephome=1
homesizemb=0
@@ -597,9 +599,15 @@ if [ -f "$USBMNT/$LIVEOS/$HOMEFILE" -a -n "$keephome" -a "$homesizemb" -gt 0 ];
exitclean
fi
-if [ -n "$efi" -a ! -d $CDMNT/EFI/boot ]; then
- echo "ERROR: This live image does not support EFI booting"
- exitclean
+if [ -n "$efi" ]; then
+ if [ -d $CDMNT/EFI/BOOT ]; then
+ EFI_BOOT="/EFI/BOOT"
+ elif [ -d $CDMNT/EFI/boot ]; then
+ EFI_BOOT="/EFI/boot"
+ else
+ echo "ERROR: This live image does not support EFI booting"
+ exitclean
+ fi
fi
# let's try to make sure there's enough room on the stick
@@ -698,7 +706,7 @@ fi
# Bootloader is always reconfigured, so keep these out of the if skipcopy stuff.
[ ! -d $USBMNT/$SYSLINUXPATH ] && mkdir -p $USBMNT/$SYSLINUXPATH
-[ -n "$efi" -a ! -d $USBMNT/EFI/boot ] && mkdir -p $USBMNT/EFI/boot
+[ -n "$efi" -a ! -d $USBMNT$EFI_BOOT ] && mkdir -p $USBMNT$EFI_BOOT
# Live image copy
set -o pipefail
@@ -743,12 +751,16 @@ cp $CDMNT/isolinux/* $USBMNT/$SYSLINUXPATH
BOOTCONFIG=$USBMNT/$SYSLINUXPATH/isolinux.cfg
# Set this to nothing so sed doesn't care
BOOTCONFIG_EFI=
-if [ -n "$efi" ];then
- cp $CDMNT/EFI/boot/* $USBMNT/EFI/boot
+if [ -n "$efi" ]; then
+ cp $CDMNT$EFI_BOOT/* $USBMNT$EFI_BOOT
+
+ # FIXME
+ # There is a problem here. On older LiveCD's the files are boot?*.conf
+ # They really should be renamed to BOOT?*.conf
# this is a little ugly, but it gets the "interesting" named config file
- BOOTCONFIG_EFI=$USBMNT/EFI/boot/boot?*.conf
- rm -f $USBMNT/EFI/boot/grub.conf
+ BOOTCONFIG_EFI=$USBMNT$EFI_BOOT/+(BOOT|boot)?*.conf
+ rm -f $USBMNT$EFI_BOOT/grub.conf
fi
echo "Updating boot config file"
@@ -906,7 +918,9 @@ if [ -z "$multi" ]; then
echo "Installing boot loader"
if [ -n "$efi" ]; then
# replace the ia32 hack
- if [ -f "$USBMNT/EFI/boot/boot.conf" ]; then cp -f $USBMNT/EFI/boot/bootia32.conf $USBMNT/EFI/boot/boot.conf ; fi
+ if [ -f "$USBMNT$EFI_BOOT/boot.conf" ]; then
+ cp -f $USBMNT$EFI_BOOT/BOOTia32.conf $USBMNT$EFI_BOOT/BOOT.conf
+ fi
fi
# this is a bit of a kludge, but syslinux doesn't guarantee the API for its com32 modules :/
commit bc754e54ed52cd69c40a0881a0184fdd10a4f608
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Thu Feb 24 15:44:46 2011 -0800
gptmbr can be written directly to the mbr
With the change to syslinux 4 the gptmbr.bin no longer needs the
GUID of the partition to boot, it just needs the boot flag set on it.
diff --git a/tools/livecd-iso-to-disk.sh b/tools/livecd-iso-to-disk.sh
index 35ecea3..c3f34e2 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -87,15 +87,13 @@ resetMBR() {
# if efi, we need to use the hybrid MBR
if [ -n "$efi" ];then
if [ -f /usr/lib/syslinux/gptmbr.bin ]; then
- gptmbr='/usr/lib/syslinux/gptmbr.bin'
+ cat /usr/lib/syslinux/gptmbr.bin > $device
elif [ -f /usr/share/syslinux/gptmbr.bin ]; then
- gptmbr='/usr/share/syslinux/gptmbr.bin'
+ cat /usr/share/syslinux/gptmbr.bin > $device
else
echo "Could not find gptmbr.bin (syslinux)"
exitclean
fi
- # our magic number is LBA-2, offset 16 - (512+512+16)/$bs
- dd if=$device bs=16 skip=65 count=1 | cat $gptmbr - > $device
# Make it bootable on EFI and BIOS
parted -s $device set $partnum legacy_boot on
else
commit da79706e826836d7ce722c53ceba50f1b9f80553
Author: Brian C. Lane <bcl(a)redhat.com>
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 837ba2c..35ecea3 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -175,6 +175,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$//')
@@ -198,6 +199,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$//')
@@ -225,6 +227,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 95fa55f730dff47b1331b1457c3f49c82a2fdb5b
Author: Brian C. Lane <bcl(a)redhat.com>
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 11c387b..837ba2c 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -96,6 +96,8 @@ resetMBR() {
fi
# our magic number is LBA-2, offset 16 - (512+512+16)/$bs
dd if=$device bs=16 skip=65 count=1 | cat $gptmbr - > $device
+ # 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 54c2f9b09cc5aeffe495a20bfc5ea6923f65bdcd
Author: Brian C. Lane <bcl(a)redhat.com>
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 3b6c151..11c387b 100755
--- a/tools/livecd-iso-to-disk.sh
+++ b/tools/livecd-iso-to-disk.sh
@@ -724,7 +724,11 @@ if [ \( "$isotype" = "installer" -o "$isotype" = "netinst" \) ]; then
echo "Copying DVD image to USB stick"
mkdir -p $USBMNT/images/
if [ "$imgtype" = "install" ]; then
- copyFile $CDMNT/images/install.img $USBMNT/images/install.img || exitclean
+ for img in install.img updates.img product.img; do
+ if [ -e $CDMNT/images/$img ]; then
+ copyFile $CDMNT/images/$img $USBMNT/images/$img || exitclean
+ fi
+ done
fi
if [ "$isotype" = "installer" -a -z "$skipcopy" ]; then
cp $ISO $USBMNT/
12 years, 8 months
3 commits - tools/livecd-iso-to-disk.sh
by Brian C. Lane
tools/livecd-iso-to-disk.sh | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
New commits:
commit e2b1bb68fc602dd44e5f7b34df60cf1ed4d4b36a
Author: Brian C. Lane <bcl(a)redhat.com>
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 24053dd826566d5bc1ca51a72278096bdd05bba0
Author: Brian C. Lane <bcl(a)redhat.com>
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 840fa86b4d7e34cd1d863b314831c7311411cb3b
Author: Bruno Wolff III <bruno(a)wolff.to>
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
12 years, 8 months
How to make persistent changes
by Muhammad Ammar
Hi All,
Currently i am using two kickstarts(fedora-live-base.ks and
fedora-live-desktop.ks) from spin-kickstarts package for my custom iso
creation using livecd-creator.
The problem is the changes i made in %post section of fedora-live-desktop.ks
are only visible when my custom iso is booting from USB but when i installed
the iso to Hard-disk my changes vanished.
The changes are related to gconf using gsettings.
What should i do to see changes when iso is installed to Hard-disk?
Regards,
12 years, 8 months
tip: livecd-creator yum debugging
by Mads Kiilerich
Package dependencies and failures sometimes show up when building
images. To debug that it is nice if yum is a bit more verbose when
resolving dependencies. I usually make a hack for that and forget what I
did so it takes some time to do it next time, so here it is for your
benefit and for my reference:
--- /tmp/yuminst.py 2011-08-18 12:19:51.549953079 +0200
+++ /usr/lib/python2.7/site-packages/imgcreate/yuminst.py 2011-08-18
12:20:29.002485171 +0200
@@ -91,7 +91,7 @@
def setup(self, confpath, installroot):
self._writeConf(confpath, installroot)
self._cleanupRpmdbLocks(installroot)
- self.doConfigSetup(fn = confpath, root = installroot)
+ self.doConfigSetup(fn = confpath, root = installroot, debuglevel=5)
self.conf.cache = 0
self.doTsSetup()
self.doRpmDBSetup()
It would be nice if it could be controlled with some livecd-creator
command line option.
/Mads
12 years, 8 months
imgcreate/creator.py imgcreate/kickstart.py
by Brian C. Lane
imgcreate/creator.py | 70 ++++++++++++++-----------------------------------
imgcreate/kickstart.py | 3 +-
2 files changed, 23 insertions(+), 50 deletions(-)
New commits:
commit cb058720dc6ffee1560dc147f50b95dc7ce49746
Author: Daniel Walsh <dwalsh(a)redhat.com>
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")):
12 years, 8 months
Makefile
by Brian C. Lane
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 775aff44cac2c7842aad31b37dec4f41f35c3675
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Thu Aug 11 13:47:53 2011 -0700
master is now v17.X
diff --git a/Makefile b/Makefile
index 98d73f2..a334fe6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-VERSION = 16.3
+VERSION = 17.0
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
12 years, 8 months
umount: /var/tmp/imgcreate-cCEUw_/install_root: device is busy ?
by Ed Sutton
After every livecd-creator build I must restart and reboot my CentOS 5.2 machine using the fsck option to fix disk issues I do not understand. I tried a work-around without success for a similar sounding problem:
Bug 509427 - livecd-creator fails to unmount
https://bugzilla.redhat.com/show_bug.cgi?id=509427
Any suggestions on troubleshooting are much appreciated.
-Ed
Kickstart Output
-------------------------------------------------------
Created: /var/lib/jenkins/jobs/LRADDS_SBC_OE_LIVECD_TEST/workspace/Installation_Files/src_live_root/isolinux/initrd0.img
find: /var/tmp/imgcreate-cCEUw_/install_root/proc/14833: No such file or directory
Execute: umount-hack.ks...
+ /usr/sbin/lsof /dev/loop0 /dev/loop1 /dev/loop2 /dev/loop3 /dev/loop4 /dev/loop5 /dev/loop6 /dev/loop7
+ grep -v /var/tmp/imgcreate-cCEUw_/install_root/tmp/ks-script-jnzbSQ
+ grep /var/tmp/imgcreate-cCEUw_/install_root
+ set +x
umount: /var/tmp/imgcreate-cCEUw_/install_root/proc: device is busy
umount: /var/tmp/imgcreate-cCEUw_/install_root/proc: device is busy
umount: /var/tmp/imgcreate-cCEUw_/install_root: device is busy
umount: /var/tmp/imgcreate-cCEUw_/install_root: device is busy
ioctl: LOOP_CLR_FD: Device or resource busy
umount: /var/tmp/imgcreate-cCEUw_/install_root: device is busy
umount: /var/tmp/imgcreate-cCEUw_/install_root: device is busy
e2fsck 1.39 (29-May-2006)
sbc-dds-livecd-i: recovering journal
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
sbc-dds-livecd-i: ***** FILE SYSTEM WAS MODIFIED *****
sbc-dds-livecd-i: 68102/524288 files (0.4% non-contiguous), 443027/1048576 blocks
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
sbc-dds-livecd-i: 68102/229376 files (0.5% non-contiguous), 433261/433261 blocks
Creating little endian 3.0 filesystem on /var/tmp/imgcreate-cCEUw_/iso-xNZuGZ/LiveOS/osmin.img, block size 65536.
Little endian filesystem, data block size 65536, compressed data, compressed metadata, compressed fragments
Filesystem size 0.25 Kbytes (0.00 Mbytes)
3.04% of uncompressed filesystem size (8.20 Kbytes)
Inode table size 43 bytes (0.04 Kbytes)
69.35% of uncompressed inode table size (62 bytes)
Directory table size 21 bytes (0.02 Kbytes)
100.00% of uncompressed directory table size (21 bytes)
Number of duplicate files found 0
Number of inodes 2
Number of files 1
Number of fragments 1
Number of symbolic links 0
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 1
Number of uids 1
root (0)
Number of gids 0
Creating little endian 3.0 filesystem on /var/tmp/imgcreate-cCEUw_/iso-xNZuGZ/LiveOS/squashfs.img, block size 65536.
Little endian filesystem, data block size 65536, compressed data, compressed metadata, compressed fragments
Filesystem size 569229.82 Kbytes (555.89 Mbytes)
13.57% of uncompressed filesystem size (4194560.32 Kbytes)
Inode table size 66113 bytes (64.56 Kbytes)
25.20% of uncompressed inode table size (262306 bytes)
Directory table size 46 bytes (0.04 Kbytes)
100.00% of uncompressed directory table size (46 bytes)
Number of duplicate files found 0
Number of inodes 3
Number of files 1
Number of fragments 0
Number of symbolic links 0
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 2
Number of uids 1
root (0)
Number of gids 0
INFO: UTF-8 character encoding detected by locale settings.
Assuming UTF-8 encoded filenames on source filesystem,
use -input-charset to override.
Unknown file type (unallocated) /var/tmp/imgcreate-cCEUw_/iso-xNZuGZ/.. - ignoring and continuing.
Size of boot image is 4 sectors -> No emulation
1.70% done, estimate finish Thu Aug 4 14:55:14 2011
3.39% done, estimate finish Thu Aug 4 14:55:14 2011
...
98.19% done, estimate finish Thu Aug 4 14:55:18 2011
99.88% done, estimate finish Thu Aug 4 14:55:19 2011
Total translation table size: 4728
Total rockridge attributes bytes: 1680
Total directory bytes: 4980
Path table size(bytes): 40
Max brk space used 0
295359 extents written (576 MB)
isomd5sum not installed; not setting up mediacheck
umount: /var/tmp/imgcreate-cCEUw_/install_root: device is busy
umount: /var/tmp/imgcreate-cCEUw_/install_root: device is busy
lsof
----------------------------------------------------
/usr/sbin/lsof |grep loop
loop0 4831 root cwd DIR 253,0 4096 2 /
loop0 4831 root rtd DIR 253,0 4096 2 /
loop0 4831 root txt unknown /proc/4831/exe
loop1 10369 root cwd DIR 253,0 4096 2 /
loop1 10369 root rtd DIR 253,0 4096 2 /
loop1 10369 root txt unknown /proc/10369/exe
12 years, 8 months
Can update initrd.img before livecd-creator makes iso?
by Ed Sutton
Can initrd.img be replaced *before* livecd-creator creates the ISO? Perhaps from the kickstart file? Or is it simpler to mount the resulting ISO made by livecd-creator, copy, replace, and make new ISO?
My goal is make a build script that uses livecd-creator with a kickstart that that installs an updated kernel RPM package and creates a bootable live ISO with new initrd.img containing the updated /lib/modules/ for the updated kernel.
Thanks in advance for any direction,
-Ed
12 years, 8 months