diff options
author | wbx <wbx@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2005-03-23 20:19:42 +0000 |
---|---|---|
committer | wbx <wbx@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2005-03-23 20:19:42 +0000 |
commit | 7bf482253faf075f55556b69a3908f1c859d8322 (patch) | |
tree | 5e7a96353995aaa1301a9b4548cab2ef6b52043d /openwrt/package/openntpd/ipkg | |
parent | b1b9d8388faa032c2ab4f8b2249967ad64cc7617 (diff) |
fixup openntpd package. ntpd now starts as user ntp and
CONTROL/postinst can be executed on host and target system.
idea from nbd to use IPKG_ROOTDIR
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@435 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'openwrt/package/openntpd/ipkg')
-rwxr-xr-x | openwrt/package/openntpd/ipkg/CONTROL/postinst | 25 | ||||
-rwxr-xr-x | openwrt/package/openntpd/ipkg/etc/init.d/S49ntpd | 3 | ||||
-rw-r--r-- | openwrt/package/openntpd/ipkg/etc/ntpd.conf | 3 |
3 files changed, 31 insertions, 0 deletions
diff --git a/openwrt/package/openntpd/ipkg/CONTROL/postinst b/openwrt/package/openntpd/ipkg/CONTROL/postinst new file mode 100755 index 000000000..8881116c0 --- /dev/null +++ b/openwrt/package/openntpd/ipkg/CONTROL/postinst @@ -0,0 +1,25 @@ +#!/bin/sh +grep -q '^ntp[[:space:]]*123/udp' ${IPKG_INSTROOT}/etc/services 2>/dev/null +[ $? -ne 0 ] && echo "ntp 123/udp" >>${IPKG_INSTROOT}/etc/services + +NU=ntp +U=`grep "^$NU:" ${IPKG_INSTROOT}/etc/passwd 2>/dev/null | cut -d: -f3` +if [ .$U = . ]; then + U=`cut -d: -f3 ${IPKG_INSTROOT}/etc/passwd 2>/dev/null | sort -n | tail -1` + [ .$U = . ] && U=49 + U=`expr $U + 1` + [ $U -lt 50 ] && U=50 + G=`grep "^$NU:" ${IPKG_INSTROOT}/etc/group 2>/dev/null | cut -d: -f3` + if [ .$G = . ]; then + G=`cut -d: -f3 ${IPKG_INSTROOT}/etc/group 2>/dev/null | sort -n | tail -1` + [ .$G = . ] && G=49 + G=`expr $G + 1` + [ $G -lt 50 ] && G=50 + fi + LINE="$NU:x:$U:$G::/tmp/.ntp:/bin/false" + echo "$LINE" >>${IPKG_INSTROOT}/etc/passwd +else + awk -F: '{ if($1=="ntp") printf("%s:%s:%s:%s:%s:/tmp/.ntp:/bin/false\n",$1,$2,$3,$4,$5); else print $0 }' ${IPKG_INSTROOT}/etc/passwd >/tmp/$$ + mv /tmp/$$ ${IPKG_INSTROOT}/etc/passwd + chmod 644 ${IPKG_INSTROOT}/etc/passwd +fi diff --git a/openwrt/package/openntpd/ipkg/etc/init.d/S49ntpd b/openwrt/package/openntpd/ipkg/etc/init.d/S49ntpd new file mode 100755 index 000000000..e52874878 --- /dev/null +++ b/openwrt/package/openntpd/ipkg/etc/init.d/S49ntpd @@ -0,0 +1,3 @@ +#!/bin/sh +mkdir -p `grep "^ntp:" /etc/passwd | cut -d: -f6` +/usr/sbin/ntpd -s diff --git a/openwrt/package/openntpd/ipkg/etc/ntpd.conf b/openwrt/package/openntpd/ipkg/etc/ntpd.conf new file mode 100644 index 000000000..6993b8eba --- /dev/null +++ b/openwrt/package/openntpd/ipkg/etc/ntpd.conf @@ -0,0 +1,3 @@ +# use a random selection of 8 public stratum 2 servers +# see http://twiki.ntp.org/bin/view/Servers/NTPPoolServers +servers pool.ntp.org |