- echo "# filelist of $PROGRAMNAME on $(date) using $ISO on ${DEVICE}:" > $DEVICE/grml2hd.filelist
- find ${TMPMNT} -type f | grep -v isolinux | sed 's#^/mnt/test/##' | tr A-Z a-z >> $DEVICE/grml2hd.filelist && \
- find ${DEVICE}/boot/isolinux -type f | sed 's#.*isolinux/##' | tr A-Z a-z >> $DEVICE/grml2hd.filelist && \
- mv ${DEVICE}/boot/isolinux/* ${DEVICE}/ && \
- rmdir ${DEVICE}/boot/isolinux && \
- rmdir ${DEVICE}/boot/
+ echo "# filelist of $PROGRAMNAME on $(date) using $ISO on ${DEVICE}:" > $DEVICE/grml2usb.filelist
+
+ find ${TMPMNT} -type f | sed "s#${TMPMNT}##" | \
+ sed "s#boot/## ; s#isolinux/## ; s#.*initrd.gz#initrd.gz# ; s#.*linux26#linux26#" | \
+ tr A-Z a-z >> $DEVICE/grml2usb.filelist
+
+ # make sure we have a valid syslinux.cfg, if not use isolinux.cfg as base
+ if ! [ -f "${DEVICE}"/boot/isolinux/syslinux.cfg ] ; then
+ cp ${DEVICE}/boot/isolinux/isolinux.cfg ${DEVICE}/boot/isolinux/syslinux.cfg && \
+ echo 'syslinux.cfg' >> $DEVICE/grml2usb.filelist
+ fi
+
+ if mv ${DEVICE}/boot/isolinux/* ${DEVICE}/ ; then
+ rmdir ${DEVICE}/boot/isolinux
+ fi
+ echo boot >> $DEVICE/grml2usb.filelist
+
+ # syslinux creates a file named ldlinux.sys:
+ echo "ldlinux.sys" >> ${DEVICE}/grml2usb.filelist
+
+ if ! [ -r ${DEVICE}/live/filesystem.module ] ; then
+ GRML_NAME=grml
+ else
+ GRML_NAME=$(cat ${DEVICE}/live/filesystem.module)
+ GRML_NAME=${GRML_NAME%%.squashfs}
+ GRML_NAME="$(echo $GRML_NAME | tr -d ',./;\- ')"
+ fi
+
+ KERNEL=$(find ${TMPMNT}/boot/ -maxdepth 2 -name linux26)
+ INITRD=$(find ${TMPMNT}/boot/ -maxdepth 2 -name initrd.gz)
+
+ case $KERNEL in
+ */boot/${GRML_NAME}/linux26*) mv ${DEVICE}/boot/${GRML_NAME}/linux26 ${DEVICE}/
+ ;;
+ esac
+
+ case $INITRD in
+ */boot/${GRML_NAME}/initrd.gz*) mv ${DEVICE}/boot/${GRML_NAME}/initrd.gz ${DEVICE}/
+ ;;
+ esac
+
+ if [ -d "${DEVICE}"/boot/addons ] ; then
+ [ -d "${DEVICE}/addons" ] || mkdir ${DEVICE}/addons
+ mv ${DEVICE}/boot/addons/* ${DEVICE}/addons/
+ 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
+