nsbin/monotone-snapshotting

37 lines
892 B
Bash
Executable File

#!/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"