This file is indexed.

/usr/share/doc/monotone/contrib/monotone-mirror-postaction-update.sh is in monotone 1.1-9.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#! /bin/sh
#
# Reads a simple specification in the following form:
#
#	DIRECTORY	BRANCH
#
# and updates each directory with the data from said branch.
#
# This script relies on the following environment variables:
#
#	DATABASE	points out what database to use as source.
#	KEYDIROPT	has the form '--keydir=<KEYDIRECTORY>' it the top
#			mirror script has a keydir setting.
#	KEYIDOPT	has the form '--key=<KEYID>' it the top mirror
#			script has a keyid setting.
#
# $1	specification file name.
#	Default: /etc/monotone/update.rc

if [ -z "$DATABASE" ]; then
    echo "No database was given through the DATABASE environment variable" >&2
    exit 1
fi

if [ -f "$DATABASE" ]; then :; else
    echo "The database $DATABASE doesn't exist" >&2
    echo "You have to initialise it yourself, like this:" >&2
    echo "	mtn db init -d $database" >&2
    exit 1
fi

rc=$1
if [ -z "$rc" ]; then
    rc=/etc/monotone/update.rc
fi

if [ -f "$rc" ]; then :; else
    echo "The specification file $rc doesn't exist" >&2
    exit 1
fi

# Make sure the path to the database is absolute
databasedir=`dirname $DATABASE`
databasefile=`basename $DATABASE`
databasedir=`cd $databasedir; pwd`
database="$databasedir/$databasefile"

sed -e '/^#/d' < "$rc" | while read DIRECTORY BRANCH; do
    if [ -n "$DIRECTORY" -o -n "$BRANCH" ]; then
	if [ -z "$DIRECTORY" -o -z "$BRANCH" ]; then
	    echo "Directory or branch missing in line: $DIRECTORY $BRANCH" >&2
	    echo "Skipping..." >&2
	elif [ -d "$DIRECTORY" ]; then
	    (
		if [ -d $DIRECTORY/_MTN ]; then
		    thisbranch=
		    if [ -f $DIRECTORY/_MTN/options ]; then
			thisbranch=`grep '^ *branch ' $DIRECTORY/_MTN/options | sed -e 's/^ *branch *"//' -e 's/" *$//'`
		    fi
		    if [ "$thisbranch" = "$BRANCH" ]; then
			echo "Updating the directory $DIRECTORY" >&2
			( cd $DIRECTORY; mtn update )
		    else
			echo "The directory $DIRECTORY doesn't contain the branch $BRANCH" >&2
			echo "Skipping..." >&2
		    fi
		else
		    filesn=`ls -1 -a $DIRECTORY | egrep -v '^\.\.?$' | wc -l`
		    if [ "$filesn" -eq 0 ]; then
			echo "Extracting branch $BRANCH into empty directory $DIRECTORY" >&2
			( cd $DIRECTORY; mtn -d "$database" -b "$BRANCH" co . )
		    else
			
			echo "The directory $DIRECTORY doesn't contain the branch $BRANCH" >&2
			echo "Skipping..." >&2
		    fi
		fi
	    )
	elif [ -e "$DIRECTORY" ]; then
	    echo "There is a file $DIRECTORY, but it's not a directory" >&2
	    echo "Skipping..." >&2
	else
	    echo "Extracting branch $BRANCH into directory $DIRECTORY" >&2
	    mtn -d "$database" -b "$BRANCH" co "$DIRECTORY"
	fi
    fi
done