Rework directory layout to fix isolinux issue
[grml-live.git] / grml-live
index 534b809..7a9615f 100755 (executable)
--- a/grml-live
+++ b/grml-live
@@ -4,10 +4,10 @@
 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2 or any later version.
-# Latest change: Sun Jan 20 22:38:18 CET 2008 [mika]
+# Latest change: Fri Feb 15 14:28:37 CET 2008 [mika]
 ################################################################################
 
-# main initialization  setup, set some misc variables {{{
+# read configuration files, set some misc variables {{{
 
 export LANG=C
 export LC_ALL=C
@@ -15,7 +15,7 @@ export LC_ALL=C
 # exit on any error:
 set -e
 
-GRML_LIVE_VERSION='0.2'
+GRML_LIVE_VERSION='0.4'
 CMDLINE="$0 $@"
 ISO_DATE="$(date +%Y-%m-%d)"
 
@@ -186,27 +186,9 @@ else
    log "No $LOCAL_CONFIG found, not sourcing it"
    LOCAL_CONFIG=''
 fi
-
-# clean/zero grml-live logfile:
-if [ -n "$ZERO_LOGFILE" ] ; then
-   echo -n > $LOGFILE
-fi
-
-# clean/zero/remove old FAI directory:
-if [ -n "$ZERO_FAI_LOGFILE" ] ; then
-   if [ -d /var/log/fai/"$HOSTNAME" ] ; then
-      rm -rf /var/log/fai/"$HOSTNAME"/"$(readlink /var/log/fai/"$HOSTNAME"/last)"
-      rm -rf /var/log/fai/"$HOSTNAME"/"$(readlink /var/log/fai/"$HOSTNAME"/last-dirinstall)"
-      rm -rf /var/log/fai/"$HOSTNAME"/"$(readlink /var/log/fai/"$HOSTNAME"/last-softupdate)"
-      rm -f /var/log/fai/"$HOSTNAME"/last \
-            /var/log/fai/"$HOSTNAME"/last-dirinstall \
-            /var/log/fai/"$HOSTNAME"/last-softupdate
-   fi
-fi
 # }}}
 
 # command line parsing {{{
-
 while getopts "a:C:c:g:i:o:r:s:t:v:bFhuVz" opt; do
   case "$opt" in
     a) ARCH="$OPTARG" ;;
@@ -242,6 +224,25 @@ specify it on the command line using the -c option."
 specify it on the command line using the -o option."
 # }}}
 
+# clean/zero grml-live logfile {{{
+if [ -n "$ZERO_LOGFILE" ] ; then
+   echo -n > $LOGFILE
+fi
+# }}}
+
+# clean/zero/remove old FAI directory {{{
+if [ -n "$ZERO_FAI_LOGFILE" ] ; then
+   if [ -d /var/log/fai/"$HOSTNAME" ] ; then
+      rm -rf /var/log/fai/"$HOSTNAME"/"$(readlink /var/log/fai/"$HOSTNAME"/last)"
+      rm -rf /var/log/fai/"$HOSTNAME"/"$(readlink /var/log/fai/"$HOSTNAME"/last-dirinstall)"
+      rm -rf /var/log/fai/"$HOSTNAME"/"$(readlink /var/log/fai/"$HOSTNAME"/last-softupdate)"
+      rm -f /var/log/fai/"$HOSTNAME"/last \
+            /var/log/fai/"$HOSTNAME"/last-dirinstall \
+            /var/log/fai/"$HOSTNAME"/last-softupdate
+   fi
+fi
+# }}}
+
 # ask user whether the setup is ok {{{
 if [ -z "$FORCE" ] ; then
    echo
@@ -440,14 +441,17 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
       ewarn "$BUILD_OUTPUT/boot exists already, skipping stage 'boot'" ; eend 0
    else
       # booting stuff:
+      [ -d "$BUILD_OUTPUT"/boot/addons   ] || mkdir -p "$BUILD_OUTPUT"/boot/addons
       [ -d "$BUILD_OUTPUT"/boot/isolinux ] || mkdir -p "$BUILD_OUTPUT"/boot/isolinux
