-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocalExport.sh
executable file
·66 lines (54 loc) · 1.6 KB
/
localExport.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env bash
if which python3 >/dev/null 2>&1
then
PYTHON3=python3
else
PYTHON3=python
fi
if [ $# != 2 ]; then
echo "Usage: " $0 " <raw export .tar.gz file> <dokuforge-export-static working copy>"
exit 1
fi
RAWEXPORT=$1
EXPORTDIR=`dirname $1`
ACANAME=`basename $1 .tar.gz`
DFWORKDIR=work/example/df
DFACADIR=$DFWORKDIR/$ACANAME
EXPORTSTATICDIR=$2
EXPORTSTATICCLEANDIR=`mktemp -d`
EXPORTEDACAFILENAME=texexport_$ACANAME.tar
EXPORTEDACADIR=$EXPORTDIR/texexport_$ACANAME
CURRENTDIR=`pwd`
echo $EXPORTDIR
echo $ACANAME
echo $TMPDIR
echo $DFACADIR
if [ -d $DFACADIR ]; then
echo $DFACADIR " exists, please remove and retry."
exit 1
fi
if [ -e $EXPORTEDACAFILENAME ]; then
echo $EXPORTEDACAFILENAME " exists, please remove and retry."
exit 1
fi
if [ -d $EXPORTEDACADIR ]; then
echo $EXPORTEDACADIR "exists, please remove and retry."
exit 1
fi
# unpack raw export so that local df2 finds it
mkdir -p work/example/df
tar -C $DFWORKDIR -xvf $RAWEXPORT
# clean directory of dokuforge-export-static files (no local files, e.g., backups)
rmdir $EXPORTSTATICCLEANDIR
svn export $EXPORTSTATICDIR $EXPORTSTATICCLEANDIR
# perform actual export, this can take a few seconds without output
echo "Exporting ..."
printf 'commitid = "%s"' `git show -s --format=%H` > dokuforge/versioninfo.py \
|| rm dokuforge/versioninfo.py
$PYTHON3 -m dokuforge.export $DFWORKDIR $EXPORTSTATICCLEANDIR $ACANAME
echo "Done."
rm dokuforge/versioninfo.py
# unpack export
tar -C $EXPORTDIR -xvf $EXPORTEDACAFILENAME
# clean up files created during exporting
rm -rf $DFACADIR $EXPORTEDACAFILENAME $EXPORTSTATICCLEANDIR