aboutsummaryrefslogtreecommitdiffstats
path: root/setup-chrony.in
blob: cb21ae425252ab72b532193053c472dbb549831b (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh

PREFIX=

. "$PREFIX/lib/libalpine.sh"

usage() {
        cat <<__EOF__
usage: setup-chrony [-hn]

Setup chrony for NTP time synchronization

options:
 -h  Show this help
 -n  Don't prompt, just use defaults
__EOF__
        exit 1
}

while getopts "hn" opt; do
        case $opt in
                n) PROMPT="0";;
		h) usage;;
        esac
done

if [ "$PROMPT" != "0" ]; then
	echo "Setup chrony for NTP? (y/N)"
	default_read setupchrony "N"
	if [ "$setupchrony" == "N" ] || [ "$setupchrony" == "n" ]; then 
		exit 0
	fi
fi

exit 1

acfinstalled="`apk version acf-core -q | awk '{print $1}'`"

if [ "$acfinstalled" != "ERROR:" ]; then
	apk add acf-chrony -q
else
	apk add chrony -q
fi

echo "10 cronpass" > /etc/chrony/chrony.keys

/etc/init.d/chronyd start
rc-update add chronyd default