2 # Filename: grml-debootstrap
3 # Purpose: wrapper around debootstrap for installing plain Debian via Grml
4 # Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2+
7 ################################################################################
8 # http://www.debian.org/releases/stable/i386/index.html.en
12 VERSION="$(dpkg --list $PN 2>/dev/null| awk '/^i/ {print $3}')"
13 VERSION="${VERSION:-unknown}"
14 MNTPOINT="/mnt/debootstrap.$$"
18 CONFFILES='/etc/debootstrap'
20 DEBIAN_FRONTEND='noninteractive'
21 DEBOOTSTRAP='debootstrap'
23 FALLBACK_MIRROR='http://http.debian.net/debian'
27 INSTALL_NOTES='/etc/debootstrap/install_notes'
29 MIRROR="$FALLBACK_MIRROR"
33 RECONFIGURE='console-data'
38 TIMEZONE='Europe/Vienna'
39 TUNE2FS='tune2fs -c0 -i0'
43 # inside the chroot system locales might not be available, so use minimum:
47 # make sure interactive mode is only executed when
48 # using an empty configuration file or option --interactive
54 echo "$PN - wrapper around debootstrap for installing Debian
60 -m, --mirror <URL> Mirror which should be used for apt-get/aptitude.
61 -i, --iso <mnt> Mountpoint where a Debian ISO is mounted to, for use
62 instead of fetching packages from a mirror.
63 -r, --release <name> Release of new Debian system (default: wheezy).
64 -t, --target <target> Target partition (/dev/...) or directory where the
65 system should be installed to.
66 -p, --mntpoint <mnt> Mountpoint used for mounting the target system,
67 has no effect if -t is given and represents a directory.
68 --debopt <params> Extra parameters passed to the debootstrap command.
69 --interactive Use interactive mode (frontend).
70 --nodebootstrap Skip debootstrap, only do configuration to the target.
71 --grub <device> Target for grub installation. Usage example: /dev/sda
72 --arch <arch> Set target architecture, use for installing i386 on amd64.
73 --filesystem <fs> Filesystem that should be used when target is a partition
74 or Virtual Machine (see --vmfile).
75 --force Do not prompt for user acknowledgement.
77 Options for Virtual Machine deployment:
79 --vmfile Set up a Virtual Machine instead of installing to
80 a partition or directory, to be combined with --target,
81 like: --vmfile --target /mnt/sda1/qemu.img
82 --vmsize <size> Use specified size for size of VM file (default: 2G).
83 Syntax as supported by qemu-img, like: --vmsize 3G
85 Configuration options:
87 -c, --config <file> Use specified configuration file, defaults to
88 /etc/debootstrap/config
89 -d, --confdir <path> Place of config files for debootstrap, defaults
91 --packages <file> Install packages defined in specified list file
92 instead of using /etc/debootstrap/packages.
93 --nopackages Skip installation of packages defined in
94 /etc/debootstrap/packages
95 --debconf <file> Pre-seed packages using specified pre-seed db file.
96 --grmlrepos Enable Grml's Debian repository (deb.grml.org).
97 --keep_src_list Do not overwrite user provided apt sources.list.
98 --hostname <name> Hostname of Debian system.
99 --nopassword Do not prompt for the root password.
100 --password <pwd> Use specified password as password for user root.
101 --bootappend <line> Add specified appendline to kernel whilst booting.
102 --chroot-scripts <d> Execute chroot scripts from specified directory.
103 --pre-scripts <dir> Execute scripts from specified directory (before chroot-scripts).
104 --scripts <dir> Execute scripts from specified directory (after chroot-scripts).
108 -v, --verbose Increase verbosity.
109 -h, --help Print this usage information and exit.
110 -V, --version Show summary of options and exit.
112 Usage examples can be found in the grml-debootstrap manpage.
113 Send bugreports to the grml-team: bugs (at) grml.org || http://grml.org/bugs/
117 if [ "$1" = '-h' ] || [ "$1" = '-help' ] || [ "$1" = "--help" ] ; then
119 echo 'Please notice that this script requires root permissions!'
124 # early helper functions {{{
138 [ "${RC_ENDCOL}" != "yes" ] && [ "${LAST_E_CMD}" = "ebegin" ] && echo
139 printf " ${GOOD}*${NORMAL} $*"
145 [ "${RC_ENDCOL}" != "yes" ] && [ "${LAST_E_CMD}" = "ebegin" ] && echo
146 printf " ${BAD}*${NORMAL} $*\n" >&2
152 local retval="${1:-0}"
154 if [ $retval -gt 0 ]; then
155 printf " ${BAD}-> Failed (rc=${retval})${NORMAL}\n"
161 if [ "$(id -u 2>/dev/null)" != 0 ] ; then
162 echo 1>&2 "Error: please run this script with uid 0 (root)." ; return 1
169 which $arg >/dev/null 2>&1 || RC="$arg"
171 if [ -n "$RC" ] ; then
172 echo "$RC not installed"
178 # helper functions {{{
180 if [ -n "$CHROOT_VARIABLES" ] ; then
181 einfo "Removing ${CHROOT_VARIABLES}" ; rm "$CHROOT_VARIABLES" ; eend $?
184 if [ -n "$STAGES" ] ; then
185 einfo "Removing ${STAGES}" ; rmdir "$STAGES" ; eend $?
188 # Remove temporary mountpoint again
189 if echo "$MNTPOINT" | grep -q '/mnt/debootstrap\.' ; then
190 rmdir "$MNTPOINT" 2>/dev/null
193 # make sure $TARGET is not mounted when exiting grml-debootstrap
194 if [ -n "$MNTPOINT" ] ; then
195 if grep -q "$MNTPOINT" /proc/mounts ; then
196 # make sure nothing is left inside chroot so we can unmount it
197 [ -x "$MNTPOINT"/etc/init.d/ssh ] && "$MNTPOINT"/etc/init.d/ssh stop
198 [ -x "$MNTPOINT"/etc/init.d/mdadm ] && "$MNTPOINT"/etc/init.d/mdadm stop
200 [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount -a >/dev/null 2>&1
202 # ugly, but make sure we really don't leave anything (/proc /proc and
203 # /dev /dev are intended, trying to work around timing issues, see #657023)
204 for ARG in /sys /proc /proc /dev /dev ; do
205 [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount $ARG >/dev/null 2>&1
206 umount "$MNTPOINT"/$ARG >/dev/null 2>&1
209 if [ -n "$ISODIR" ] ; then
210 [ -d "$MNTPOINT/$ISODIR" ] && umount "$MNTPOINT/$ISODIR" >/dev/null 2>&1
213 if [ -n "$DIRECTORY" ] ; then
214 einfo "Not unmounting $MNTPOINT as you requested me to install into a directory of your own choice." ; eend 0
216 einfo "Unmounting $MNTPOINT"
221 if [ -n "$STAGES" ] ; then
222 echo -n "Removing stages directory ${STAGES}: "
223 rm -rf "$STAGES" && echo done
226 # remove directory only if we used the default with process id inside the name
227 if echo "$MNTPOINT" | grep -q '/mnt/debootstrap\.' ; then
228 einfo "Removing directory ${MNTPOINT}"
235 if [ -n "${ORIG_TARGET}" ] ; then
236 einfo "Removing loopback mount of file ${ORIG_TARGET}."
237 kpartx -d "${ORIG_TARGET}" ; eend $?
241 # we want to exit smoothly and clean:
246 [ -n "$1" ] && EXIT="$1" || EXIT="1"
247 [ -n "$2" ] && einfo "Notice: remove $STAGES/$2 to reexecute the stage"
251 trap bailout HUP INT QUIT TERM
253 # we want to execute all the functions only once, simple check for it:
255 if [ -n "$2" ] ; then
256 echo "$2" > "${STAGES}/${1}"
258 elif grep -q done "${STAGES}/${1}" 2>/dev/null ; then
259 ewarn "Notice: stage $1 has been executed already, skipping execution therefore." ; eend 0
260 ewarn " To reexecute it clean up the according directory inside $STAGES" ; eend 0
266 # make sure we have what we need {{{
267 check4progs debootstrap || bailout 1
270 # source main configuration file {{{
271 if [ -r /etc/debootstrap/config ] ; then
272 . /etc/debootstrap/config
276 # cmdline handling {{{
277 # source external command line parameter-processing script
278 if [ -r ./cmdlineopts.clp ] ; then
280 elif [ -r /usr/share/grml-debootstrap/functions/cmdlineopts.clp ] ; then
281 . /usr/share/grml-debootstrap/functions/cmdlineopts.clp
283 eerror "Error: cmdline function file not found, exiting."
288 # == business-logic of command line parameter-processing
290 # source configuration file in <confdir> if supplied. {{{
291 [ "$_opt_confdir" ] && {
292 CONFFILES=$_opt_confdir
293 einfo "Using config files under $CONFFILES/."
294 if ! [ -r "$CONFFILES/config" ] ; then
295 eerror "Error: config file $CONFFILES/config not found."; eend 1; bailout 1
297 if ! . "$CONFFILES/config" ; then
298 eerror "Error reading config file $CONFFILES/config" ; eend 1 ; bailout 1
300 # restore the command line parameter value
301 CONFFILES=$_opt_confdir
305 [ "$_opt_mirror" ] && MIRROR=$_opt_mirror
306 [ "$_opt_iso" ] && ISO=$_opt_iso
307 [ "$_opt_release" ] && RELEASE=$_opt_release
308 [ "$_opt_target" ] && TARGET=$_opt_target
309 [ "$_opt_vmfile" ] && VIRTUAL=1
310 [ "$_opt_vmsize" ] && VMSIZE=$_opt_vmsize
311 [ "$_opt_mntpoint" ] && MNTPOINT=$_opt_mntpoint
312 [ "$_opt_debopt" ] && DEBOOTSTRAP_OPT=$_opt_debopt
313 [ "$_opt_interactive" ] && INTERACTIVE=1
314 [ "$_opt_config" ] && CONFIGFILE=$_opt_config
315 [ "$_opt_filesystem" ] && MKFS="mkfs.$_opt_filesystem"
316 [ "$_opt_packages_set" ] && PACKAGES='yes'
317 [ "$_opt_nopackages" ] && PACKAGES=''
318 [ "$_opt_debconf_set" ] && DEBCONF='yes'
319 [ "$_opt_scripts_set" ] && SCRIPTS='yes'
320 [ "$_opt_pre_scripts_set" ] && PRE_SCRIPTS='yes'
321 [ "$_opt_chroot_scripts_set" ] && CHROOT_SCRIPTS='yes'
322 [ "$_opt_keep_src_list" ] && KEEP_SRC_LIST='yes'
323 [ "$_opt_grmlrepos" ] && GRMLREPOS='yes'
324 [ "$_opt_hostname" ] && HOSTNAME=$_opt_hostname
325 [ "$_opt_password" ] && ROOTPASSWORD=$_opt_password
326 [ "$_opt_nopassword" ] && NOPASSWORD='yes'
327 [ "$_opt_bootappend" ] && BOOT_APPEND=$_opt_bootappend
328 [ "$_opt_grub" ] && GRUB=$_opt_grub
329 [ "$_opt_arch" ] && ARCH=$_opt_arch
330 [ "$_opt_insecure" ] && echo "Warning: --insecure is deprecated, continuing anyway."
331 [ "$_opt_force" ] && FORCE=$_opt_force
332 [ "$_opt_verbose" ] && VERBOSE="-v"
334 [ "$_opt_help" ] && {
340 [ "$_opt_version" ] && {
341 einfo "$PN - version $VERSION"
342 einfo "Send bug reports to bugs@grml.org or http://grml.org/bugs/"
348 # check for root permissions {{{
349 if ! check4root ; then
350 echo "For usage instructions please execute '$PN --help'."
355 # make sure we have what we need {{{
356 if [ -n "$VIRTUAL" ] ; then
357 check4progs kpartx mksh parted qemu-img || bailout 1
361 # source specified configuration file {{{
362 if [ -n "$CONFIGFILE" ] ; then
363 einfo "Reading specified config file $CONFIGFILE."
364 if ! . "$CONFIGFILE" ; then
365 eerror "Error reading config file $CONFIGFILE" ; eend 1 ; bailout 1
370 # backwards compability checks {{{
371 if [ -n "$GROOT" ] ; then
372 eerror "Error: you seem to have \$GROOT configured."
373 eerror "This variable is no longer supported, please visit the"
374 eerror "grml-debootstrap documentation for details."
379 if echo "$GRUB" | grep -q '^hd' ; then
380 eerror "Error: this syntax for the grub configuration variable is no longer supported."
381 eerror "Please do not use hd... any longer but /dev/sdX instead."
390 dialog --title "$PN" --yesno "Welcome to the interactive configuration of ${PN}.
391 Do you want to continue installing Debian using this frontend?" 0 0 || bailout 0
398 AVAILABLE_PARTITIONS=$(LANG=C fdisk -l 2>/dev/null | \
400 grep -v 'Extended$' | \
401 gawk -v num=0 -v ORS=' ' '/^\/dev\// {print $1}'; ls /dev/md* 2>/dev/null || true);
403 if [ -z "$AVAILABLE_PARTITIONS" ] ; then
404 dialog --title "$PN" --trim \
405 --msgbox "Sorry, no partitions found. Please configure your
406 harddisks (see /proc/partitions) using a tool like fdisk,
407 cfdisk, gpart, gparted,..." 0 0
411 PARTITION_LIST=$(for i in $(echo $AVAILABLE_PARTITIONS) ; do
412 echo "$i $(blkid -s TYPE -o value $i 2>/dev/null || echo [no_filesystem_yet])"
415 TARGET=$(dialog --title "$PN" --single-quoted --stdout \
416 --menu "Please select the target partition:" 0 0 0 \
418 [ $? -eq 0 ] || bailout 1
422 # ask for bootmanager {{{
423 prompt_for_bootmanager()
427 if echo "$TARGET" | grep -q "/dev/md" ; then
428 MBRPART="all disks of Software RAID $TARGET"
430 # figure out whole disk device
432 for device in /dev/disk/by-id/*
434 [ $(readlink -f $device) = ${TARGET} ] || continue
438 [ -n "$found" ] && MBRDISK=$(echo ${device}|sed -e 's/-part[0-9][0-9]*$//')
439 if [ -e "$MBRDISK" ]; then
440 MBRDISK=$(readlink -f $MBRDISK)
442 # fall back to old behaviour
443 MBRDISK=$(echo ${TARGET} | sed -e 's/[0-9][0-9]*$//')
446 MBRPART="MBR of $MBRDISK"
449 for device in cciss/c0d0 sda hda; do
450 if [ /dev/$device != ${MBRDISK} ]; then
451 grep -q $device /proc/partitions && \
452 ADDITIONAL_PARAMS="$ADDITIONAL_PARAMS:$device:install bootmanager grub into MBR of /dev/$device"
455 ADDITIONAL_PARAMS=${ADDITIONAL_PARAMS#:}
459 GETMBR=$(dialog --stdout --title "$PN" --default-item mbr \
460 --menu "Where do you want to install the bootmanager grub?" 0 0 0 \
461 mbr "install bootmanager into $MBRPART" \
462 nowhere "do not install bootmanager at all" \
463 ${ADDITIONAL_PARAMS})
464 [ $? -eq 0 ] || bailout 3
469 # /dev/md0: has to be installed in MBR of /dev/md0 and not in /dev/md:
470 if echo "$TARGET" | grep -q "/dev/md" ; then
472 if [ -n "$SELECTED_PARTITIONS" ] ; then
473 GRUB=$(echo ${SELECTED_PARTITIONS} | awk '{print $1}') # use first disk only
494 # ask for Debian release {{{
497 [ -n "$RELEASE" ] && DEFAULT_RELEASE="$RELEASE" || DEFAULT_RELEASE='wheezy'
498 RELEASE="$(dialog --stdout --title "${PN}" --default-item $DEFAULT_RELEASE --menu \
499 "Please enter the Debian release you would like to use for installation:" \
504 sid Debian/unstable)"
505 [ $? -eq 0 ] || bailout
509 # ask for hostname {{{
510 prompt_for_hostname()
512 HOSTNAME="$(dialog --stdout --title "${PN}" --inputbox \
513 "Please enter the hostname you would like to use for installation:" \
515 [ $? -eq 0 ] || bailout
519 # ask for password {{{
520 prompt_for_password()
522 if [ "$_opt_nopassword" ] ; then
523 einfo "Skip asking for root password as requested."
529 while [ "$ROOTPW1" != "$ROOTPW2" ]; do
530 ROOTPW1=$(dialog --insecure --stdout --title "${PN}" --passwordbox \
531 "Please enter the password for the root account:" 10 60)
532 [ $? -eq 0 ] || bailout
533 ROOTPW2=$(dialog --insecure --stdout --title "${PN}" --passwordbox \
534 "Please enter the password for the root account again for \
535 confirmation:" 10 60)
536 [ $? -eq 0 ] || bailout
538 if [ "$ROOTPW1" != "$ROOTPW2" ]; then
539 $(dialog --stdout --title "${PN}" --ok-label \
540 "Retry" --msgbox "Passwords do not match!" 10 60)
543 ROOTPASSWORD="$ROOTPW1"
547 # ask for Debian mirror {{{
550 [ -n "$ISO" ] && DEFAULT_MIRROR='local' || DEFAULT_MIRROR='net'
552 CHOOSE_MIRROR=$(dialog --stdout --title "$PN" --default-item $DEFAULT_MIRROR \
553 --menu "Where do you want to install from?" 0 0 0 \
554 net "install via network (downloading from mirror)" \
555 local "install from local directory/mirror"
557 [ $? -eq 0 ] || bailout
559 if [ "$CHOOSE_MIRROR" = 'net' ] ; then
560 [ -n "$MIRROR" ] || MIRROR='http://http.debian.net/debian'
561 MIRROR="$(dialog --stdout --title "${PN}" --inputbox \
562 "Please enter Debian mirror you would like to use for installing packages." \
564 [ $? -eq 0 ] || bailout
565 else # CHOOSE_MIRROR == local
566 [ -n "$ISO" ] || ISO='/mnt/mirror'
567 ISO="$(dialog --stdout --title "${PN}" --inputbox \
568 "Please enter directory name you would like to use for installing packages." \
570 [ $? -eq 0 ] || bailout
575 # software raid setup {{{
576 config_swraid_setup()
580 # Currently we support only raid1:
583 #RAIDLEVEL=$(dialog --stdout --title "$PN" --default-item raid1 \
584 # --menu "Which RAID level do you want to use?" 0 0 0 \
585 # raid1 "Software RAID level 1" \
586 # raid5 "Software RAID level 5")
587 #[ $? -eq 0 ] || bailout 20
589 MD_LIST=$(for i in $(seq 0 9) ; do
590 awk '{print $4}' /proc/partitions | grep -q md$i || \
591 echo "/dev/md$i /dev/md$i"
594 TARGET=$(dialog --stdout --title "$PN" --default-item /dev/md0 \
595 --menu "Which device do you want to use for ${RAIDLEVEL}?
597 Notice: activated devices will not be listed for security reasons. Anyway, please make sure the selected device is not in use already!" 0 0 0 \
599 [ $? -eq 0 ] || bailout 20
601 AVAILABLE_PARTITIONS=$(LANG=C fdisk -l 2>/dev/null | \
603 grep -v 'Extended$' | \
604 gawk -v num=0 -v ORS=' ' '/^\/dev\// {print $1}')
605 [ -n "$AVAILABLE_PARTITIONS" ] || echo "FIXME: no partitions available?"
606 PARTITION_LIST=$(for i in $(echo $AVAILABLE_PARTITIONS) ; do
607 echo "$i $(blkid -s TYPE -o value $i 2>/dev/null || echo [no_filesystem_yet]) off"
610 dialog --title "$PN" --separate-output \
611 --checklist "Please select the partitions you would like to use for your $RAIDLEVEL on ${TARGET}:" 0 0 0 \
612 $PARTITION_LIST 2>$TMPFILE
613 [ $? -eq 0 ] || bailout
615 SELECTED_PARTITIONS="$(cat $TMPFILE)"
618 for i in $(cat $TMPFILE) ; do
619 NUM_PARTITIONS=$((${NUM_PARTITIONS}+1))
622 # force metadata version 0.90 for lenny so old grub can boot from this array.
624 if [ $RELEASE = "lenny" ]; then
625 METADATA_VERSION="-e0"
629 yes | mdadm --create "${TARGET}" --level="${RAIDLEVEL}" \
630 --raid-devices="${NUM_PARTITIONS}" ${METADATA_VERSION} ${SELECTED_PARTITIONS} >/dev/null 2>$ERRORFILE
632 if [ "$RC" = 0 ] ; then
633 dialog --title "$PN" --msgbox \
634 "Creating $TARGET was successful." 0 0
635 rm -f "$TMPFILE" "$ERRORFILE"
637 dialog --title "$PN" --msgbox \
638 "There was an error setting up $TARGET:
643 rm -f "$TMPFILE" "$ERRORFILE"
651 if dialog --stdout --title "$PN" \
652 --defaultno --yesno "Do you want to configure Software RAID?
654 Please notice that only RAID level 1 is supported by ${PN} currently. Configuration will take place using mdadm." 0 0 ; then
660 # user should recheck his configuration {{{
661 # support full automatic installation:
663 dialog --timeout 10 --title "$PN" \
664 --yesno "Do you want to stop at this stage?
666 Notice: you are running ${PN} in non-interactive mode.
667 ${PN} will install Debian ${RELEASE} on ${TARGET}.
668 Last chance to quit. Timeout of 10 seconds running....
670 Do you want to stop now?" 0 0 2>/dev/null
674 # make sure the user is aware of the used configuration {{{
677 if [ -n "$AUTOINSTALL" ] ; then
678 if checkforrun ; then
679 eerror "Exiting as requested" ; eend 0
682 elif [ -n "$INTERACTIVE" ] ; then
684 INFOTEXT="Please recheck configuration before execution:
686 [ -n "$TARGET" ] && INFOTEXT="$INFOTEXT
688 [ -n "$GRUB" ] && INFOTEXT="$INFOTEXT
690 [ -n "$RELEASE" ] && INFOTEXT="$INFOTEXT
691 Using release: $RELEASE"
692 [ -n "$HOSTNAME" ] && INFOTEXT="$INFOTEXT
693 Using hostname: $HOSTNAME"
694 [ -n "$MIRROR" ] && INFOTEXT="$INFOTEXT
695 Using mirror: $MIRROR"
696 [ -n "$ISO" ] && INFOTEXT="$INFOTEXT
698 [ -n "$ARCH" ] && INFOTEXT="$INFOTEXT
703 Is this ok for you? Notice: selecting 'No' will exit ${PN}."
705 dialog --title "$PN" --no-collapse \
706 --yesno "$INFOTEXT" 0 0
707 [ $? -eq 0 ] || bailout 0
709 else # if not running automatic installation display configuration and prompt for execution:
710 einfo "$PN [${VERSION}] - Please recheck configuration before execution:"
712 echo " Target: $TARGET"
714 # do not display if MNTPOINT is the default one
715 case "$MNTPOINT" in /mnt/debootstrap*) ;; *) echo " Mount point: $MNTPOINT" ;; esac
717 if [ -n "$VIRTUAL" ] ; then
718 echo " Install grub: yes"
720 [ -n "$GRUB" ] && echo " Install grub: $GRUB" || echo " Install grub: no"
723 [ -n "$RELEASE" ] && echo " Using release: $RELEASE"
724 [ -n "$HOSTNAME" ] && echo " Using hostname: $HOSTNAME"
725 [ -n "$MIRROR" ] && echo " Using mirror: $MIRROR"
726 [ -n "$ISO" ] && echo " Using ISO: $ISO"
727 [ -n "$ARCH" ] && echo " Using arch: $ARCH"
728 if [ -n "$VIRTUAL" ] ; then
729 echo " Deploying as Virtual Machine."
730 [ -n "$VMSIZE" ] && echo " Using Virtual Disk file with size of ${VMSIZE}."
733 if [ ! -t 0 -a -z "$ROOTPASSWORD" -a -z "$NOPASSWORD" ] ; then
735 echo " You do not have a TTY allocated, your password will be shown in"
736 echo " plaintext on the terminal! If you are using SSH, try its -t option!"
740 echo " Important! Continuing will delete all data from ${TARGET}!"
742 if [ -n "$FORCE" ] ; then
743 einfo "Skip user acknowledgement as requested via --force option."
746 einfon "Is this ok for you? [y/N] "
748 if ! [ "$a" = 'y' -o "$a" = 'Y' ] ; then
749 eerror "Exiting as requested." ; eend 1
757 # interactive mode {{{
760 check4progs dialog || bailout 1
770 prompt_for_bootmanager
779 # run interactive mode if we didn't get the according configuration yet
780 if [ -z "$TARGET" -o -n "$INTERACTIVE" ] ; then
781 # only target might be unset, so make sure the INTERACTIVE flag is set as well
787 # architecture setup {{{
788 if [ -n "$ARCH" ] ; then
789 ARCHCMD="--arch $ARCH"
790 ARCHINFO=" (${ARCH})"
792 ARCH="$(dpkg --print-architecture)"
793 ARCHCMD="--arch $ARCH"
794 ARCHINFO=" (${ARCH})"
800 # finally make sure at least $TARGET is set [the partition for the new system] {{{
801 if [ -n "$TARGET" ] ; then
802 SHORT_TARGET="${TARGET##*/}"
804 eerror "Please adjust $CONFFILES/config or..."
805 eerror "... use the interactive version for configuration before running ${0}" ; eend 1
811 if [ -z "$STAGES" ] ; then
812 STAGES="/var/cache/grml-debootstrap/stages_${SHORT_TARGET}"
813 [ -d "$STAGES" ] || mkdir -p "$STAGES"
816 if [ -r "$STAGES"/grml-debootstrap ] ; then
817 if grep -q done $STAGES/grml-debootstrap ; then
818 eerror "Error: grml-debootstrap has been executed already, won't continue therefore."
819 eerror "If you want to re-execute grml-debootstrap just manually remove ${STAGES}" ; eend 1
824 # partition handling {{{
828 set_target_directory(){
829 # assume we are installing into a directory, don't run mkfs and grub related stuff therefore
836 # make sure we normalise the path to an absolute directory name so something like:
837 # mkdir -p foo/a bar/a; (cd foo; grml-debootstrap -t a)&; (cd bar; grml-debootstrap -t a)&; wait
839 TARGET="$(readlink -f $TARGET)"
842 if [ -b "$TARGET" ] || [ -n "$VIRTUAL" ] ; then
849 # make sure we have the right syntax when using an iso image {{{
850 if [ -n "$ISO" ] ; then
863 # Debian ISOs do not contain signed Release files {{{
864 if [ -n "$ISO" ] ; then
865 DEBOOTSTRAP_OPT="$DEBOOTSTRAP_OPT --no-check-gpg"
869 # create filesystem {{{
871 if [ -n "$DIRECTORY" ] ; then
872 einfo "Running grml-debootstrap on a directory, skipping mkfs stage."
874 if grep -q "$TARGET" /proc/mounts ; then
875 eerror "$TARGET already mounted, exiting to avoid possible damage. (Manually unmount $TARGET)" ; eend 1
879 if [ -n "$MKFS" ] ; then
880 einfo "Running $MKFS on $TARGET"
881 $MKFS $TARGET ; RC=$?
883 # make sure /dev/disk/by-uuid/... is up2date, otherwise grub
884 # will fail to detect the uuid in the chroot
885 if echo "$TARGET" | grep -q "/dev/md" ; then
886 blockdev --rereadpt "${TARGET}"
887 elif ! [ -n "$VIRTUAL" ] ; then
888 blockdev --rereadpt "${TARGET%%[0-9]*}"
890 # give the system 2 seconds, otherwise we might run into
891 # race conditions :-/
894 eval $(blkid -o udev $TARGET 2>/dev/null)
895 [ -n "$ID_FS_UUID" ] && TARGET_UUID="$ID_FS_UUID" || TARGET_UUID=""
904 # modify filesystem settings {{{
906 if [ -n "$TUNE2FS" ] && echo "$MKFS" | grep -q "mkfs.ext" ; then
907 einfo "Disabling automatic filesystem check on $TARGET via tune2fs"
914 # mount the new partition or if it's a directory do nothing at all {{{
916 if [ -n "$DIRECTORY" ] ; then
917 einfo "Running grml-debootstrap on a directory, nothing to mount."
919 if grep -q $TARGET /proc/mounts ; then
920 ewarn "$TARGET already mounted, continuing anyway." ; eend 0
922 if ! [ -d "${MNTPOINT}" ] ; then
923 [ -n "$VIRTUAL" ] || mkdir -p "${MNTPOINT}"
925 einfo "Mounting $TARGET to $MNTPOINT"
927 mount -o rw,suid,dev $TARGET $MNTPOINT
931 if [ -n "$ISODIR" ] ; then
932 einfo "Mounting Debian image loopback to $MNTPOINT/$ISODIR."
933 mkdir -p "$MNTPOINT/$ISODIR"
934 mount --bind "$ISODIR" "$MNTPOINT/$ISODIR"
940 # prepare VM image for usage with debootstrap {{{
942 if [ -z "$VIRTUAL" ] ; then
943 return 0 # be quite by intention
946 if [ -b "$TARGET" ] ; then
947 eerror "Error: specified virtual disk target ($TARGET) is an existing block device."
952 ORIG_TARGET="$TARGET" # store for later reuse
954 qemu-img create -f raw "${TARGET}" "${VMSIZE}"
955 echo 4 66 | /usr/share/grml-debootstrap/bootgrub.mksh -A | dd of="$TARGET" conv=notrunc
956 dd if=/dev/zero bs=1 conv=notrunc count=64 seek=446 of="$TARGET"
957 parted -s "${TARGET}" 'mkpart primary ext3 2M -1'
959 # if dm-mod isn't available then kpartx will fail with
960 # "Is device-mapper driver missing from kernel? [...]"
961 if ! kpartx -av $TARGET >/dev/null 2>&1 || ! grep -q device-mapper /proc/misc >/dev/null 2>&1 ; then
962 einfo "Device-mapper not ready yet, trying to load dm-mod module."
963 modprobe dm-mod ; eend $?
966 # make sure loop module is present
967 if ! losetup -f >/dev/null 2>&1; then
968 einfo "Can not find a usable loop device, retrying after loading loop module."
970 if losetup -f >/dev/null 2>&1; then
971 einfo "Found a usable loop device now, continuing."
973 eerror "Error finding usable loop device" ; eend 1
978 DEVINFO=$(kpartx -av $TARGET) # 'add map loop1p1 (253:0): 0 6289408 linear /dev/loop1 2048'
979 if [ -z "${DEVINFO}" ] ; then
980 eerror "Error setting up loopback device." ; eend 1
984 # hopefully this always works as expected
985 LOOP=$(echo ${DEVINFO} | sed 's/.* linear //; s/ [[:digit:]]*//') # '/dev/loop1'
986 BLOCKDEV=$(echo "${DEVINFO}" | sed -e 's/.* (\(.*:.*\)).*/\1/') # '253:0'
987 LOOP_PART="$(echo ${DEVINFO##add map } | sed 's/ .*//')" # '/dev/loop1p1'
988 export TARGET="/dev/mapper/$LOOP_PART" # '/dev/mapper/loop1p1'
990 blockdev --rereadpt "${LOOP}"
992 if [ -z "$TARGET" ] ; then
993 eerror "Error: target could not be set to according /dev/mapper/* device." ; eend 1
999 # make VM image bootable and unmount it {{{
1001 if [ -z "${VIRTUAL}" ] ; then
1005 if ! mount "${TARGET}" "${MNTPOINT}" ; then
1006 eerror "Error: Mounting ${TARGET} failed, can not continue." ; eend 1
1010 einfo "Installing Grub as bootloader."
1011 mount -t proc none "${MNTPOINT}"/proc
1012 mount -t sysfs none "${MNTPOINT}"/sys
1013 mount --bind /dev "${MNTPOINT}"/dev
1015 mkdir -p "${MNTPOINT}/boot/grub"
1016 if ! [ -d "${MNTPOINT}"/usr/lib/grub/i386-pc/ ] ; then
1017 eerror "Error: grub not installed inside Virtual Machine. Can not install bootloader." ; eend 1
1021 cp "${MNTPOINT}"/usr/lib/grub/i386-pc/* "${MNTPOINT}/boot/grub/"
1022 chroot "${MNTPOINT}" grub-mkimage -O i386-pc -p "(hd0,msdos1)/boot/grub" -o /tmp/core.img biosdisk part_msdos ext2
1023 dd if="${MNTPOINT}/tmp/core.img" of="${ORIG_TARGET}" conv=notrunc seek=4
1024 rm -f "${MNTPOINT}/tmp/core.img"
1026 einfo "Updating grub configuration file."
1027 if [ -n "$BOOT_APPEND" ] ; then
1028 sed -i "/GRUB_CMDLINE_LINUX_DEFAULT/ s#\"\$# ${BOOT_APPEND}\"#" "${MNTPOINT}"/etc/default/grub
1030 chroot "${MNTPOINT}" update-grub
1032 umount "${MNTPOINT}"/proc
1033 umount "${MNTPOINT}"/sys
1034 umount "${MNTPOINT}"/dev
1036 einfo "Adjusting grub.cfg for successful boot sequence."
1037 # ugly but needed to boot grub acordingly
1038 sed -i "s;set root=.*;set root='(hd0,msdos1)';" "${MNTPOINT}"/boot/grub/grub.cfg
1039 sed -i "s;root=[^ ]\+;root=/dev/sda1;" "${MNTPOINT}"/boot/grub/grub.cfg
1041 umount "${MNTPOINT}"
1042 kpartx -d "${ORIG_TARGET}" >/dev/null
1046 # install main chroot {{{
1047 debootstrap_system() {
1048 if [ "$_opt_nodebootstrap" ]; then
1049 einfo "Skipping debootstrap as requested."
1053 if grep -q "$MNTPOINT" /proc/mounts || [ -n "$DIRECTORY" ] ; then
1056 eerror "Error: $MNTPOINT not mounted, can not continue."
1060 if [ -n "$ISO" ] ; then
1061 einfo "Running $DEBOOTSTRAP $DEBOOTSTRAP_OPT for release ${RELEASE}${ARCHINFO} using ${ISO}"
1062 einfo "Executing: $DEBOOTSTRAP $ARCHCMD $KEYRING $DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $ISO"
1063 $DEBOOTSTRAP $ARCHCMD $KEYRING $DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $ISO
1066 einfo "Running $DEBOOTSTRAP $DEBOOTSTRAP_OPT for release ${RELEASE}${ARCHINFO} using ${MIRROR}"
1067 einfo "Executing: $DEBOOTSTRAP $ARCHCMD $KEYRING $DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $MIRROR"
1068 $DEBOOTSTRAP $ARCHCMD $KEYRING $DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $MIRROR
1072 if [ $RC -ne 0 ] ; then
1073 if [ -r "$MNTPOINT/debootstrap/debootstrap.log" ] && \
1074 [ -s "$MNTPOINT/debootstrap/debootstrap.log" ] ; then
1075 einfo "Presenting last ten lines of debootstrap.log:"
1076 tail -10 $MNTPOINT/debootstrap/debootstrap.log
1077 einfo "End of debootstrap.log"
1085 # prepare chroot via chroot-script {{{
1087 einfo "Preparing chroot system"
1089 # provide variables to chroot system
1090 CHROOT_VARIABLES="/var/cache/grml-debootstrap/variables_${SHORT_TARGET}"
1091 touch $CHROOT_VARIABLES
1092 chmod 600 $CHROOT_VARIABLES # make sure nobody except root can read it
1093 echo "# Configuration of ${PN}" > $CHROOT_VARIABLES
1094 [ -n "$ARCH" ] && echo "ARCH=\"$ARCH\"" >> $CHROOT_VARIABLES
1095 [ -n "$CHROOT_SCRIPTS" ] && echo "CHROOT_SCRIPTS=\"$CHROOT_SCRIPTS\"" >> $CHROOT_VARIABLES
1096 [ -n "$CONFFILES" ] && echo "CONFFILES=\"$CONFFILES\"" >> $CHROOT_VARIABLES
1097 [ -n "$DEBCONF" ] && echo "DEBCONF=\"$DEBCONF\"" >> $CHROOT_VARIABLES
1098 [ -n "$DEBIAN_FRONTEND" ] && echo "DEBIAN_FRONTEND=\"$DEBIAN_FRONTEND\"" >> $CHROOT_VARIABLES
1099 [ -n "$DEBOOTSTRAP" ] && echo "DEBOOTSTRAP=\"$DEBOOTSTRAP\"" >> $CHROOT_VARIABLES
1100 [ -n "$EXTRAPACKAGES" ] && echo "EXTRAPACKAGES=\"$EXTRAPACKAGES\"" >> $CHROOT_VARIABLES
1101 [ -n "$FALLBACK_MIRROR" ] && echo "FALLBACK_MIRROR=\"$FALLBACK_MIRROR\"" >> $CHROOT_VARIABLES
1102 [ -n "$FORCE" ] && echo "FORCE=\"$FORCE\"" >> $CHROOT_VARIABLES
1103 [ -n "$GRMLREPOS" ] && echo "GRMLREPOS=\"$GRMLREPOS\"" >> $CHROOT_VARIABLES
1104 [ -n "$GRUB" ] && echo "GRUB=\"$GRUB\"" >> $CHROOT_VARIABLES
1105 [ -n "$HOSTNAME" ] && echo "HOSTNAME=\"$HOSTNAME\"" >> $CHROOT_VARIABLES
1106 [ -n "$INITRD" ] && echo "INITRD=\"$INITRD\"" >> $CHROOT_VARIABLES
1107 [ -n "$INSTALL_NOTES" ] && echo "INSTALL_NOTES=\"$INSTALL_NOTES\"" >> $CHROOT_VARIABLES
1108 [ -n "$ISODIR" ] && echo "ISODIR=\"$ISO\"" >> $CHROOT_VARIABLES
1109 [ -n "$ISO" ] && echo "ISO=\"$ISO\"" >> $CHROOT_VARIABLES
1110 [ -n "$KEEP_SRC_LIST" ] && echo "KEEP_SRC_LIST=\"$KEEP_SRC_LIST\"" >> $CHROOT_VARIABLES
1111 [ -n "$LOCALES" ] && echo "LOCALES=\"$LOCALES\"" >> $CHROOT_VARIABLES
1112 [ -n "$MIRROR" ] && echo "MIRROR=\"$MIRROR\"" >> $CHROOT_VARIABLES
1113 [ -n "$MKFS" ] && echo "MKFS=\"$MKFS\"" >> $CHROOT_VARIABLES
1114 [ -n "$NOPASSWORD" ] && echo "NOPASSWORD=\"true\"" >> $CHROOT_VARIABLES
1115 [ -n "$PACKAGES" ] && echo "PACKAGES=\"$PACKAGES\"" >> $CHROOT_VARIABLES
1116 [ -n "$PRE_SCRIPTS" ] && echo "PRE_SCRIPTS=\"$PRE_SCRIPTS\"" >> $CHROOT_VARIABLES
1117 [ -n "$RECONFIGURE" ] && echo "RECONFIGURE=\"$RECONFIGURE\"" >> $CHROOT_VARIABLES
1118 [ -n "$RELEASE" ] && echo "RELEASE=\"$RELEASE\"" >> $CHROOT_VARIABLES
1119 [ -n "$RM_APTCACHE" ] && echo "RM_APTCACHE=\"$RM_APTCACHE\"" >> $CHROOT_VARIABLES
1120 [ -n "$ROOTPASSWORD" ] && echo "ROOTPASSWORD=\"$ROOTPASSWORD\"" >> $CHROOT_VARIABLES
1121 [ -n "$SCRIPTS" ] && echo "SCRIPTS=\"$SCRIPTS\"" >> $CHROOT_VARIABLES
1122 [ -n "$SECURE" ] && echo "SECURE=\"$SECURE\"" >> $CHROOT_VARIABLES
1123 [ -n "$SELECTED_PARTITIONS" ] && echo "SELECTED_PARTITIONS=\"$SELECTED_PARTITIONS\"" >> $CHROOT_VARIABLES
1124 [ -n "$TARGET" ] && echo "TARGET=\"$TARGET\"" >> $CHROOT_VARIABLES
1125 [ -n "$UPGRADE_SYSTEM" ] && echo "UPGRADE_SYSTEM=\"$UPGRADE_SYSTEM\"" >> $CHROOT_VARIABLES
1126 [ -n "$TARGET_UUID" ] && echo "TARGET_UUID=\"$TARGET_UUID\"" >> $CHROOT_VARIABLES
1127 [ -n "$TIMEZONE" ] && echo "TIMEZONE=\"$TIMEZONE\"" >> $CHROOT_VARIABLES
1128 [ -n "$TUNE2FS" ] && echo "TUNE2FS=\"$TUNE2FS\"" >> $CHROOT_VARIABLES
1129 [ -n "$VMSIZE" ] && echo "VMSIZE=\"$VMSIZE\"" >> $CHROOT_VARIABLES
1131 cp $VERBOSE $CONFFILES/chroot-script $MNTPOINT/bin/chroot-script
1132 chmod 755 $MNTPOINT/bin/chroot-script
1133 [ -d "$MNTPOINT"/etc/debootstrap/ ] || mkdir "$MNTPOINT"/etc/debootstrap/
1135 # make sure we have our files for later use via chroot-script
1136 cp $VERBOSE $CONFFILES/config $MNTPOINT/etc/debootstrap/
1137 # make sure we adjust the configuration variables accordingly:
1138 sed -i "s#RELEASE=.*#RELEASE=\"$RELEASE\"#" $MNTPOINT/etc/debootstrap/config
1139 sed -i "s#TARGET=.*#TARGET=\"$TARGET\"#" $MNTPOINT/etc/debootstrap/config
1140 sed -i "s#GRUB=.*#GRUB=\"$GRUB\"#" $MNTPOINT/etc/debootstrap/config
1143 if [ -n "$INSTALL_NOTES" ] ; then
1144 [ -r "$INSTALL_NOTES" ] && cp "$INSTALL_NOTES" $MNTPOINT/etc/debootstrap/
1147 # package selection:
1148 cp $VERBOSE ${_opt_packages:-$CONFFILES/packages} \
1149 $MNTPOINT/etc/debootstrap/packages
1151 # debconf preseeding:
1152 _opt_debconf=${_opt_debconf:-$CONFFILES/debconf-selections}
1153 [ -f $_opt_debconf -a "$DEBCONF" = 'yes' ] && \
1154 cp $VERBOSE $_opt_debconf $MNTPOINT/etc/debootstrap/debconf-selections
1156 # copy scripts that should be executed inside the chroot:
1157 _opt_chroot_scripts=${_opt_chroot_scripts:-$CONFFILES/chroot-scripts/}
1158 [ -d $_opt_chroot_scripts -a "$CHROOT_SCRIPTS" = 'yes' ] && {
1159 mkdir -p $MNTPOINT/etc/debootstrap/chroot-scripts
1160 cp -a $VERBOSE $_opt_chroot_scripts/* $MNTPOINT/etc/debootstrap/chroot-scripts/
1163 # notice: do NOT use $CHROOT_VARIABLES inside chroot but statically file instead!
1164 cp $VERBOSE $CHROOT_VARIABLES $MNTPOINT/etc/debootstrap/variables
1166 cp $VERBOSE -a -L $CONFFILES/extrapackages/ $MNTPOINT/etc/debootstrap/
1168 # make sure we can access network [relevant for cdebootstrap]
1169 [ -f "$MNTPOINT/etc/resolv.conf" ] || cp $VERBOSE /etc/resolv.conf $MNTPOINT/etc/resolv.conf
1171 # provide system's /etc/hosts to the target:
1172 if ! [ -f "$MNTPOINT/etc/hosts" ] ; then
1173 cp $VERBOSE /etc/hosts $MNTPOINT/etc/hosts
1176 # setup default locales
1177 [ -n "$LOCALES" ] && cp $VERBOSE $CONFFILES/locale.gen $MNTPOINT/etc/locale.gen
1179 # MAKEDEV is just a forking bomb crap, let's do it on our own instead :)
1180 ( cd $MNTPOINT/dev && tar zxf /etc/debootstrap/devices.tar.gz )
1182 # copy any existing files to chroot
1183 [ -d $CONFFILES/bin ] && cp $VERBOSE -a -L $CONFFILES/bin/* $MNTPOINT/bin/
1184 [ -d $CONFFILES/boot ] && cp $VERBOSE -a -L $CONFFILES/boot/* $MNTPOINT/boot/
1185 [ -d $CONFFILES/etc ] && cp $VERBOSE -a -L $CONFFILES/etc/* $MNTPOINT/etc/
1186 [ -d $CONFFILES/sbin ] && cp $VERBOSE -a -L $CONFFILES/sbin/* $MNTPOINT/sbin/
1187 [ -d $CONFFILES/share ] && cp $VERBOSE -a -L $CONFFILES/share/* $MNTPOINT/share/
1188 [ -d $CONFFILES/usr ] && cp $VERBOSE -a -L $CONFFILES/usr/* $MNTPOINT/usr/
1189 [ -d $CONFFILES/var ] && cp $VERBOSE -a -L $CONFFILES/var/* $MNTPOINT/var/
1191 # copy local network setup to chroot
1192 if [ -r /etc/network/interfaces -a ! -r "${MNTPOINT}"/etc/network/interfaces ] ; then
1193 [ -d $MNTPOINT/etc/network ] || mkdir $MNTPOINT/etc/network
1194 cp $VERBOSE /etc/network/interfaces $MNTPOINT/etc/network/interfaces
1197 # install config file providing some example entries
1198 if [ -r /etc/network/interfaces.examples -a ! -r "$MNTPOINT/etc/network/interfaces.examples" ] ; then
1199 cp /etc/network/interfaces.examples "$MNTPOINT/etc/network/interfaces.examples"
1206 # execute all scripts in /etc/debootstrap/pre-scripts/ {{{
1207 execute_pre_scripts() {
1208 # make sure we have $MNTPOINT available for our scripts
1210 if [ -d "$_opt_pre_scripts" ] || [ "$PRE_SCRIPTS" = 'yes' ] ; then
1211 [ -d "$_opt_pre_scripts" ] && pre_scripts="$_opt_pre_scripts" || pre_scripts="$CONFFILES/pre-scripts/"
1212 for script in ${pre_scripts}/* ; do
1213 if [ -x "$script" ] ; then
1214 einfo "Executing pre-script $script"
1222 # execute all scripts in /etc/debootstrap/scripts/ {{{
1224 # make sure we have $MNTPOINT available for our scripts
1226 if [ -d "$_opt_scripts" ] || [ "$SCRIPTS" = 'yes' ] ; then
1227 [ -d "$_opt_scripts" ] && scripts="$_opt_scripts" || scripts="$CONFFILES/scripts/"
1228 for script in ${scripts}/* ; do
1229 if [ -x "$script" ] ; then
1230 einfo "Executing script $script"
1238 # execute chroot-script {{{
1240 if ! [ -r "$MNTPOINT/bin/chroot-script" ] ; then
1244 if ! [ -x "$MNTPOINT/bin/chroot-script" ] ; then
1245 eerror "Fatal: $MNTPOINT/bin/chroot-script could not be found."
1248 einfo "Executing chroot-script now"
1249 mount --bind /dev "$MNTPOINT"/dev
1250 chroot "$MNTPOINT" /bin/chroot-script ; RC=$?
1251 umount "$MNTPOINT"/dev
1255 # finally get rid of chroot-script again, there's no good reason to
1256 # keep it on the installed system
1257 if grep -q GRML_CHROOT_SCRIPT_MARKER "${MNTPOINT}/bin/chroot-script" ; then
1258 einfo "Removing chroot-script again"
1259 rm -f "${MNTPOINT}/bin/chroot-script"
1262 einfo "Keeping chroot-script as string GRML_CHROOT_SCRIPT_MARKER could not be found"
1268 # unmount $MNTPOINT {{{
1271 # display installation notes:
1272 if [ -n "$INSTALL_NOTES" ] ; then
1273 [ -r "${MNTPOINT}/${INSTALL_NOTES}" ] && cat "${MNTPOINT}/${INSTALL_NOTES}"
1276 if [ -n "$ISODIR" ] ; then
1277 if grep -q "$ISODIR" /proc/mounts ; then
1278 einfo "Unmount $MNTPOINT/$ISODIR"
1279 umount "$MNTPOINT/$ISODIR"
1284 if grep -q "$MNTPOINT" /proc/mounts ; then
1285 if [ -n "$PARTITION" ] ; then
1286 einfo "Unmount $MNTPOINT"
1294 # execute filesystem check {{{
1296 if [ -n "$VIRTUAL" ] ; then
1297 einfo "Skipping filesystem check because we deploy a virtual machine."
1301 if [ "$FSCK" = 'yes' ] ; then
1302 [ -n "$FSCKTOOL" ] || FSCKTOOL="fsck.${MKFS#mkfs.}"
1303 einfo "Checking filesystem on $TARGET using $FSCKTOOL"
1310 # now execute all the functions {{{
1311 for i in prepare_vm mkfs tunefs mount_target debootstrap_system \
1312 preparechroot execute_pre_scripts chrootscript execute_scripts \
1313 umount_chroot finalize_vm fscktool ; do
1314 if stage "${i}" ; then
1315 $i && ( stage "${i}" done && rm -f "${STAGES}/${i}" ) || bailout 2 "$i"
1322 # end dialog of autoinstallation {{{
1323 if [ -n "$AUTOINSTALL" ] ; then
1324 if dialog --title "${PN}" --pause "Finished execution of ${PN}.
1325 Automatically rebooting in 10 seconds.
1327 Choose Cancel to skip rebooting." 10 60 10 ; then
1328 noeject noprompt reboot
1331 einfo "Finished execution of ${PN}. Enjoy your Debian system." ; eend 0
1335 ## END OF FILE #################################################################
1336 # vim: ai tw=100 expandtab foldmethod=marker shiftwidth=2