aboutsummaryrefslogtreecommitdiffstats
path: root/main/sntpc
diff options
context:
space:
mode:
Diffstat (limited to 'main/sntpc')
-rw-r--r--main/sntpc/APKBUILD26
-rw-r--r--main/sntpc/sntpc.confd9
-rw-r--r--main/sntpc/sntpc.initd30
3 files changed, 65 insertions, 0 deletions
diff --git a/main/sntpc/APKBUILD b/main/sntpc/APKBUILD
new file mode 100644
index 0000000000..6df6a6efd0
--- /dev/null
+++ b/main/sntpc/APKBUILD
@@ -0,0 +1,26 @@
+# Contributor: Natanael Copa <ncopa@alpinelinux.org>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=sntpc
+pkgver=0.9
+pkgrel=0
+pkgdesc="Simple NTP client"
+url="http://git.alpinelinux.org/cgit/sntpc"
+license="GPL-2"
+depends="uclibc"
+source="http://git.alpinelinux.org/cgit/sntpc/snapshot/sntpc-$pkgver.tar.bz2
+ sntpc.initd
+ sntpc.confd
+ "
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ make || return 1
+ install -m755 -D sntpc "$pkgdir"/usr/sbin/sntpc
+ install -m755 -D "$srcdir"/sntpc.initd "$pkgdir"/etc/init.d/sntpc
+ install -m644 -D "$srcdir"/sntpc.confd "$pkgdir"/etc/conf.d/sntpc
+}
+
+md5sums="60c64d975daa3a6f371e9e81538e38db sntpc-0.9.tar.bz2
+c5018237685af2cddb0b4ede1751bee1 sntpc.initd
+4ea1ceee01f94080be86188bde8f9adc sntpc.confd"
diff --git a/main/sntpc/sntpc.confd b/main/sntpc/sntpc.confd
new file mode 100644
index 0000000000..a92e4be868
--- /dev/null
+++ b/main/sntpc/sntpc.confd
@@ -0,0 +1,9 @@
+#
+# Set time sync interval (in seconds) here.
+# Setting SNTPC_INTERVAL to 0 will make sntp run once and just exit
+#
+
+SNTPC_INTERVAL="0"
+
+# The NTP server to use as time source
+SNTPC_HOST=pool.ntp.org
diff --git a/main/sntpc/sntpc.initd b/main/sntpc/sntpc.initd
new file mode 100644
index 0000000000..a97e51bdbd
--- /dev/null
+++ b/main/sntpc/sntpc.initd
@@ -0,0 +1,30 @@
+#!/sbin/runscript
+
+NAME=sntpc
+DAEMON=/usr/sbin/$NAME
+
+depend() {
+ need net
+}
+
+start() {
+ local msg opts
+ if [ "$SNTPC_INTERVAL" = "0" ]; then
+ msg="Setting time from NTP source"
+ else
+ msg="Starting ${NAME}"
+ opts="-d"
+ fi
+ ebegin "$msg"
+ start-stop-daemon --start --quiet --name sntpc \
+ --exec ${DAEMON} -- \
+ -i ${SNTPC_INTERVAL} $opts ${SNTPC_HOST}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${NAME}"
+ start-stop-daemon --stop --quiet \
+ --exec ${DAEMON}
+ eend $?
+}