Merge commit 'remotes/origin/t/remove_apt_cache'
[grml-debootstrap.git] / grml-debootstrap
index 2544c85..681acc7 100755 (executable)
@@ -104,10 +104,10 @@ fi
 
 # cmdline handling {{{
 # source external command line parameter-processing script
-if [ -r /usr/share/grml-debootstrap/functions/cmdlineopts.clp ] ; then
-   . /usr/share/grml-debootstrap/functions/cmdlineopts.clp
-elif [ -r ./cmdlineopts.clp ] ; then
+if [ -r ./cmdlineopts.clp ] ; then
    . ./cmdlineopts.clp
+elif [ -r /usr/share/grml-debootstrap/functions/cmdlineopts.clp ] ; then
+   . /usr/share/grml-debootstrap/functions/cmdlineopts.clp
 else
    echo "Error: cmdline function file not found, exiting.">&2
    exit 1
@@ -574,15 +574,17 @@ 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)"
 }
 
-case $TARGET in
-  /dev/shm/*) set_target_directory ;;
-  /dev/*)
+if [ -b "$TARGET" ] ; then
     PARTITION=1
-    ;;
-  *) set_target_directory ;;
-esac
+else
+    set_target_directory
+fi
 # }}}
 
 # architecture setup {{{