[ -n "$MKFS" ] || MKFS='mkfs.ext4'
[ -n "$MKFS_OPTS" ] || MKFS_OPTS=''
[ -n "$PACKAGES" ] || PACKAGES='yes'
+[ -n "$POST_SCRIPTS" ] || POST_SCRIPTS='yes'
[ -n "$PRE_SCRIPTS" ] || PRE_SCRIPTS='yes'
[ -n "$RECONFIGURE" ] || RECONFIGURE='console-data'
[ -n "$RELEASE" ] || RELEASE='jessie'
Options for Virtual Machine deployment:
- --vm Set up a Virtual Machine, instead of plainly installing
- to a partition or directory, to be combined with --target,
- like: --vm --target /dev/mapper/your-vm-disk
- --vmfile Like --vm, but install into a file (raw format).
+ --vm Set up a Virtual Machine on an existing block device
+ instead of plainly installing to a partition or
+ directory. Needs to be combined with --target.
+ Example: --vm --target /dev/mapper/your-vm-disk
+ --vmfile Like --vm, but install into a regular file (created by
+ 'qemu-img create -f raw ...') instead.
Example: --vmfile --target /mnt/sda1/qemu.img
--vmsize <size> Use specified size for size of VM file (default: 2G).
Syntax as supported by qemu-img, like: --vmsize 3G
[ "$_opt_packages_set" ] && PACKAGES='yes'
[ "$_opt_nopackages" ] && PACKAGES=''
[ "$_opt_debconf_set" ] && DEBCONF='yes'
-[ "$_opt_scripts_set" ] && SCRIPTS='yes'
+
+if [ "$_opt_scripts_set" ] ; then
+ ewarn "Deprecation NOTE: --scripts option is deprecated, please switch to --post-scripts instead."
+ SCRIPTS='yes' # deprecated since grml-debootstrap >=0.71
+fi
+
+[ "$_opt_post_scripts_set" ] && POST_SCRIPTS='yes'
[ "$_opt_pre_scripts_set" ] && PRE_SCRIPTS='yes'
[ "$_opt_chroot_scripts_set" ] && CHROOT_SCRIPTS='yes'
[ "$_opt_keep_src_list" ] && KEEP_SRC_LIST='yes'
LOOP_PART="$(echo "${DEVINFO##add map }" | sed 's/ .*//')" # 'loop1p1'
export TARGET="/dev/mapper/$LOOP_PART" # '/dev/mapper/loop1p1'
- blockdev --rereadpt "${LOOP}"
-
if [ -z "$TARGET" ] ; then
eerror "Error: target could not be set to according /dev/mapper/* device." ; eend 1
bailout 1
chroot "${MNTPOINT}" update-grub
case "$RELEASE" in
+ jessie)
+ einfo "Applying workaround for GRUB font path bug in jessie (Debian #787685)."
+ mkdir -p "${MNTPOINT}/boot/grub/fonts/"
+ cp "${MNTPOINT}/usr/share/grub/unicode.pf2" "${MNTPOINT}/boot/grub/fonts/"
+ ;;
+ esac
+
+ case "$RELEASE" in
lenny|squeeze|wheezy)
einfo "Adjusting grub.cfg for successful boot sequence."
sed -i "s;root=[^ ]\+;root=UUID=$TARGET_UUID;" "${MNTPOINT}"/boot/grub/grub.cfg
[ -n "$NOPASSWORD" ] && echo "NOPASSWORD=\"true\"" >> "$CHROOT_VARIABLES"
[ -n "$NOKERNEL" ] && echo "NOKERNEL=\"true\"" >> "$CHROOT_VARIABLES"
[ -n "$PACKAGES" ] && echo "PACKAGES='$(sed "s,','\\\\'',g" <<<"${PACKAGES}")'" >> "$CHROOT_VARIABLES"
+ [ -n "$POST_SCRIPTS" ] && echo "POST_SCRIPTS='$(sed "s,','\\\\'',g" <<<"${POST_SCRIPTS}")'" >> "$CHROOT_VARIABLES"
[ -n "$PRE_SCRIPTS" ] && echo "PRE_SCRIPTS='$(sed "s,','\\\\'',g" <<<"${PRE_SCRIPTS}")'" >> "$CHROOT_VARIABLES"
[ -n "$RECONFIGURE" ] && echo "RECONFIGURE='$(sed "s,','\\\\'',g" <<<"${RECONFIGURE}")'" >> "$CHROOT_VARIABLES"
[ -n "$RELEASE" ] && echo "RELEASE='$(sed "s,','\\\\'',g" <<<"${RELEASE}")'" >> "$CHROOT_VARIABLES"
fi
# package selection:
- cp $VERBOSE "${_opt_packages:-$CONFFILES/packages}" \
- "${MNTPOINT}"/etc/debootstrap/packages
+ if [ "$PACKAGES" = 'yes' ] ; then
+ cp $VERBOSE "${_opt_packages:-$CONFFILES/packages}" \
+ "${MNTPOINT}"/etc/debootstrap/packages
+ fi
# debconf preseeding:
_opt_debconf=${_opt_debconf:-$CONFFILES/debconf-selections}
}
# }}}
-# execute all scripts in /etc/debootstrap/scripts/ {{{
-execute_scripts() {
- # make sure we have $MNTPOINT available for our scripts
- export MNTPOINT
- if [ -d "$_opt_scripts" ] || [ "$SCRIPTS" = 'yes' ] ; then
- [ -d "$_opt_scripts" ] && scripts="$_opt_scripts" || scripts="$CONFFILES/scripts/"
- for script in ${scripts}/* ; do
- if [ -x "$script" ] ; then
- einfo "Executing script $script"
- $script ; eend $?
- fi
- done
- fi
+# execute all scripts in /etc/debootstrap/post-scripts/ {{{
+execute_post_scripts() {
+ # make sure we have $MNTPOINT available for our scripts
+ export MNTPOINT
+
+ if [ -d "$_opt_scripts" ] || [ "$SCRIPTS" = 'yes'] ; then
+ # legacy support for /etc/debootstrap/scripts/
+ [ -d "$_opt_scripts" ] && post_scripts="$_opt_scripts" || post_scripts="${CONFFILES}/scripts/"
+ ewarn "Deprecation NOTE: --scripts/SCRIPTS are deprecated, please switch to --post-scripts/POST_SCRIPTS instead."
+ elif [ -d "$_opt_post_scripts" ] || [ "$POST_SCRIPTS" = 'yes' ] ; then
+ [ -d "$_opt_post_scripts" ] && post_scripts="$_opt_post_scripts" || post_scripts="${CONFFILES}/post-scripts/"
+ fi
+
+ if [ -n "$post_scripts" ] ; then
+ for script in "${post_scripts}"/* ; do
+ if [ -x "$script" ] ; then
+ einfo "Executing post-script $script"
+ "$script" ; eend $?
+ fi
+ done
+ fi
}
# }}}
# now execute all the functions {{{
for i in prepare_vm mkfs tunefs mount_target debootstrap_system \
- preparechroot execute_pre_scripts chrootscript execute_scripts \
+ preparechroot execute_pre_scripts chrootscript execute_post_scripts \
umount_chroot finalize_vm fscktool ; do
if stage "${i}" ; then
if "$i" ; then