Updated grml-debootstrap parameter handling
[grml-debootstrap.git] / grml-debootstrap
index 53f1e20..7edc29b 100755 (executable)
@@ -11,7 +11,7 @@ set -e # exit on any error
 
 # variables {{{
 PN="$(basename $0)"
-VERSION='0.33-pre1'
+VERSION='0.33'
 MNTPOINT="/mnt/debootstrap.$$"
 
 # inside the chroot system locales might not be available, so use minimum:
@@ -57,15 +57,15 @@ Configuration options:
                              /etc/debootstrap/config
   -d, --confdir <path>     Place of config files for debootstrap, defaults
                              to /etc/debootstrap
-      --packages <file>    Install packages defined in specified list file.
-      --debconf <file>     Pre-seed packages using specified pre-seed db file.
+      --packages[=<file>]  Install packages defined in specified list file.
+      --debconf[=<file>]   Pre-seed packages using specified pre-seed db file.
       --keep_src_list      Do not overwrite user provided apt sources.list.
       --hostname <name>    Hostname of Debian system.
       --password <pwd>     Use specified password as password for user root.
       --bootappend <line>  Add specified appendline to kernel whilst booting.
       --chroot-scripts <d> Execute chroot scripts from specified directory.
-      --pre-scripts <dir>  Execute scripts from specified directory (before chroot-scripts).
-      --scripts <dir>      Execute scripts from specified directory (after chroot-scripts).
+      --pre-scripts[=<d>]  Execute scripts from specified directory (before chroot-scripts).
+      --scripts[=<dir>]    Execute scripts from specified directory (after chroot-scripts).
 
 Other options:
 
@@ -237,7 +237,7 @@ prompt_for_bootmanager()
         MBRDISK=$(readlink -f $MBRDISK)
      else
         # fall back to old behaviour
-        MBRDISK=$(echo ${TARGET} | sed -e 's/[0-9][0-9]*$/')
+        MBRDISK=$(echo ${TARGET} | sed -e 's/[0-9][0-9]*$//')
      fi
 
      MBRPART="MBR of $MBRDISK"
@@ -576,6 +576,10 @@ set_target_directory(){
     TUNE2FS=''
     FSCK=''
     GRUB=''
+    # make sure we normalise the path to an absolute directory name so something like:
+    #  mkdir -p foo/a bar/a; (cd foo; grml-debootstrap -t a)&; (cd bar; grml-debootstrap -t a)&; wait
+    # works
+    TARGET="$(readlink -f $TARGET)"
 }
 
 if [ -b "$TARGET" ] ; then