From 844d0100fa9220e4991649f9e25806b272d1ec62 Mon Sep 17 00:00:00 2001 From: Alan Pevec Date: Tue, 2 Dec 2008 11:57:36 +0100 Subject: [PATCH] edit-livecd: optionally append kernel boot params --- edit-livecd | 54 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/edit-livecd b/edit-livecd index 0200034..c122eee 100755 --- a/edit-livecd +++ b/edit-livecd @@ -25,17 +25,22 @@ warn() { printf '%s: %s\n' "$ME" "$*" >&2; } try_h() { printf "Try \`$ME -h' for more information.\n" >&2; } die() { warn "$@"; try_h; exit 1; } +NODEIMG_DEFAULT=/usr/share/ovirt-node-image/ovirt-node-image.iso +CD=$NODEIMG_DEFAULT + usage() { case $# in 1) warn "$1"; try_h; exit 1;; esac cat < /dev/null 2>&1 WDIR=`mktemp -d $PWD/livecd.XXXXXXXXXX` +# FIXME: fail if $WDIR contains white space or shell meta-characters +# FIXME: do the same for $CD. + ISO="${CD##*/}" ISO="${ISO%.iso}-custom.iso" @@ -79,9 +106,10 @@ function mnt() { addExit "df | grep $mp > /dev/null 2>&1 && umount -v $mp" } -addExit "rm -Rf $WDIR" +addExit "rm -rf $WDIR" -LABEL=$(isoinfo -d -i $CD | awk -F ": " '/Volume id:/ {print $2}') +eval "$(/lib/udev/vol_id $CD)" +LABEL=$ID_FS_LABEL # mount the CD image mnt "-t auto $CD -o loop,ro" cd @@ -122,6 +150,13 @@ mksquashfs $WDIR/sq-w/ $WDIR/cd-w/LiveOS/squashfs.img -noappend echo ">>> Recomputing MD5 sums" ( cd $WDIR/cd-w && find . -type f -not -name md5sum.txt -not -path '*/isolinux/*' -print0 | xargs -0 -- md5sum > md5sum.txt ) +if [ -n "$PARAMS" ]; then + # FIXME: make the script fail -- or maybe try to + # find a usable sed delimiter if $PARAMS contains a slash + echo ">>> Appending boot parameters" + sed -i 's/^ append .*$/& '"$PARAMS/" "$WDIR/cd-w/isolinux/isolinux.cfg" +fi + echo ">>> Creating ISO image $ISO" mkisofs \ -V "$LABEL" \ @@ -134,4 +169,3 @@ mkisofs \ # The trap ... callbacks will unmount everything. set +e - -- 2.11.4.GIT