-Q skip netboot package build
-r <release_name> release name
-s <suite> Debian suite/release, like: stable, testing, unstable
+ -S <script_directory> place of scripts (defaults to /usr/share/grml-live/scripts)
-t <template_directory> place of the templates
-u update existing chroot instead of rebuilding it from scratch
-U <username> arrange output to be owned by specified username
fi
# source main configuration file:
-LIVE_CONF=/etc/grml/grml-live.conf
+[ -z "$LIVE_CONF" ] && LIVE_CONF='/etc/grml/grml-live.conf'
if ! [ -r "$LIVE_CONF" ] ; then
ewarn "Configuration file $LIVE_CONF can not be read, ignoring"
else
# }}}
# command line parsing {{{
-while getopts "a:C:c:d:D:e:g:i:I:o:r:s:t:U:v:AbBFhnNqQuVz" opt; do
+while getopts "a:C:c:d:D:e:g:i:I:o:r:s:S:t:U:v:AbBFhnNqQuVz" opt; do
case "$opt" in
a) ARCH="$OPTARG" ;;
A) CLEAN_ARTIFACTS=1 ;;
Q) SKIP_NETBOOT=1 ;;
r) RELEASENAME="$OPTARG" ;;
s) SUITE="$OPTARG" ;;
+ S) SCRIPTS_DIRECTORY="$OPTARG";;
t) TEMPLATE_DIRECTORY="$OPTARG";;
v) VERSION="$OPTARG" ;;
F) FORCE=1 ;;
[ -n "$SQUASHFS_EXCLUDES_FILE" ] || SQUASHFS_EXCLUDES_FILE="${GRML_FAI_CONFIG}/config/grml/squashfs-excludes"
[ -n "$SUITE" ] || SUITE='testing'
[ -n "$TEMPLATE_DIRECTORY" ] || TEMPLATE_DIRECTORY='/usr/share/grml-live/templates'
+[ -n "$SCRIPTS_DIRECTORY" ] || SCRIPTS_DIRECTORY='/usr/share/grml-live/scripts'
[ -n "$USERNAME" ] || USERNAME='grml'
[ -n "$VERSION" ] || VERSION='0.0.1'
bailout 8
fi
- # since syslinux v3:6.03~pre1+dfsg-4 there's a split between
- # isolinux and syslinux files :(
+ # copy _required_ isolinux files
if [ -d "${CHROOT_OUTPUT}/usr/lib/ISOLINUX" ] ; then
- syslinux_dir=/usr/lib/ISOLINUX
- else
- syslinux_dir=/usr/lib/syslinux
+ copy_addon_file isolinux.bin /usr/lib/ISOLINUX isolinux
+ copy_addon_file ifcpu64.c32 /usr/lib/syslinux/modules/bios/ isolinux
+ copy_addon_file ldlinux.c32 /usr/lib/syslinux/modules/bios/ isolinux
+ copy_addon_file libcom32.c32 /usr/lib/syslinux/modules/bios/ isolinux
+ copy_addon_file libutil.c32 /usr/lib/syslinux/modules/bios/ isolinux
+ copy_addon_file vesamenu.c32 /usr/lib/syslinux/modules/bios/ isolinux
+ else # syslinux versions <= 3:4.05+dfsg-6+deb8u1
+ copy_addon_file isolinux.bin /usr/lib/syslinux isolinux
+ copy_addon_file ifcpu64.c32 /usr/lib/syslinux isolinux
+ copy_addon_file vesamenu.c32 /usr/lib/syslinux isolinux
fi
- # copy _required_ isolinux files
- for file in ifcpu64.c32 isolinux.bin vesamenu.c32; do
- copy_addon_file "${file}" "${syslinux_dir}" isolinux
- done
# *always* copy files to output directory so the variables
# get adjusted according to the build.
cp ${TEMPLATE_DIRECTORY}/boot/isolinux/* "$BUILD_OUTPUT"/boot/isolinux/
+ mkdir -p "${BUILD_OUTPUT}/boot/grub"
+ cp -a ${TEMPLATE_DIRECTORY}/boot/grub/* "$BUILD_OUTPUT"/boot/grub/
+
if [ -n "$NO_ADDONS" ] ; then
+ rm -f "$BUILD_OUTPUT"/boot/grub/addons.cfg
log "Skipping installation of boot addons as requested via \$NO_ADDONS."
einfo "Skipping installation of boot addons as requested via \$NO_ADDONS."; eend 0
else
fi # no "$TEMPLATE_DIRECTORY"/boot/addons
fi # NO_ADDONS
- if ! [ -d "${BUILD_OUTPUT}/boot/grub" ] ; then
- mkdir -p "${BUILD_OUTPUT}/boot/grub"
- fi
- cp -a ${TEMPLATE_DIRECTORY}/boot/grub/* "$BUILD_OUTPUT"/boot/grub/
-
# generate loopback.cfg config file without depending on grub's regexp module
# which isn't available in Debian/squeeze
echo "## grub2 loopback configuration" > "${BUILD_OUTPUT}"/boot/grub/loopback.cfg
[ -r "$config" ] || continue
echo "source ${config##$BUILD_OUTPUT}" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg
done
- echo "source /boot/grub/addons.cfg" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg
+ if [ -z "$NO_ADDONS" ] ; then
+ echo "source /boot/grub/addons.cfg" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg
+ fi
echo "source /boot/grub/footer.cfg" >> "${BUILD_OUTPUT}"/boot/grub/loopback.cfg
# copy grub files from target
done
echo "include options.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg"
- if [ ! -n "$NO_ADDONS" ] ; then
+ if [ -z "$NO_ADDONS" ] ; then
echo "include addons.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg"
fi
echo "include isoprompt.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg"
else
log "including ${DISTRI_NAME}.cfg in ${BUILD_OUTPUT}/boot/isolinux/distri.cfg"
echo "include ${DISTRI_NAME}.cfg" > "${BUILD_OUTPUT}/boot/isolinux/distri.cfg"
- [ -n "$NO_ADDONS" ] || echo "include addons.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/distri.cfg"
+ if [ -z "$NO_ADDONS" ] ; then
+ echo "include addons.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/distri.cfg"
+ fi
fi
fi
# make a 2048-byte bootsector for El Torito
dd if=/dev/zero of=boot/grub/toriboot.bin bs=512 count=4 2>/dev/null
# those are in 2048-byte sectors, so 1 16 matches 4 63 below
- echo 1 16 | mksh /usr/share/grml-live/scripts/bootgrub.mksh -B 11 | \
+ echo 1 16 | mksh "${SCRIPTS_DIRECTORY}/bootgrub.mksh" -B 11 | \
dd of=boot/grub/toriboot.bin conv=notrunc 2>/dev/null
fi
log "$MKISOFS -V '${GRML_NAME} ${VERSION}' -publisher 'grml-live | grml.org' -l -r -J $BOOT_ARGS -o ${ISO_OUTPUT}/${ISO_NAME} ."
log "Creating hybrid ISO file with manifold/grub2 method"
einfo "Creating hybrid ISO file with manifold/grub2 method"
# 512 bytes: MBR, partition table, load GRUB 2
- echo 4 63 | mksh /usr/share/grml-live/scripts/bootgrub.mksh -A -M 4:0x96 -g $cyls:16:32
+ echo 4 63 | mksh "${SCRIPTS_DIRECTORY}/bootgrub.mksh" -A -M 4:0x96 -g $cyls:16:32
else
log "Creating hybrid ISO file with manifold method"
einfo "Creating hybrid ISO file with manifold method"
# read only one but 2048-byte sized (scale: << 2) sector
echo $bootoff $bootoff | \
- mksh /usr/share/grml-live/scripts/bootilnx.mksh -A -M 4:0x96 -g $cyls:16:32 -S 2
+ mksh ${SCRIPTS_DIRECTORY}/bootilnx.mksh -A -M 4:0x96 -g $cyls:16:32 -S 2
fi | dd of="${ISO_OUTPUT}/${ISO_NAME}" conv=notrunc 2>/dev/null
eend $?
fi