8374076c69134d8cf085f70f14ea56af919b1b05
[backups/.git] / scripts / restore-header.sh
1 #!/bin/sh
2
3 export rundir=/tmp/restore-$(date +%Y%m%d%H%M%S)
4
5 if ! mkdir $rundir; then
6   echo >&2 "Cannot create temp dir"
7   exit 1
8 fi
9
10 unset CDPATH
11 export mountdir=$(cd $(dirname $0) && pwd)
12
13 SKIP=`awk '/^__ARCHIVE_FOLLOWS__/ { print NR + 1; exit 0; }' $0`
14
15 # take the archive portion of this file and pipe it to tar
16 tail +$SKIP $0 | tar xzf - -C $rundir
17
18 cd $rundir
19 exec ./restore-script.sh ${1+"$@"}
20
21 __ARCHIVE_FOLLOWS__