X-Git-Url: http://git.grml.org/?p=grml-live.git;a=blobdiff_plain;f=grml-live;h=e31244d1edc6df35eec2626b0a32150fda285135;hp=9fc2d26377ee87be9fb07858bdbf2f24017841dd;hb=4f8937bce96f552121e525eb927a2daea4dfae88;hpb=64160df70c57e1404ca3cfd27cfaf0a3928baf78 diff --git a/grml-live b/grml-live index 9fc2d26..e31244d 100755 --- a/grml-live +++ b/grml-live @@ -4,7 +4,7 @@ # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2 or any later version. -# Latest change: Thu Sep 20 13:25:31 CEST 2007 [mika] +# Latest change: Sat Sep 29 10:44:26 CEST 2007 [mika] ################################################################################ # read configuration files, set some misc variables {{{ @@ -56,13 +56,15 @@ trap bailout 1 2 3 15 [ -n "$HOSTNAME" ] || HOSTNAME=grml [ -n "$USERNAME" ] || USERNAME=grml [ -n "$CLASSES" ] || CLASSES="GRML,I386" +[ -n "$BOOT_METHOD" ] || BOOT_METHOD='isolinux' [ -n "$TARGET" ] || bailout 1 "${PN}: \$TARGET not specified. Please adjust $LIVE_CONF. Exiting." [ -n "$VERSION" ] || VERSION="0.0.1" [ -n "$RELEASENAME" ] || RELEASENAME="grml-live rocks" +[ -n "$GRML_NAME" ] || GRML_NAME='grml' [ -n "$LOGDIR" ] || LOGDIR="/var/log/fai/dirinstall/$HOSTNAME" -[ -d "$LOGDIR" ] || mkdir $LOGDIR +[ -d "$LOGDIR" ] || mkdir -p $LOGDIR LOGFILE="$LOGDIR/grml-live.conf" # }}} @@ -121,17 +123,18 @@ usage() echo " $PN - build process script for generating a (grml based) Linux Live-ISO -Usage: $PN [-c ] [-i ] [-r ] \\ - [-s ] [-t ] [-v ] [-Fvh] +Usage: $PN [-c ] [-g ] [-i ] \\ + [-r ] [-s ] [-t ] \\ + [-v ] [-FVh] Usage examples: $PN $PN -c GRMLBASE,GRML_X,I386 -t /grml/ $PN -c GRMLBASE,I386 -t /dev/shm/grml - $PN -c GRMLBASE,GRML_SMALL,I386 - $PN -c GRMLBASE,I386 -v -i grml_0.0-1.iso - $PN -c GRMLBASE,I386 -s sid + $PN -c GRMLBASE,GRML_SMALL,I386 -g grml-small -v 1.0 + $PN -c GRMLBASE,I386 -i grml_0.0-1.iso + $PN -c GRMLBASE,I386 -s sid -V More details: man grml-live /usr/share/doc/grml-live/grml-live.html @@ -144,9 +147,10 @@ http://grml.org/bugs/ # command line parsing {{{ -while getopts "c:i:r:s:t:v:FhV" opt; do +while getopts "c:g:i:r:s:t:v:FhV" opt; do case "$opt" in c) CLASSES="$OPTARG" ;; + g) GRML_NAME="$OPTARG" ;; i) ISO_NAME="$OPTARG" ;; r) RELEASENAME="$OPTARG" ;; s) SUITE="$OPTARG" ;; @@ -184,6 +188,7 @@ if [ -z "$FORCE" ] ; then [ -n "$BUILD_TARGET" ] && echo " build target: $BUILD_TARGET" [ -n "$ISO_TARGET" ] && echo " ISO target: $ISO_TARGET" [ -n "$SUITE" ] && echo " Debian suite: $SUITE" + [ -n "$BOOT_METHOD" ] && echo " Boot method: $BOOT_METHOD" [ -n "$FAI_ARGS" ] && echo " additional arguments for FAI: $FAI_ARGS" [ -n "$VERBOSE" ] && echo " Using VERBOSE mode." echo @@ -203,8 +208,8 @@ fi # on-the-fly configuration {{{ if [ -n "$MIRROR_DIRECTORY" ] ; then if ! [ -d "$MIRROR_DIRECTORY/debian" ] ; then - eerror "Sorry, $MIRROR_DIRECTORY/debian does not seem to exist. Exiting." log "Sorry, $MIRROR_DIRECTORY/debian does not seem to exist. Exiting. [$(date)]" + eerror "Sorry, $MIRROR_DIRECTORY/debian does not seem to exist. Exiting." bailout 1 fi echo "$MIRROR_SOURCES" > /etc/grml/fai/apt/sources.list @@ -237,15 +242,15 @@ fi [ -n "$CHROOT_TARGET" ] || CHROOT_TARGET="$TARGET/grml_chroot" if [ -d "$CHROOT_TARGET/bin" ] ; then - ewarn "$CHROOT_TARGET exists already, skipping stage 'fai dirinstall'" ; eend 0 log "$CHROOT_TARGET exists already, skipping stage 'fai dirinstall'" + ewarn "$CHROOT_TARGET exists already, skipping stage 'fai dirinstall'" ; eend 0 else mkdir -p "$CHROOT_TARGET" || bailout 5 "Problem with creating $CHROOT_TARGET for FAI" if [ -n "${MIRROR_DIRECTORY}" ] ; then mkdir -p "${CHROOT_TARGET}/${MIRROR_DIRECTORY}" mount --bind "${MIRROR_DIRECTORY}" "${CHROOT_TARGET}/${MIRROR_DIRECTORY}" fi - fai $VERBOSE -C "$GRML_FAI_CONFIG" -c"$CLASSES" dirinstall "$CHROOT_TARGET" $FAI_ARGS | tee -a $LOGFILE + fai $VERBOSE -C "$GRML_FAI_CONFIG" -c"$CLASSES" -u "$HOSTNAME" dirinstall "$CHROOT_TARGET" $FAI_ARGS | tee -a $LOGFILE umount $CHROOT_TARGET/proc 2>/dev/null || /bin/true umount $CHROOT_TARGET/sys 2>/dev/null || /bin/true [ -n "$MIRROR_DIRECTORY" ] && umount "${CHROOT_TARGET}/${MIRROR_DIRECTORY}" @@ -261,13 +266,13 @@ else fi if [ -n "$ERROR" ] ; then - eerror "There was an error during execution of stage 'fai dirinstall'" - echo " Check out /var/log/fai/dirinstall/$HOSTNAME/... for details. [exit ${ERROR}]" log "There was an error during execution of stage 'fai dirinstall' [$(date)]" + eerror "There was an error during execution of stage 'fai dirinstall'" + echo " Check out /var/log/fai/dirinstall/$HOSTNAME/ for details. [exit ${ERROR}]" eend 1 ; exit 1 else - einfo "Finished execution of stage 'fai dirinstall'" log "Finished execution of stage 'fai dirinstall' [$(date)]" + einfo "Finished execution of stage 'fai dirinstall'" fi fi # }}} @@ -276,52 +281,55 @@ fi [ -n "$BUILD_TARGET" ] || BUILD_TARGET="$TARGET/grml_cd" mkdir -p "$BUILD_TARGET" || bailout 6 "Problem with creating $BUILD_TARGET for stage ARCH" -# i386: [ -n "$ARCH" ] || ARCH="$(dpkg --print-architecture)" -if [ "$ARCH" = i386 ] ; then + +# i386: +if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then if [ -d "$BUILD_TARGET"/boot ] ; then - ewarn "$BUILD_TARGET/boot exists already, skipping stage 'boot'" ; eend 0 log "$BUILD_TARGET/boot exists already, skipping stage 'boot'" + ewarn "$BUILD_TARGET/boot exists already, skipping stage 'boot'" ; eend 0 else # booting stuff: mkdir -p "$BUILD_TARGET"/boot/isolinux + cp /boot/memtest86+.bin "$BUILD_TARGET"/boot/isolinux/memtest + cp "$CHROOT_TARGET"/boot/initrd* "$BUILD_TARGET"/boot/isolinux/initrd.gz + cp "$CHROOT_TARGET"/boot/vmlinuz* "$BUILD_TARGET"/boot/isolinux/linux26 + cp /usr/lib/syslinux/chain.c32 "$BUILD_TARGET"/boot/isolinux/ + cp /usr/lib/syslinux/isolinux.bin "$BUILD_TARGET"/boot/isolinux/ + cp /usr/lib/syslinux/memdisk "$BUILD_TARGET"/boot/isolinux/ + cp /usr/lib/syslinux/menu.c32 "$BUILD_TARGET"/boot/isolinux/ + cp /usr/share/grml-live/templates/boot/isolinux/* "$BUILD_TARGET"/boot/isolinux/ + cp /usr/share/grml-live/templates/boot/isolinux/* "$BUILD_TARGET"/boot/isolinux/ + cp -a /usr/share/grml-live/templates/boot/grub "$BUILD_TARGET"/boot/ + [ -d "$BUILD_TARGET"/GRML ] || mkdir "$BUILD_TARGET"/GRML - cp /boot/memtest86+.bin "$BUILD_TARGET"/boot/isolinux/memtest - cp "$CHROOT_TARGET"/boot/initrd* "$BUILD_TARGET"/boot/isolinux/initrd.gz - cp "$CHROOT_TARGET"/boot/vmlinuz* "$BUILD_TARGET"/boot/isolinux/linux26 - cp /usr/lib/syslinux/chain.c32 "$BUILD_TARGET"/boot/isolinux/ - cp /usr/lib/syslinux/isolinux.bin "$BUILD_TARGET"/boot/isolinux/ - cp /usr/lib/syslinux/memdisk "$BUILD_TARGET"/boot/isolinux/ - cp /usr/lib/syslinux/menu.c32 "$BUILD_TARGET"/boot/isolinux/ - cp /usr/share/grml-live/i386_files/boot/isolinux/* "$BUILD_TARGET"/boot/isolinux/ - cp /usr/share/grml-live/i386_files/boot/isolinux/* "$BUILD_TARGET"/boot/isolinux/ - cp -a /usr/share/grml-live/i386_files/boot/grub "$BUILD_TARGET"/boot/ + cp -a /usr/share/grml-live/templates/GRML/* "$BUILD_TARGET"/GRML/ # adjust boot splash information: ISO_DATE="$(date +%Y-%m-%d)" - VERSION="$(cut_string 5 "$VERSION")" ; VERSION="$(extend_string_end 5 "$VERSION")" - RELEASENAME="$(cut_string 30 "$RELEASENAME")" ; RELEASENAME="$(extend_string_end 30 "$RELEASENAME")" + RELEASE_INFO="$GRML_NAME $VERSION - Release Codename $RELEASENAME" + RELEASE_INFO="$(cut_string 68 "$RELEASE_INFO")" + RELEASE_INFO="$(extend_string_end 68 "$RELEASE_INFO")" - sed -i "s/%VERSION%/$VERSION/" "$BUILD_TARGET"/boot/isolinux/boot.msg - sed -i "s/%RELEASENAME%/$RELEASENAME/" "$BUILD_TARGET"/boot/isolinux/boot.msg - sed -i "s/%DATE%/$ISO_DATE/" "$BUILD_TARGET"/boot/isolinux/boot.msg + sed -i "s/%RELEASE_INFO%/$GRML_NAME $VERSION - $RELEASENAME/" "$BUILD_TARGET"/GRML/grml-version + sed -i "s/%DATE%/$ISO_DATE/" "$BUILD_TARGET"/GRML/grml-version - sed -i "s/%VERSION%/$VERSION/" "$BUILD_TARGET"/boot/isolinux/boot-beep.msg - sed -i "s/%RELEASENAME%/$RELEASENAME/" "$BUILD_TARGET"/boot/isolinux/boot-beep.msg - sed -i "s/%DATE%/$ISO_DATE/" "$BUILD_TARGET"/boot/isolinux/boot-beep.msg + sed -i "s/%RELEASE_INFO%/$RELEASE_INFO/" "$BUILD_TARGET"/boot/isolinux/boot.msg + sed -i "s/%DATE%/$ISO_DATE/" "$BUILD_TARGET"/boot/isolinux/boot.msg - sed -i "s/%VERSION%/$VERSION/" "$BUILD_TARGET"/boot/grub/menu.lst + sed -i "s/%RELEASE_INFO%/$RELEASE_INFO/" "$BUILD_TARGET"/boot/isolinux/boot-beep.msg + sed -i "s/%DATE%/$ISO_DATE/" "$BUILD_TARGET"/boot/isolinux/boot-beep.msg + + sed -i "s/%VERSION%/$VERSION/" "$BUILD_TARGET"/boot/grub/menu.lst + sed -i "s/%GRML_NAME%/$GRML_NAME/" "$BUILD_TARGET"/boot/grub/menu.lst # autostart for Windows: - cp /usr/share/grml-live/windows/autostart/autorun.bat "$BUILD_TARGET"/ - cp /usr/share/grml-live/windows/autostart/autorun.inf "$BUILD_TARGET"/ - cp /usr/share/grml-live/windows/autostart/autorun.pif "$BUILD_TARGET"/ - cp /usr/share/grml-live/windows/autostart/cdrom.ico "$BUILD_TARGET"/ + cp /usr/share/grml-live/templates/windows/autostart/* "$BUILD_TARGET"/ # windows-binaries: if [ -n "$WINDOWS_BINARIES" ] ; then if [ -f "$BUILD_TARGET"/windows/putty.exe ] ; then - ewarn "$BUILD_TARGET/windows exists already, skipping stage 'WINDOWS_BINARIES'" ; eend 0 log "$BUILD_TARGET/windows exists already, skipping stage 'WINDOWS_BINARIES'" + ewarn "$BUILD_TARGET/windows exists already, skipping stage 'WINDOWS_BINARIES'" ; eend 0 else mkdir "$BUILD_TARGET"/windows ( cd "$BUILD_TARGET"/windows @@ -329,14 +337,11 @@ if [ "$ARCH" = i386 ] ; then wget -O ${file}.exe ${WINDOWS_BINARIES}/${file}.exe done ) fi - einfo "Finished execution of stage 'WINDOWS_BINARIES'" ; eend 0 log "Finished execution of stage 'WINDOWS_BINARIES' [$(date)]" + einfo "Finished execution of stage 'WINDOWS_BINARIES'" ; eend 0 fi einfo "Finished execution of stage 'boot'" ; eend 0 fi -# amd64: -elif [ "$ARCH" = amd64 ] ; then - ewarn 'Warning: gebi, it is your turn. :)'>&2 # ppc: elif [ "$ARCH" = powerpc ] ; then ewarn 'Warning: formorer, it is your turn. :)'>&2 @@ -346,21 +351,24 @@ else fi if [ -f "$BUILD_TARGET"/live/grml.squashfs ] ; then - ewarn "$BUILD_TARGET/live exists already, skipping stage 'squashfs'" ; eend 0 log "$BUILD_TARGET/live exists already, skipping stage 'squashfs'" + ewarn "$BUILD_TARGET/live exists already, skipping stage 'squashfs'" ; eend 0 else mkdir "$BUILD_TARGET"/live mksquashfs $CHROOT_TARGET/* $BUILD_TARGET/live/grml.squashfs -noappend - einfo "Finished execution of stage 'squashfs'" ; eend 0 log "Finished execution of stage 'squashfs' [$(date)]" + einfo "Finished execution of stage 'squashfs'" ; eend 0 fi + +# create md5sum file: +( cd $BUILD_TARGET/GRML && +find .. -type f -not -name md5sums -exec md5sum {} \; > md5sums ) # }}} # ISO_TARGET - mkisofs {{{ [ -n "$ISO_TARGET" ] || ISO_TARGET="$TARGET/grml_isos" -[ -n "$ISO_NAME" ] || ISO_NAME="grml_${VERSION}.iso" +[ -n "$ISO_NAME" ] || ISO_NAME="$GRML_NAME_${VERSION}.iso" -[ -n "$BOOT_METHOD" ] || BOOT_METHOD='isolinux' if [ "$BOOT_METHOD" = "isolinux" ] ; then BOOT_FILE="boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat" elif [ "$BOOT_METHOD" = "grub" ] ; then @@ -368,23 +376,30 @@ elif [ "$BOOT_METHOD" = "grub" ] ; then fi if [ -f "${ISO_TARGET}/${ISO_NAME}" ] ; then - ewarn "$ISO_TARGET exists already, skipping stage 'iso build'" ; eend 0 log "$ISO_TARGET exists already, skipping stage 'iso build'" + ewarn "$ISO_TARGET exists already, skipping stage 'iso build'" ; eend 0 else mkdir -p "$ISO_TARGET" || bailout 6 "Problem with creating $ISO_TARGET for stage 'iso build'" - ( cd "$BUILD_TARGET" && - mkisofs -V "grml $VERSION" -publisher 'grml-live | grml.org' \ - -l -r -J -no-emul-boot -boot-load-size 4 -boot-info-table \ - -b $BOOT_FILE \ - -o "${ISO_TARGET}/${ISO_NAME}" . - ) - einfo "Finished execution of stage 'iso build'" ; eend 0 - log "Finished execution of stage 'iso build' [$(date)]" + CURRENT_DIR=$(pwd) + cd "$BUILD_TARGET" && + mkisofs -V "grml $VERSION" -publisher 'grml-live | grml.org' \ + -l -r -J -no-emul-boot -boot-load-size 4 -boot-info-table \ + -b $BOOT_FILE \ + -o "${ISO_TARGET}/${ISO_NAME}" . ; RC=$? + cd $CURRENT_DIR + if [ "$RC" = 0 ] ; then + log "Finished execution of stage 'iso build' [$(date)]" + einfo "Finished execution of stage 'iso build'" ; eend 0 + else + log "There was an error ($RC) executing stage 'iso build' [$(date)]" + eerror "There was an error executing stage 'iso build'" ; eend 1 + bailout $RC + fi fi # }}} # finalize {{{ -SECONDS="$[$(cut -d . -f 1 /proc/uptime)-$start_seconds]" +[ -n "$start_seconds" ] && SECONDS="$[$(cut -d . -f 1 /proc/uptime)-$start_seconds]" einfo "Sucessfully finished execution of $PN [running ${SECONDS} seconds]" ; eend 0 log "Sucessfully finished execution of $PN [running ${SECONDS} seconds]" log "------------------------------------------------------------------------------"