# exit on any error:
set -e
-GRML_LIVE_VERSION='0.9.9'
+GRML_LIVE_VERSION='0.9.14'
PN="$(basename $0)"
CMDLINE="$0 $@"
ISO_DATE="$(date +%Y-%m-%d)"
+SOURCES_LIST_FILE='/etc/grml/fai/apt/sources.list'
# usage information {{{
usage()
eerror "Sorry, $MIRROR_DIRECTORY/debian does not seem to exist. Exiting."
bailout 1
fi
- echo "$MIRROR_SOURCES" > /etc/grml/fai/apt/sources.list
+ cat > "$SOURCES_LIST_FILE" << EOF
+# NOTE: This file is *NOT* meant for manual customisation! This file is
+# modified by grml-live and any changes might be overriden.
+# You might consider using GRML_LIVE_SOURCES in /etc/grml/grml-live.conf*
+# and using /etc/grml/fai/files/etc/apt instead!'
+EOF
+ echo "$MIRROR_SOURCES" >> "$SOURCES_LIST_FILE"
if [ -n "$GRML_LIVE_SOURCES" ] ; then
- echo "$GRML_LIVE_SOURCES" >> /etc/grml/fai/apt/sources.list
+ echo "$GRML_LIVE_SOURCES" >> "$SOURCES_LIST_FILE"
fi
elif [ -n "$GRML_LIVE_SOURCES" ] ; then
- echo "$GRML_LIVE_SOURCES" > /etc/grml/fai/apt/sources.list
+ cat > "$SOURCES_LIST_FILE" << EOF
+# NOTE: This file is *NOT* meant for manual customisation! This file is
+# modified by grml-live and any changes might be overriden.
+# You might consider using GRML_LIVE_SOURCES in /etc/grml/grml-live.conf*
+# and using /etc/grml/fai/files/etc/apt instead!'
+EOF
+ echo "$GRML_LIVE_SOURCES" >> "$SOURCES_LIST_FILE"
fi
if [ -n "$FAI_DEBOOTSTRAP" ] ; then
# does this suck? YES!
if [ -n "$SUITE" ] ; then
+ # /usr/share/debootstrap/scripts/unstable does not exist, instead use 'sid':
+ case $SUITE in
+ unstable) SUITE='sid' ;;
+ esac
+
DIST=" etch\| stable\| lenny\| squeeze\| testing\| sid\| unstable"
- sed "s/\(deb .\+\)\([ \t]*\) $DIST\([ \t]*\)\(main \)/\1\2 $SUITE \3\4/" /etc/grml/fai/apt/sources.list | sponge /etc/grml/fai/apt/sources.list
+ sed "s/\(^deb .\+\)\([ \t]*\)\($DIST\)\([ \t]*\)\(main \)/\1 \2$SUITE\4\5/" "$SOURCES_LIST_FILE" | sponge "$SOURCES_LIST_FILE"
for file in "$LIVE_CONF" "$CONFIG" "$LOCAL_CONFIG" ; do
if [ -n "$file" ] ; then
- sed "s/SUITE=.*/SUITE=\"$SUITE\"/" $LIVE_CONF | sponge $LIVE_CONF
- sed "s/\(deb .\+\)\([ \t]*\) $DIST\([ \t]*\)\(main \)/\1\2 $SUITE \3\4/" "$file" | sponge "$file"
+ sed "s/^SUITE=.*/SUITE=\"$SUITE\"/" $file | sponge $file
+ sed "s/\(^deb .\+\)\([ \t]*\)\($DIST\)\([ \t]*\)\(main \)/\1 \2$SUITE\4\5/" "$file" | sponge "$file"
fi
done
# notice: activate grml-live pool only if we are building against unstable:
- if grep -qe unstable -qe sid /etc/grml/fai/apt/sources.list ; then
- grep -q 'grml-live.*main' /etc/grml/fai/apt/sources.list || \
- grep grml-stable /etc/grml/fai/apt/sources.list | \
- sed 's/grml-stable/grml-live/' >> /etc/grml/fai/apt/sources.list
+ if grep -qe unstable -qe sid "$SOURCES_LIST_FILE" ; then
+ grep -q 'grml-live.*main' "$SOURCES_LIST_FILE" || \
+ grep grml-stable "$SOURCES_LIST_FILE" | \
+ sed 's/grml-stable/grml-live/' >> "$SOURCES_LIST_FILE"
else
- grep -q 'grml-live.*main' /etc/grml/fai/apt/sources.list && \
- sed 's/.*grml-live.*/# removed grml-live repository/' /etc/grml/fai/apt/sources.list | sponge /etc/grml/fai/apt/sources.list
+ grep -q 'grml-live.*main' "$SOURCES_LIST_FILE" && \
+ sed 's/.*grml-live.*/# removed grml-live repository/' "$SOURCES_LIST_FILE" | sponge "$SOURCES_LIST_FILE"
fi
- for file in "$LIVE_CONF" "$CONFIG" "$LOCAL_CONFIG" ; do
+ for file in "$LIVE_CONF" "$CONFIG" "$LOCAL_CONFIG" "$NFSROOT_CONF" ; do
if [ -n "$file" ] ; then
- sed "s|FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" "$file" | sponge "$file"
+ sed "s|^FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" "$file" | sponge "$file"
fi
done
-
- sed "s|FAI_DEBOOTSTRAP=\"[a-z]* |FAI_DEBOOTSTRAP=\"$SUITE |" "$NFSROOT_CONF" | sponge "$NFSROOT_CONF"
fi
# set $ARCH
if grep -q -- 'FAI_DEBOOTSTRAP_OPTS.*--arch' "$NFSROOT_CONF" ; then
sed "s/--arch [a-z0-9]* /--arch $ARCH /" "$NFSROOT_CONF" | sponge "$NFSROOT_CONF"
else
- sed "s|FAI_DEBOOTSTRAP_OPTS=\"\(.*\)|FAI_DEBOOTSTRAP_OPTS=\"--arch $ARCH \1|" "$NFSROOT_CONF" | sponge "$NFSROOT_CONF"
+ sed "s|^FAI_DEBOOTSTRAP_OPTS=\"\(.*\)|FAI_DEBOOTSTRAP_OPTS=\"--arch $ARCH \1|" "$NFSROOT_CONF" | sponge "$NFSROOT_CONF"
fi
# }}}
cp ${TEMPLATE_DIRECTORY}/boot/isolinux/* "$BUILD_OUTPUT"/boot/isolinux/
if [ -z "$NO_ADDONS" ] ; then
- cp ${TEMPLATE_DIRECTORY}/boot/addons/* "$BUILD_OUTPUT"/boot/addons/
+ if ! [ -d /usr/share/grml-live/templates/boot/addons/bsd4grml ] ; then
+ ewarn "Boot addons not found, skipping therefor. (Consider installing package grml-live-addons)" ; eend 0
+ else
+ # copy only files so we can handle bsd4grml on its own
+ for file in ${TEMPLATE_DIRECTORY}/boot/addons/* ; do
+ test -f $file && cp $file "$BUILD_OUTPUT"/boot/addons/
+ done
+
+ if [ -z "$NO_ADDONS_BSD4GRML" ] ; then
+ cp -a ${TEMPLATE_DIRECTORY}/boot/addons/bsd4grml "$BUILD_OUTPUT"/boot/addons/
+ fi
+ fi
fi
if ! [ -d "${BUILD_OUTPUT}/boot/grub" ] ; then
GRML_NAME_SQUASHFS="$(cut_string 20 "$GRML_NAME_SQUASHFS")"
GRML_NAME_SQUASHFS="$(extend_string_end 20 "$GRML_NAME_SQUASHFS")"
sed -i "s/%GRML_NAME_SQUASHFS%/$GRML_NAME_SQUASHFS/" "$BUILD_OUTPUT"/boot/isolinux/f4
+ sed -i "s/%GRML_NAME_SQUASHFS%/$GRML_NAME_SQUASHFS/" "$BUILD_OUTPUT"/boot/isolinux/f5
# autostart for Windows:
if [ -d "${TEMPLATE_DIRECTORY}/windows/autostart/" ] ; then
if [ -f "$BUILD_OUTPUT"/live/${GRML_NAME}.squashfs -a -z "$UPDATE" -a -z "$BUILD_ONLY" -a -z "$BUILD_DIRTY" ] ; then
log "$BUILD_OUTPUT/live exists already, skipping stage 'squashfs'"
ewarn "$BUILD_OUTPUT/live exists already, skipping stage 'squashfs'" ; eend 0
-elif [ -f "$BUILD_OUTPUT"/live/${GRML_NAME}.squashfs -a -n "$SKIP_MKSQUASHFS" ] ; then
- log "$BUILD_OUTPUT/live exists already, skipping stage 'squashfs' as requested"
- ewarn "$BUILD_OUTPUT/live exists already, skipping stage 'squashfs' as requested" ; eend 0
+elif [ -n "$SKIP_MKSQUASHFS" ] ; then
+ log "Skipping stage 'squashfs' as requested via option -q"
+ ewarn "Skipping stage 'squashfs' as requested via option -q" ; eend 0
else
[ -d "$BUILD_OUTPUT"/live ] || mkdir "$BUILD_OUTPUT"/live
# make sure we don't leave (even an empty) base.tgz: