summaryrefslogtreecommitdiff
path: root/etckeeper
blob: a9cf577890f4da7112288bad104d19c929b702c4 (plain)
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
#!/bin/sh
set -e

if [ -e /etc/etckeeper/etckeeper.conf ]; then
	. /etc/etckeeper/etckeeper.conf
fi

if [ ! -z "$GIT_COMMIT_OPTION" ]; then
	export GIT_COMMIT_OPTION
fi

if [ -z "$1" ]; then
	echo "usage: etckeeper command [directory]" >&2
	exit 1
fi
command="$1"
shift 1

if [ ! -d "/etc/etckeeper/$command.d" ]; then
	echo "etckeeper: /etc/etckeeper/$command.d does not exist" >&2
	exit 1
fi

if [ -n "$1" ]; then
	cd "$1"
else
	cd /etc
fi

run-parts --exit-on-error "/etc/etckeeper/$command.d"