Fix the grub issue
[grml2usb.git] / grml2usb
index 5a9eed0..2c4c1b2 100755 (executable)
--- a/grml2usb
+++ b/grml2usb
@@ -4,7 +4,7 @@
 # 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.
 # 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.
-# Latest change: Don Sep 13 01:38:26 CEST 2007 [mika]
+# Latest change: Sam Jän 19 16:57:39 CET 2008 [mika]
 ################################################################################
 
 # colors {{{
 ################################################################################
 
 # colors {{{
@@ -49,7 +49,7 @@
   LANGUAGE='C'
   LC_ALL='C'
   PROGRAMNAME=${0##*/}
   LANGUAGE='C'
   LC_ALL='C'
   PROGRAMNAME=${0##*/}
-  VERSION='0.7.6'
+  VERSION='0.8.0'
   ISO="$1"
   DEVICE="$2"
 
   ISO="$1"
   DEVICE="$2"
 
@@ -184,9 +184,18 @@ copyit(){
        cp ${DEVICE}/boot/isolinux/isolinux.cfg ${DEVICE}/boot/isolinux/syslinux.cfg && \
        echo 'syslinux.cfg' >> $DEVICE/grml2usb.filelist
     fi
        cp ${DEVICE}/boot/isolinux/isolinux.cfg ${DEVICE}/boot/isolinux/syslinux.cfg && \
        echo 'syslinux.cfg' >> $DEVICE/grml2usb.filelist
     fi
-    mv    ${DEVICE}/boot/isolinux/* ${DEVICE}/    && \
-    rmdir ${DEVICE}/boot/isolinux                 && \
-    rmdir ${DEVICE}/boot/
+
+    if mv ${DEVICE}/boot/isolinux/* ${DEVICE}/ ; then
+       rmdir ${DEVICE}/boot/isolinux
+    fi
+
+    if [ -d "${DEVICE}"/boot/grub ] ; then
+       [ -d "${DEVICE}/grub" ] || mkdir ${DEVICE}/grub
+       mv ${DEVICE}/boot/grub/* ${DEVICE}/grub/
+    fi
+
+    rmdir ${DEVICE}/boot 2>/dev/null
+
     sync && echo "${WHITE}done${NORMAL}"
   else
     unmount
     sync && echo "${WHITE}done${NORMAL}"
   else
     unmount