monotone

monotone Mtn Source Tree

Root/contrib/monotone-mirror-postaction-push.sh

  • Property mtn:execute set to true
1#! /bin/sh
2#
3# Reads a simple specification in the following form:
4#
5#SERVERPATTERN ...
6#
7# For each line, the given branch PATTERNs are pushed to the given
8# SERVER. SERVER has the following syntax: ADDRESS[:PORT]
9#
10# This script relies on the following environment variables:
11#
12#DATABASEpoints out what database to use as source.
13#KEYDIROPThas the form '--keydir=<KEYDIRECTORY>' it the top
14#mirror script has a keydir setting.
15#KEYIDOPThas the form '--key=<KEYID>' it the top mirror
16#script has a keyid setting.
17#
18# $1specification file name.
19#Default: /etc/monotone/push.rc
20
21if [ -z "$DATABASE" ]; then
22 echo "No database was given through the DATABASE environment variable" >&2
23 exit 1
24fi
25
26if [ -f "$DATABASE" ]; then :; else
27 echo "The database $DATABASE doesn't exist" >&2
28 echo "You have to initialise it yourself, like this:" >&2
29 echo "mtn db init -d $database" >&2
30 exit 1
31fi
32
33rc=$1
34if [ -z "$rc" ]; then
35 rc=/etc/monotone/push.rc
36fi
37
38if [ -f "$rc" ]; then :; else
39 echo "The specification file $rc doesn't exist" >&2
40 exit 1
41fi
42
43# Make sure the path to the database is absolute
44databasedir=`dirname $DATABASE`
45databasefile=`basename $DATABASE`
46databasedir=`cd $databasedir; pwd`
47database="$databasedir/$databasefile"
48
49sed -e '/^#/d' < "$rc" | while read SERVER PATTERNS; do
50 if [ -n "$SERVER" -a -n "$PATTERNS" ]; then
51( eval "set -x; mtn -d \"$database\" $KEYDIROPT $KEYIDOPT push $SERVER $PATTERNS" )
52 elif [ -n "$SERVER" -o -n "$PATTERNS" ]; then
53echo "SYNTAX ERROR IN LINE '$SERVER $PATTERNS'"
54 fi
55done

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status