-      cp /boot/memtest86+.bin "$BUILD_OUTPUT"/boot/isolinux/memtest
+      [ -d "$BUILD_OUTPUT"/boot/"${GRML_NAME}" ] || mkdir -p "$BUILD_OUTPUT"/boot/"${GRML_NAME}"
+
+      cp /boot/memtest86+.bin "$BUILD_OUTPUT"/boot/addons/memtest
 
       # if we don't have an initrd we a) can't boot and b) there was an error
       # during build, so check for the file:
       INITRD="$(ls $CHROOT_OUTPUT/boot/initrd* 2>/dev/null| grep -v '.bak$' | sort -r | head -1)"
       if [ -n "$INITRD" ] ; then
-         cp $INITRD "$BUILD_OUTPUT"/boot/isolinux/initrd.gz
+         cp $INITRD "$BUILD_OUTPUT"/boot/"${GRML_NAME}"/initrd.gz
          find $CHROOT_OUTPUT/boot/ -name initrd\*.bak -exec rm {} \;
       else
          log "No initrd found inside $CHROOT_OUTPUT/boot/ - Exiting"
@@ -457,7 +461,7 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
 
       KERNEL_IMAGE="$(ls $CHROOT_OUTPUT/boot/vmlinuz* 2>/dev/null | sort -r | head -1)"
       if [ -n "$KERNEL_IMAGE" ] ; then
-         cp "$KERNEL_IMAGE" "$BUILD_OUTPUT"/boot/isolinux/linux26
+         cp "$KERNEL_IMAGE" "$BUILD_OUTPUT"/boot/"${GRML_NAME}"/linux26
       else
          log "No kernel found inside $CHROOT_OUTPUT/boot/ - Exiting"
          eerror "No kernel found inside $CHROOT_OUTPUT/boot/ - Exiting" ; eend 1
@@ -472,7 +476,7 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
       fi
 
       cp ${TEMPLATE_DIRECTORY}/boot/isolinux/*  "$BUILD_OUTPUT"/boot/isolinux/
-      cp ${TEMPLATE_DIRECTORY}/boot/isolinux/*  "$BUILD_OUTPUT"/boot/isolinux/
+      cp ${TEMPLATE_DIRECTORY}/boot/addons/*    "$BUILD_OUTPUT"/boot/addons/
 
       if ! [ -d "${BUILD_OUTPUT}/boot/grub" ] ; then
          cp -a ${TEMPLATE_DIRECTORY}/boot/grub  "$BUILD_OUTPUT"/boot/
@@ -548,10 +552,10 @@ else
    # execute squashfs:
    if mksquashfs --help 2>&1 | grep -q -- -no-progress ; then
       log "mksquashfs $CHROOT_OUTPUT/* $BUILD_OUTPUT/live/grml.squashfs -noappend -no-progress"
-      mksquashfs $CHROOT_OUTPUT/* $BUILD_OUTPUT/live/grml.squashfs -noappend -no-progress $SQUASHFS_OPTIONS $SQUASHFS_ZLIB
+      mksquashfs $CHROOT_OUTPUT/* $BUILD_OUTPUT/live/"${GRML_NAME}".squashfs -noappend -no-progress $SQUASHFS_OPTIONS $SQUASHFS_ZLIB
    else
       log "mksquashfs $CHROOT_OUTPUT/* $BUILD_OUTPUT/live/grml.squashfs -noappend"
-      mksquashfs $CHROOT_OUTPUT/* $BUILD_OUTPUT/live/grml.squashfs -noappend $SQUASHFS_OPTIONS $SQUASHFS_ZLIB
+      mksquashfs $CHROOT_OUTPUT/* $BUILD_OUTPUT/live/"${GRML_NAME}".squashfs -noappend $SQUASHFS_OPTIONS $SQUASHFS_ZLIB
    fi
    log "Finished execution of stage 'squashfs' [$(date)]"
    einfo "Finished execution of stage 'squashfs'" ; eend 0