X-Git-Url: http://git.pippins.net/embedvideo/.git/static/gitweb.js?a=blobdiff_plain;f=scripts%2Frestore-header.sh;h=b05d19c38314e2c73adf6fe6dd00749c0f9bc427;hb=575a6caced28aeb051f876d1c3db1a8188164685;hp=a147c62e6a0b397dd704ecb533750342d05395a4;hpb=11b38584ce4c12e7a83c1cb206fa87141f74de5c;p=backups%2F.git diff --git a/scripts/restore-header.sh b/scripts/restore-header.sh index a147c62..b05d19c 100755 --- a/scripts/restore-header.sh +++ b/scripts/restore-header.sh @@ -1,18 +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" exit 1 fi unset CDPATH -export mountdir=$(cd $(dirname $0) && pwd) +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__