Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Dziallas <sebastian@when.com>2009-09-02 13:21:50 (GMT)
committer Sebastian Dziallas <sebastian@when.com>2009-09-02 13:21:50 (GMT)
commit540c6dd8e97fdab350e4223a4cb2bbd51f4d6f1f (patch)
tree1f953c9d2d749782b9b9cf244ef74d4bb11113e5
parent4f88efa369cabb1a37ae7d997fcaf254776aae76 (diff)
rebase livecd-iso-to-disk on fedora's git versionbeta
-rwxr-xr-xlivecd-iso-to-disk.sh64
1 files changed, 44 insertions, 20 deletions
diff --git a/livecd-iso-to-disk.sh b/livecd-iso-to-disk.sh
index 3ee51b1..cd75153 100755
--- a/livecd-iso-to-disk.sh
+++ b/livecd-iso-to-disk.sh
@@ -28,6 +28,7 @@ usage() {
}
cleanup() {
+ sleep 2
[ -d "$CDMNT" ] && umount $CDMNT && rmdir $CDMNT
[ -d "$USBMNT" ] && umount $USBMNT && rmdir $USBMNT
}
@@ -93,6 +94,9 @@ resetMBR() {
}
checkMBR() {
+ if [[ "$DEV" =~ "/dev/loop*" ]]; then
+ return 0
+ fi
getdisk $1
bs=$(mktemp /tmp/bs.XXXXXX)
@@ -152,8 +156,8 @@ createGPTLayout() {
/sbin/udevadm settle
sleep 5
umount $USBDEV &> /dev/null
- /sbin/mkdosfs -n FEDORA $USBDEV
- USBLABEL="UUID=$(/lib/udev/vol_id -u $USBDEV)"
+ /sbin/mkdosfs -n LIVE $USBDEV
+ USBLABEL="UUID=$(/sbin/blkid -s UUID -o value $USBDEV)"
}
createMSDOSLayout() {
@@ -174,8 +178,8 @@ createMSDOSLayout() {
/sbin/udevadm settle
sleep 5
umount $USBDEV &> /dev/null
- /sbin/mkdosfs -n FEDORA $USBDEV
- USBLABEL="UUID=$(/lib/udev/vol_id -u $USBDEV)"
+ /sbin/mkdosfs -n LIVE $USBDEV
+ USBLABEL="UUID=$(/sbin/blkid -s UUID -o value $USBDEV)"
}
checkGPT() {
@@ -191,6 +195,11 @@ checkGPT() {
partinfo=$(/sbin/parted --script -m $device "print" |grep ^$partnum:)
volname=$(echo $partinfo |cut -d : -f 6)
flags=$(echo $partinfo |cut -d : -f 7)
+ if [ "$volname" != "EFI System Partition" ]; then
+ echo "Partition name must be 'EFI System Partition'"
+ echo "This can be set in parted or you can run with --reset-mbr"
+ exitclean
+ fi
if [ "$(echo $flags |grep -c boot)" = "0" ]; then
echo "Partition isn't marked bootable!"
echo "You can mark the partition as bootable with "
@@ -204,17 +213,17 @@ checkGPT() {
checkFilesystem() {
dev=$1
- USBFS=$(/lib/udev/vol_id -t $dev)
+ USBFS=$(/sbin/blkid -s TYPE -o value $dev)
if [ "$USBFS" != "vfat" -a "$USBFS" != "msdos" -a "$USBFS" != "ext2" -a "$USBFS" != "ext3" ]; then
echo "USB filesystem must be vfat or ext[23]"
exitclean
fi
- USBLABEL=$(/lib/udev/vol_id -u $dev)
+ USBLABEL=$(/sbin/blkid -s UUID -o value $dev)
if [ -n "$USBLABEL" ]; then
USBLABEL="UUID=$USBLABEL" ;
else
- USBLABEL=$(/lib/udev/vol_id -l $dev)
+ USBLABEL=$(/sbin/blkid -s LABEL -o value $dev)
if [ -n "$USBLABEL" ]; then
USBLABEL="LABEL=$USBLABEL"
else
@@ -457,19 +466,32 @@ else
fi
livesize=$(du -s -B 1M $check | awk {'print $1;'})
if [ -n "$skipcompress" ]; then
- mount -o loop $CDMNT/LiveOS/squashfs.img $CDMNT
- livesize=$(du -s -B 1M $CDMNT/LiveOS/ext3fs.img | awk {'print $1;'})
- umount $CDMNT
+ if [ -e $CDMNT/LiveOS/squashfs.img ]; then
+ if mount -o loop $CDMNT/LiveOS/squashfs.img $CDMNT; then
+ livesize=$(du -s -B 1M $CDMNT/LiveOS/ext3fs.img | awk {'print $1;'})
+ umount $CDMNT
+ else
+ echo "WARNING: --skipcompress or --xo was specified but the currently"
+ echo "running kernel can not mount the squashfs from the ISO file to extract"
+ echo "it. The compressed squashfs will be copied to the USB stick."
+ skipcompress=""
+ fi
+ fi
fi
free=$(df -B1M $USBDEV |tail -n 1 |awk {'print $4;'})
-if [ $(($overlaysizemb + $homesizemb + $livesize + $swapsizemb)) -gt $(($free + $tbd)) ]; then
+ tba=$(($overlaysizemb + $homesizemb + $livesize + $swapsizemb))
+if [ $tba -gt $(($free + $tbd)) ]; then
echo "Unable to fit live image + overlay on available space on USB stick"
- echo "Size of live image: $livesize"
- [ "$overlaysizemb" -gt 0 ] && echo "Overlay size: $overlaysizemb"
- [ "$homesizemb" -gt 0 ] && echo "Home overlay size: $homesizemb"
- [ "$swapsizemb" -gt 0 ] && echo "Home overlay size: $swapsizemb"
- echo "Available space: $(($free + $tbd))"
+ echo "+ Size of live image: $livesize"
+ [ "$overlaysizemb" -gt 0 ] && echo "+ Overlay size: $overlaysizemb"
+ [ "$homesizemb" -gt 0 ] && echo "+ Home overlay size: $homesizemb"
+ [ "$swapsizemb" -gt 0 ] && echo "+ Swap overlay size: $swapsizemb"
+ echo "---------------------------"
+ echo "= Requested: $tba"
+ echo "- Available: $(($free + $tbd))"
+ echo "---------------------------"
+ echo "= To fit, free or decrease requested size total by: $(($tba - $free + $tbd))"
exitclean
fi
@@ -500,7 +522,7 @@ if [ -z "$skipcopy" ];then
[ ! -d $USBMNT/$LIVEOS ] && mkdir $USBMNT/$LIVEOS
[ -n "$keephome" -a -f "$USBMNT/$HOMEFILE" ] && mv $USBMNT/$HOMEFILE $USBMNT/$LIVEOS/$HOMEFILE
if [ -n "$skipcompress" -a -f $CDMNT/LiveOS/squashfs.img ]; then
- mount -o loop $CDMNT/LiveOS/squashfs.img $CDMNT
+ mount -o loop $CDMNT/LiveOS/squashfs.img $CDMNT || exitclean
cp $CDMNT/LiveOS/ext3fs.img $USBMNT/$LIVEOS/ext3fs.img || (umount $CDMNT ; exitclean)
umount $CDMNT
elif [ -f $CDMNT/LiveOS/squashfs.img ]; then
@@ -533,7 +555,7 @@ if [ "$LIVEOS" != "LiveOS" ]; then sed -i -e "s;liveimg;liveimg live_dir=$LIVEOS
if [ "$overlaysizemb" -gt 0 ]; then
echo "Initializing persistent overlay file"
- OVERFILE="overlay-$( /lib/udev/vol_id -l $USBDEV )-$( /lib/udev/vol_id -u $USBDEV )"
+ OVERFILE="overlay-$( /sbin/blkid -s LABEL -o value $USBDEV )-$( /sbin/blkid -s UUID -o value $USBDEV )"
if [ "$USBFS" = "vfat" ]; then
# vfat can't handle sparse files
dd if=/dev/zero of=$USBMNT/$LIVEOS/$OVERFILE count=$overlaysizemb bs=1M
@@ -577,6 +599,7 @@ if [ "$homesizemb" -gt 0 ]; then
done
mke2fs -j /dev/mapper/EncHomeFoo
tune2fs -c0 -i0 -ouser_xattr,acl /dev/mapper/EncHomeFoo
+ sleep 2
cryptsetup luksClose EncHomeFoo
losetup -d $loop
else
@@ -673,12 +696,13 @@ if [ -z "$multi" ]; then
# and has to be run with the file system mounted
mv $USBMNT/$SYSLINUXPATH/isolinux.cfg $USBMNT/$SYSLINUXPATH/extlinux.conf
extlinux -i $USBMNT/$SYSLINUXPATH
+ chattr -i $USBMNT/$SYSLINUXPATH/extlinux.sys
cleanup
fi
else
# we need to do some more config file tweaks for multi-image mode
- sed -i -e "s;kernel vm;kernel $LIVEOS/syslinux/vm;" $USBMNT/$SYSLINUXPATH/isolinux.cfg
- sed -i -e "s;initrd i;initrd $LIVEOS/syslinux/i;" $USBMNT/$SYSLINUXPATH/isolinux.cfg
+ sed -i -e "s;kernel vm;kernel /$LIVEOS/syslinux/vm;" $USBMNT/$SYSLINUXPATH/isolinux.cfg
+ sed -i -e "s;initrd=i;initrd=/$LIVEOS/syslinux/i;" $USBMNT/$SYSLINUXPATH/isolinux.cfg
mv $USBMNT/$SYSLINUXPATH/isolinux.cfg $USBMNT/$SYSLINUXPATH/syslinux.cfg
cleanup
fi