summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Bilyk <jbilyk@gmail.com>2011-07-16 19:09:21 -0400
committerJeff Bilyk <jbilyk@gmail.com>2011-07-16 19:09:21 -0400
commitd4ef4a3598d03b25fca58a82ae7147d54bf312e7 (patch)
treed4b888f30ea85590b306c8857f5a0c7a682b640a
parent0b3ae89a2abdaccea8eac0a089c1e1fd589c5c3e (diff)
downloadalpine-conf-d4ef4a3598d03b25fca58a82ae7147d54bf312e7.zip
setup-chrony: new script for setting up chrony for NTP time sync
-rw-r--r--Makefile1
-rw-r--r--setup-alpine.in2
-rwxr-xr-xsetup-chrony.in48
3 files changed, 51 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index ed9a1de..5c26e84 100644
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,7 @@ SBIN_FILES := lbu\
setup-alpine-web\
setup-apklbu\
setup-apkrepos\
+ setup-chrony\
setup-cryptswap\
setup-disk\
setup-dns\
diff --git a/setup-alpine.in b/setup-alpine.in
index 56ab384..d25c21e 100644
--- a/setup-alpine.in
+++ b/setup-alpine.in
@@ -77,3 +77,5 @@ DEFAULT_DISK=none \
$PREFIX/sbin/setup-disk -q
$PREFIX/sbin/setup-apklbu -i
+
+$PREFIX/sbin/setup-chrony
diff --git a/setup-chrony.in b/setup-chrony.in
new file mode 100755
index 0000000..cb21ae4
--- /dev/null
+++ b/setup-chrony.in
@@ -0,0 +1,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