# should be handled in the main script, where it belongs.
################################################################################
-CMDLINE_OPTS=mirror:,iso:,release:,target:,mntpoint:,debopt:,defaultinterfaces,interactive,nodebootstrap,nointerfaces,nokernel,nopackages,filesystem:,config:,confdir:,packages:,chroot-scripts:,scripts:,pre-scripts:,debconf:,vm,vmfile,vmsize:,keep_src_list,hostname:,password:,nopassword,grmlrepos,backportrepos,bootappend:,grub:,arch:,insecure,verbose,help,version,force,debug,contrib,non-free
+CMDLINE_OPTS=mirror:,iso:,release:,target:,mntpoint:,debopt:,defaultinterfaces,interactive,nodebootstrap,nointerfaces,nokernel,nopackages,filesystem:,config:,confdir:,packages:,chroot-scripts:,scripts:,post-scripts:,pre-scripts:,debconf:,vm,vmfile,vmsize:,keep_src_list,hostname:,password:,nopassword,grmlrepos,backportrepos,bootappend:,grub:,arch:,insecure,verbose,help,version,force,debug,contrib,non-free
_opt_temp=`getopt --name grml-debootstrap -o +m:i:r:t:p:c:d:vhV --long \
$CMDLINE_OPTS -- "$@"`
shift; _opt_pre_scripts="$1"
_opt_pre_scripts_set=T
;;
- --scripts) # Execute scripts from specified directory
+ --scripts) # Execute scripts from specified directory [NOTE: deprecated, replaced via --post-scripts]
shift; _opt_scripts="$1"
_opt_scripts_set=T
;;
+ --post-scripts) # Execute scripts from specified directory
+ shift; _opt_post_scripts="$1"
+ _opt_post_scripts_set=T
+ ;;
--chroot-scripts) # Execute chroot scripts from specified directory
shift; _opt_chroot_scripts="$1"
_opt_chroot_scripts_set=T
# Default: 'yes'
# CHROOT_SCRIPTS='no'
-# Run scripts from /etc/debootstrap/scripts/ after setting up chroot.
+# Run scripts from /etc/debootstrap/post-scripts/ after setting up chroot.
# Default: 'yes'
-# SCRIPTS='no'
+# POST_SCRIPTS='no'
# Install *.deb packages from /etc/debootstrap/extrapackages/
# Default: 'yes'
[ -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'
[ "$_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'
[ -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"
}
# }}}
-# 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
command line might be visible in the process list and the shell history.
It's meant for automatic installation only.
-*-r*, *--release* _releasename_::
+*--post-scripts* _directory_::
- Specify release of new Debian system. Supported releases names: lenny,
- squeeze, wheezy, jessie, stretch (note: requires a recent version of debootstrap)
- and sid. Corresponding with configuration variable RELEASE.
+ Execute scripts from specified directory after executing the chroot script.
+ This allows customisation of the system after the chroot has been set up.
+ The environment variable $MNTPOINT is available inside the scripts for
+ direct access of the chroot.
+ Default directory: /etc/debootstrap/post-scripts/
*--pre-scripts* _directory_::
scripts for direct access of the chroot.
Default directory: /etc/debootstrap/pre-scripts/
-*--scripts* _directory_::
+*-r*, *--release* _releasename_::
- Execute scripts from specified directory. This allows customisation of
- the system after the chroot has been set up. The environment variable
- $MNTPOINT is available inside the scripts for direct access of the chroot.
- Default directory: /etc/debootstrap/scripts/
+ Specify release of new Debian system. Supported releases names: lenny,
+ squeeze, wheezy, jessie, stretch (note: requires a recent version of debootstrap)
+ and sid. Corresponding with configuration variable RELEASE.
*-t*, *--target* _target_::