This logic should bypass asking for a disk if no files are going to be copied from...
[backups/.git] / scripts / restore-header.sh
index ae67b1cb74ecf6e93a3fe7977442871b38a00937..b05d19c38314e2c73adf6fe6dd00749c0f9bc427 100755 (executable)
@@ -1,20 +1,23 @@
 #!/bin/sh
+
 export rundir=/tmp/restore-$(date +%Y%m%d%H%M%S)
+
 if ! mkdir $rundir; then
-  echo 2> "Cannot create temp dir"
+  echo >&2 "Cannot create temp dir"
   exit 1
 fi
-echo $rundir
 
 unset CDPATH
-export mountdir=$(cd $(dirname $0) && pwd)
-echo $mountdir
+if [ -z "$3" ]; then
+  export mountdir=$(cd $(dirname $0) && pwd -P)
+fi
 
 SKIP=`awk '/^__ARCHIVE_FOLLOWS__/ { print NR + 1; exit 0; }' $0`
 
 # take the archive portion of this file and pipe it to tar
 tail +$SKIP $0 | tar xzf - -C $rundir
 
-exec $rundir/restore-script.sh ${1+"$@"}
+cd $rundir
+exec ./restore-script.sh ${1+"$@"}
 
 __ARCHIVE_FOLLOWS__