summaryrefslogtreecommitdiffstats
path: root/extra/sntpc
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-01-30 08:44:12 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-01-30 08:44:12 +0000
commitd5d421362871410812451c62e58776b4e611f78d (patch)
treef8eb10bbcc8ef4b98ef7fc5a21660e12ec1b740b /extra/sntpc
parentfe8e709da651f0f2a105882440b9242127537a63 (diff)
downloadaports-d5d421362871410812451c62e58776b4e611f78d.tar.bz2
aports-d5d421362871410812451c62e58776b4e611f78d.tar.xz
extra/sntpc: new aport
Simple NTP Client http://dev.alpinelinux.org/cgit/cgit.cgi/sntpc/
Diffstat (limited to 'extra/sntpc')
-rw-r--r--extra/sntpc/APKBUILD26
-rw-r--r--extra/sntpc/sntpc.confd9
-rw-r--r--extra/sntpc/sntpc.initd30
3 files changed, 65 insertions, 0 deletions
diff --git a/extra/sntpc/APKBUILD b/extra/sntpc/APKBUILD
new file mode 100644
index 00000000..b1315e06
--- /dev/null
+++ b/extra/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://dev.alpinelinux.org/cgit/cgit.cgi/sntpc"
+license="GPL-2"
+depends="uclibc"
+source="http://dev.alpinelinux.org/cgit/cgit.cgi/sntpc/snapshot/sntpc-0.9.tar.bz2
+ sntpc.initd
+ sntpc.confd
+ "
+
+build() {
+ cd "$srcdir/$pkgname"
+
+ 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="f42fb17ef688e0cea7e0267b1ec837ee sntpc-0.9.tar.bz2
+c5018237685af2cddb0b4ede1751bee1 sntpc.initd
+4ea1ceee01f94080be86188bde8f9adc sntpc.confd"
diff --git a/extra/sntpc/sntpc.confd b/extra/sntpc/sntpc.confd
new file mode 100644
index 00000000..a92e4be8
--- /dev/null
+++ b/extra/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/extra/sntpc/sntpc.initd b/extra/sntpc/sntpc.initd
new file mode 100644
index 00000000..a97e51bd
--- /dev/null
+++ b/extra/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 $?
+}