/
etckeeper
executable file
·54 lines (45 loc) · 954 Bytes
/
etckeeper
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
#!/bin/sh
set -e
conf=/etc/etckeeper/etckeeper.conf
if [ -e $conf ]; then
. $conf
fi
if [ -z "$VCS" ]; then
echo "Please configure a VCS in $conf" >&2
exit 1
fi
export VCS
if [ ! -z "$GIT_COMMIT_OPTIONS" ]; then
export GIT_COMMIT_OPTIONS
fi
if [ ! -z "$HG_COMMIT_OPTIONS" ]; then
export HG_COMMIT_OPTIONS
fi
if [ ! -z "$HIGHLEVEL_PACKAGE_MANAGER" ]; then
export HIGHLEVEL_PACKAGE_MANAGER
fi
if [ ! -z "$LOWLEVEL_PACKAGE_MANAGER" ]; then
export LOWLEVEL_PACKAGE_MANAGER
fi
if [ -z "$1" ]; then
echo "usage: etckeeper command [directory]" >&2
exit 1
fi
command="$1"
shift 1
# compatability code
if [ "$command" = "post-apt" ]; then
command=post-install
elif [ "$command" = "pre-apt" ]; then
command=pre-install
fi
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"