monotone-snapshotting 892 Bytes
Newer Older
Nico Schottelius's avatar
init  
Nico Schottelius committed
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
#!/bin/sh
#
# Nico Schottelius (nico-linux@schottelius.org)
# Juli 2004
# extract a snapshot from a monotone database
# Version: 0.1
#

######### must be changed ############
DESTINATION=/home/server/ftp/pub/linux/gpm/
PACKAGE=gpm
DB=/home/server/monotone/gpm-new.db
BRANCH=org.schottelius.gpm

######### may be changed ############
MONOTONE=/usr/packages/monotone-0.17/bin/monotone
TMP=/tmp

########### no changes below here needed ########
DATE=`date +%Y-%m-%d`
YESTERDAY=`date -d yesterday +%Y-%m-%d`
DIRNAME="$PACKAGE"-snapshot-"$DATE"
TARNAME="${DIRNAME}.tar.bz2"
YESTERDAY_TARFILE="${DESTINATION}/${PACKAGE}-snapshot-${YESTERDAY}.tar.bz2"

########### program code  ########
cd "$TMP"

"$MONOTONE" --db="$DB" --branch="$BRANCH" co "$DIRNAME" 2>/dev/null

tar cfj "$TARNAME" "$DIRNAME" && mv "$TARNAME" "$DESTINATION"

# cleanup
rm -f "$YESTERDAY_TARFILE"
rm -fr "$DIRNAME" "$TARNAME"