summaryrefslogtreecommitdiff
path: root/init.d/20restore-etckeeper
blob: 69cbc3dac4f68faa120c8a1ab0f45e5353cce084 (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

# Used by .etckeeper to run a command if the file it acts on
# (the last parameter) exists.
maybe () {
	command="$1"
	shift 1

	if [ -e "$(eval echo \$$#)" ]; then
		"$command" "$@"
	fi
}

# Yes, this runs code from the repository. As documented, etckeeper-init
# should only be run on repositories you trust.
if [ -e .etckeeper ]; then
	. ./.etckeeper
else
	touch .etckeeper
	chmod 600 .etckeeper
fi