summaryrefslogtreecommitdiff
path: root/etckeeper
blob: 7ce695fe140811befc2de6189998abe9ac92e1ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
set -e

if [ -z "$1" ]; then
	echo "usage: etckeeper command" >&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 [ "$command" = post-apt ] || [ "$command" = pre-apt ]; then
	cd /etc
elif [ "$command" = pre-commit ] && [ -n "$1" ]; then
	chdir "$1"
fi

run-parts "/etc/etckeeper/$command.d"