Use only etch/lenny/sid as Debian suite inside zsh completion
[grml-live.git] / grml-live
index 00e4a7e..5209776 100755 (executable)
--- a/grml-live
+++ b/grml-live
@@ -305,6 +305,15 @@ else
    FAI_ACTION=dirinstall
 fi
 
+if [ -n "$UPDATE" ] ; then
+   if ! [ -r "$CHROOT_OUTPUT/etc/grml_version" ] ; then
+      log "Error: It does not look like you have a working chroot system. Updating not possible."
+      eerror "Error: It does not look like you have a working chroot system. Updating not possible."
+      eend 1
+      bailout 20
+   fi
+fi
+
 if [ -d "$CHROOT_OUTPUT/bin" -a -z "$UPDATE" ] ; then
    log "$CHROOT_OUTPUT exists already, skipping stage 'fai dirinstall'"
    ewarn "$CHROOT_OUTPUT exists already, skipping stage 'fai dirinstall'" ; eend 0
@@ -374,7 +383,8 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
          bailout 10
       fi
 
-      cp "$CHROOT_OUTPUT"/boot/vmlinuz*  "$BUILD_OUTPUT"/boot/isolinux/linux26
+      KERNEL_IMAGE="$(ls $CHROOT_OUTPUT/boot/vmlinuz* | sort -r | head -1)"
+      cp "$KERNEL_IMAGE"                 "$BUILD_OUTPUT"/boot/isolinux/linux26
       cp /usr/lib/syslinux/chain.c32     "$BUILD_OUTPUT"/boot/isolinux/
       cp /usr/lib/syslinux/isolinux.bin  "$BUILD_OUTPUT"/boot/isolinux/
       cp /usr/lib/syslinux/memdisk       "$BUILD_OUTPUT"/boot/isolinux/
@@ -387,10 +397,11 @@ if [ "$ARCH" = i386 ] || [ "$ARCH" = amd64 ] ; then
          bailout 8
       fi
 
-      cp ${TEMPLATE_DIRECTORY}/boot/isolinux/*               "$BUILD_OUTPUT"/boot/isolinux/
-      cp ${TEMPLATE_DIRECTORY}/boot/isolinux/*               "$BUILD_OUTPUT"/boot/isolinux/
-      if ! [ -d "${TEMPLATE_DIRECTORY}/boot/grub" ] ; then
-         cp -a ${TEMPLATE_DIRECTORY}/boot/grub                  "$BUILD_OUTPUT"/boot/
+      cp ${TEMPLATE_DIRECTORY}/boot/isolinux/*  "$BUILD_OUTPUT"/boot/isolinux/
+      cp ${TEMPLATE_DIRECTORY}/boot/isolinux/*  "$BUILD_OUTPUT"/boot/isolinux/
+
+      if ! [ -d "${BUILD_OUTPUT}/boot/grub" ] ; then
+         cp -a ${TEMPLATE_DIRECTORY}/boot/grub  "$BUILD_OUTPUT"/boot/
       fi
 
       if ! [ -d "${TEMPLATE_DIRECTORY}"/GRML ] ; then
@@ -455,7 +466,7 @@ if [ -f "$BUILD_OUTPUT"/live/grml.squashfs -a -z "$UPDATE" ] ; then
    log "$BUILD_OUTPUT/live exists already, skipping stage 'squashfs'"
    ewarn "$BUILD_OUTPUT/live exists already, skipping stage 'squashfs'" ; eend 0
 else
-   mkdir "$BUILD_OUTPUT"/live
+   [ -d "$BUILD_OUTPUT"/live ] || mkdir "$BUILD_OUTPUT"/live
    mksquashfs $CHROOT_OUTPUT/* $BUILD_OUTPUT/live/grml.squashfs -noappend
    log "Finished execution of stage 'squashfs' [$(date)]"
    einfo "Finished execution of stage 'squashfs'" ; eend 0