export LANG=C
export LC_ALL=C
+# avoid leaking into chroots
+unset TMPDIR
+
# define function getfilesize before "set -e"
if stat --help >/dev/null 2>&1; then
getfilesize='stat -c %s' # GNU stat
# source main configuration file:
LIVE_CONF=/etc/grml/grml-live.conf
-. $LIVE_CONF
+if ! [ -r "$LIVE_CONF" ] ; then
+ ewarn "Configuration file $LIVE_CONF can not be read, ignoring"
+else
+ einfo "Sourcing configuration file $LIVE_CONF"
+ . $LIVE_CONF
+ eend $?
+fi
# }}}
# umount all directories {{{
U) CHOWN_USER="$OPTARG" ;;
V) VERBOSE="-v" ;;
z) SQUASHFS_ZLIB=1 ;;
- ?) echo "invalid option -$OPTARG" >&2; bailout 1 ;;
+ ?) echo "invalid option -$OPTARG" >&2; usage; bailout 1 ;;
esac
done
shift $(($OPTIND - 1)) # set ARGV to the first not parsed commandline parameter
+
+if [ -n "$1" ] ; then
+ echo "Error: unknown argument '$1' in options. Exiting to avoid possible data loss." >&2
+ bailout 1
+fi
# }}}
# read local (non-packaged) configuration {{{
echo -n "Is this ok for you? [y/N] "
read a
if ! [ "$a" = 'y' -o "$a" = 'Y' ] ; then
- bailout 1 "Exiting as requested."
+ CLEAN_ARTIFACTS=0
+ echo "Exiting as requested."
+ exit 0
fi
echo
fi
eend 1
bailout 1
fi
- unsquashfs -d "${CHROOT_OUTPUT}" "${mountpoint}"/live/*/*.squashfs ; rc=$?
+
+ if ls "${mountpoint}"/live/*/*.squashfs 2>/dev/null | grep -q . ; then # ISOs >=2011.12
+ log "Using ${mountpoint}/live/*/*.squashfs for unsquashfs"
+ unsquashfs -d "${CHROOT_OUTPUT}" "${mountpoint}"/live/*/*.squashfs ; rc=$?
+ elif ls "${mountpoint}"/live/*.squashfs 2>/dev/null | grep -q . ; then # ISOs before 2011.12
+ log "Using ${mountpoint}/live/*.squashfs for unsquashfs"
+ unsquashfs -d "${CHROOT_OUTPUT}" "${mountpoint}"/live/*.squashfs ; rc=$?
+ else
+ log "Error: Could not find any *.squashfs files on the ISO"
+ eerror "Error: Could not find any *.squashfs files on the ISO"
+ eend 1
+ bailout 1
+ fi
+
umount "$mountpoint"
rmdir "$mountpoint"
if [ "$rc" != 0 ]; then
# validate whether the specified architecture class matches the
# architecture (option), otherwise installation of kernel will fail
-if echo $CLASSES | grep -qi i386 ; then
+if echo $CLASSES | grep -qw I386 ; then
if ! [[ "$ARCH" == "i386" ]] ; then
log "Error: You specified the I386 class but are trying to build something else (AMD64?)."
eerror "Error: You specified the I386 class but are trying to build something else (AMD64?)."
# create md5sum file:
if [ -z "$BOOTSTRAP_ONLY" ] ; then
( cd $BUILD_OUTPUT/GRML/"${GRML_NAME}" &&
- find .. -type f -not -name md5sums -not -name isolinux.bin -exec md5sum {} \; > md5sums )
+ find ../.. -type f -not -name md5sums -not -name isolinux.bin -exec md5sum {} \; > md5sums )
fi
# }}}
# (hidden NTFS, IIRC), as the partition type is sometimes needed
# to get the BIOS even look at the partition created by isohybrid
if isohybrid --help | grep -q -- --uefi ; then
- log "Detected uefi support for isohybrid, enabling"
- einfo "Detected uefi support for isohybrid, enabling"
- ISOHYBRID_OPTIONS=--uefi
+ if echo $CLASSES | grep -qw I386 ; then
+ log "Detected uefi support for isohybrid but 32bit systems do not support it, ignoring."
+ einfo "Detected uefi support for isohybrid but 32bit systems do not support it, ignoring."
+ else
+ log "Detected uefi support for isohybrid, enabling"
+ einfo "Detected uefi support for isohybrid, enabling"
+ ISOHYBRID_OPTIONS=--uefi
+ fi
fi
log "isohybrid $ISOHYBRID_OPTIONS ${ISO_OUTPUT}/${ISO_NAME}"