X-Git-Url: http://git.pippins.net/embedvideo/.git/?a=blobdiff_plain;f=scripts%2Frestore-header.sh;fp=scripts%2Frestore-header.sh;h=ae67b1cb74ecf6e93a3fe7977442871b38a00937;hb=5c8c182b0f51eaa5fca5f917ed5cda5f12fb7366;hp=0000000000000000000000000000000000000000;hpb=9f95453a2b3a4ffde7c553b93a6cac6eec618958;p=backups%2F.git diff --git a/scripts/restore-header.sh b/scripts/restore-header.sh new file mode 100755 index 0000000..ae67b1c --- /dev/null +++ b/scripts/restore-header.sh @@ -0,0 +1,20 @@ +#!/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 +echo $rundir + +unset CDPATH +export mountdir=$(cd $(dirname $0) && pwd) +echo $mountdir + +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+"$@"} + +__ARCHIVE_FOLLOWS__