From a4ee665bdec580898a288b9cb7a8e03f3c035a37 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Sat, 27 Feb 2010 21:41:00 +0100 Subject: [PATCH] Add support for specifying filesystem + provide /etc/network/interfaces.examples --- cmdlineopts.clp | 5 ++++- debian/changelog | 10 ++++++++++ grml-debootstrap | 23 +++++++++++++++-------- grml-debootstrap.8.txt | 6 ++++++ 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/cmdlineopts.clp b/cmdlineopts.clp index 04f4be7..0681c6b 100644 --- a/cmdlineopts.clp +++ b/cmdlineopts.clp @@ -12,7 +12,7 @@ # should be handled in the main script, where it belongs. ################################################################################ -CMDLINE_OPTS=mirror:,iso:,release:,target:,mntpoint:,debopt:,interactive,nodebootstrap,nopackages,config:,confdir:,packages:,chroot-scripts:,scripts:,pre-scripts:,debconf:,keep_src_list,hostname:,password:,bootappend:,grub:,arch:,insecure,verbose,help,version +CMDLINE_OPTS=mirror:,iso:,release:,target:,mntpoint:,debopt:,interactive,nodebootstrap,nopackages,filesystem:,config:,confdir:,packages:,chroot-scripts:,scripts:,pre-scripts:,debconf:,keep_src_list,hostname:,password:,bootappend:,grub:,arch:,insecure,verbose,help,version _opt_temp=`getopt --name grml-debootstrap -o +m:i:r:t:p:c:d:vhV --long \ $CMDLINE_OPTS -- "$@"` @@ -44,6 +44,9 @@ while :; do --debopt) # Extra parameters passed to the debootstrap command shift; _opt_debopt="$1" ;; + --filesystem) # Filesystem that should be used + shift; _opt_filesystem="$1" + ;; --interactive) # Use interactive mode (frontend) _opt_interactive=T ;; diff --git a/debian/changelog b/debian/changelog index 046afd1..882fb37 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +grml-debootstrap (0.36) unstable; urgency=low + + * Add support for specifying filesystem that should be created + when installing to directories through --filesystem. + [Closes: issue596] + * Provide /etc/network/interfaces.examples file. + [Closes: issue495] + + -- Michael Prokop Sat, 27 Feb 2010 21:39:57 +0100 + grml-debootstrap (0.35) unstable; urgency=low * Do NOT execute 'umount -a' in chroot script for cleanup. This diff --git a/grml-debootstrap b/grml-debootstrap index 72ff57d..8c063cd 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -11,7 +11,7 @@ set -e # exit on any error # variables {{{ PN="$(basename $0)" -VERSION='0.35' +VERSION='0.36' MNTPOINT="/mnt/debootstrap.$$" # inside the chroot system locales might not be available, so use minimum: @@ -49,6 +49,7 @@ Bootstrap options: --nodebootstrap Skip debootstrap, only do configuration to the target. --grub Target for grub installation. Usage example: /dev/sda --arch Architecture to use. Currently only i386 is supported. + --filesystem Filesystem that should be used when target is a partition. --insecure Do not download and check Release file signatures. Configuration options: @@ -141,6 +142,7 @@ fi [ "$_opt_debopt" ] && DEBOOTSTRAP_OPT=$_opt_debopt [ "$_opt_interactive" ] && INTERACTIVE=1 [ "$_opt_config" ] && CONFIGFILE=$_opt_config +[ "$_opt_filesystem" ] && MKFS="mkfs.$_opt_filesystem" [ "$_opt_packages_set" ] && PACKAGES='yes' [ "$_opt_nopackages" ] && PACKAGES='' [ "$_opt_debconf_set" ] && DEBCONF='yes' @@ -409,7 +411,7 @@ ERRORFILE=$(mktemp) set +e # TODO: better error handling? yes | mdadm --create "${TARGET}" --level="${RAIDLEVEL}" \ - --raid-devices="${NUM_PARTITIONS}" ${SELECTED_PARTITIONS} 1>/dev/null 2>$ERRORFILE + --raid-devices="${NUM_PARTITIONS}" ${SELECTED_PARTITIONS} >/dev/null 2>$ERRORFILE RC=$? set -e @@ -639,18 +641,18 @@ bailout(){ # make sure nothing is left inside chroot so we can unmount it [ -x "$MNTPOINT"/etc/init.d/ssh ] && "$MNTPOINT"/etc/init.d/ssh stop [ -x "$MNTPOINT"/etc/init.d/mdadm ] && "$MNTPOINT"/etc/init.d/mdadm stop - # ugly, but make sure we really don't leav anything (/proc /proc is intended) + # ugly, but make sure we really don't leave anything (/proc /proc is intended) for ARG in /sys -a /proc /proc ; do - [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount $ARG 1>/dev/null 2>&1 || true + [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount $ARG >/dev/null 2>&1 || true done - umount "$MNTPOINT"/dev 1>/dev/null 2>&1 || true + umount "$MNTPOINT"/dev >/dev/null 2>&1 || true - [ -d "$MNTPOINT/$ISODIR" ] && umount "$MNTPOINT/$ISODIR" 1>/dev/null 2>&1 || true + [ -d "$MNTPOINT/$ISODIR" ] && umount "$MNTPOINT/$ISODIR" >/dev/null 2>&1 || true if [ -n "$DIRECTORY" ] ; then einfo "Not unmounting $MNTPOINT as you requested me to install into a directory of your own choice." ; eend 0 else - einfo "Unmounting $MNTPOINT" ; umount "$MNTPOINT" ; eend $? + einfo "Unmounting $MNTPOINT" ; umount "$MNTPOINT" ; eend $? fi if [ -n "$STAGES" ] ; then @@ -720,7 +722,7 @@ mkfs() { # modify filesystem settings {{{ tunefs() { - if [ -n "$TUNE2FS" ] ; then + if [ -n "$TUNE2FS" ] && echo "$MKFS" | grep -q "mkfs.ext" ; then einfo "Disabling automatic filesystem check on $TARGET via tune2fs" $TUNE2FS $TARGET eend $? @@ -864,6 +866,11 @@ preparechroot() { cp $VERBOSE /etc/network/interfaces $MNTPOINT/etc/network/interfaces fi + # install config file providing some example entries + if [ -r /etc/network/interfaces.examples -a ! -r "$MNTPOINT/etc/network/interfaces.examples" ] ; then + cp /etc/network/interfaces.examples "$MNTPOINT/etc/network/interfaces.examples" + fi + eend 0 } # }}} diff --git a/grml-debootstrap.8.txt b/grml-debootstrap.8.txt index bcc43dd..01337bb 100644 --- a/grml-debootstrap.8.txt +++ b/grml-debootstrap.8.txt @@ -65,6 +65,12 @@ Options and environment variables Extra parameters passed to the debootstrap command. +*--filesystem* <_filesystem_>:: + + Filesystem that should be created when installing to a partition. + If unset defaults to ext3. Valid values are all filesystems that + can be created through mkfs.. + *--grub* <_device_>:: Device where grub should be installed to. Note that only the MBR (master -- 2.1.4