diff options
author | James Meyer <james.meyer@operamail.com> | 2013-02-19 21:10:18 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2013-02-19 21:10:18 (GMT) |
commit | 2648e999d277eac5c3d331a3609bcc73fafbea71 (patch) | |
tree | 40951fb8e7fdbe28a0baa324ae615055203f1e2e /abs/core/ntp | |
parent | c759b5e0c4aa6fc37412b4dee2cf9ad993fd376d (diff) | |
parent | 7e6f7ca174e1af67178dc5293a312a4a733eb095 (diff) | |
download | linhes_pkgbuild-2648e999d277eac5c3d331a3609bcc73fafbea71.zip linhes_pkgbuild-2648e999d277eac5c3d331a3609bcc73fafbea71.tar.gz linhes_pkgbuild-2648e999d277eac5c3d331a3609bcc73fafbea71.tar.bz2 |
Merge branch 'testing'
# By James Meyer (1091) and others
# Via James Meyer (5) and others
* testing: (1148 commits)
LinHES-config: during install don't kill off lirc. This keeps the remote active all the way to the finish
Change version numbers to 8.0 to match the release number. LinHES-conifg LinHES-system mythdb-initial runit-scripts supplemental-web
LinHES-conifig: mv_install.py for the last partition don't go all the way to the end. Gotta leave room for gpt tables.
xf86-video-ati: xorg ati driver.
LinHES-config: timezip.py add syncing up of parental lvl passwords and starting level with MBE.
LinHES-system: correct the logic for breaking out of the wmctrl loop. As written it would break out of the inner loop..but not the 60 iteration loop.
e16_theme_settings: remove slide-in prop for new windows. For whatever reason this was preventing mplayer from being positioned correctly for appletrailers.
LinHES-config, mythinstall: change case of hd_pvr and serial to all lower refs #902
zilog-firmware: firmware for TX support of the hdpvr and pvr-150 In general I can't recommend anybody using these transmitters but including the firmware just in case someone really wants to
linhes-udev-rules: added hdprv_lirc rule. All of these lirc rules are limited to exactly one device. If more then one device is present then only the last device in init will get the symlink
runit-scripts: fix logging for igdeamon, add support to remote init script so that the blaster is always the first device in the chain. added support specificly for hd_pvr
LinHES-system: add lh_system_restore and lh_system_backup. These scripts are called from the mythmenu. refs #900
iguanair: rebuild with python 2.7
LinHES-system: msg_daemon.py fix init and nasty bug related to timeout. In a nutshell timeout wouldn't work unless a msg without a timeout was called first.
linhes-udev-rules: add rules for mce,streamzap,serial lirc devices.
mythinstall: recompile for matching libs
mythtv: latest .25-fixes and change mythbackup/restore call lh_system_$op to replace mythbackup/mythrestore. mythbackup no longer works correctly with the new windowmanager
linhes-scripts: myth2mp3, myth2x264, myth2xvid: use mythutil to get cutlist
LinHES-config, supplimental-web: Fix proxy numbering for Ceton infiniTV
linhes-system: add additional stuff to the system backup and also introduced an exclude file. The exclude/include files are locate in /home/mythtv/backup_config/
...
Diffstat (limited to 'abs/core/ntp')
-rw-r--r-- | abs/core/ntp/PKGBUILD | 118 | ||||
-rw-r--r-- | abs/core/ntp/changelog | 25 | ||||
-rw-r--r-- | abs/core/ntp/install | 37 | ||||
-rw-r--r-- | abs/core/ntp/logrotate.d | 4 | ||||
-rw-r--r-- | abs/core/ntp/ntp-4.2.4-html2man.patch | 183 | ||||
-rw-r--r-- | abs/core/ntp/ntp.conf | 69 | ||||
-rwxr-xr-x[-rw-r--r--] | abs/core/ntp/ntpd | 83 | ||||
-rw-r--r-- | abs/core/ntp/ntpd.conf (renamed from abs/core/ntp/ntp-client.conf) | 4 | ||||
-rw-r--r-- | abs/core/ntp/ntpd.service | 12 | ||||
-rwxr-xr-x[-rw-r--r--] | abs/core/ntp/ntpdate | 46 |
10 files changed, 188 insertions, 393 deletions
diff --git a/abs/core/ntp/PKGBUILD b/abs/core/ntp/PKGBUILD index 290b6b2..3da7795 100644 --- a/abs/core/ntp/PKGBUILD +++ b/abs/core/ntp/PKGBUILD @@ -1,78 +1,64 @@ -# $Id$ -# Maintainer: kevin <kevin@archlinux.org> +# $Id: PKGBUILD 162162 2012-06-22 12:59:21Z dreisner $ +# Maintainer: Gaetan Bisson <bisson@archlinux.org> +# Contributor: kevin <kevin@archlinux.org> pkgname=ntp -pkgver=4.2.6.p3 -_realver=4.2.6p3 -pkgrel=3 -pkgdesc="NTP (Network Time Protocol) tries to keep servers in sync" -arch=(i686 x86_64) +pkgver=4.2.6.p5 +_realver=4.2.6p5 +pkgrel=7 +pkgdesc='Network Time Protocol reference implementation' +url='http://www.ntp.org/' license=('custom') -url="http://www.ntp.org/" -depends=('openssl' 'readline' 'libcap') +arch=('i686' 'x86_64') makedepends=('perl-html-parser') -backup=('etc/ntp.conf' 'etc/conf.d/ntp-client.conf') -options=('!emptydirs') -changelog=changelog -source=(http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-${_realver}.tar.gz - ntp-4.2.4-html2man.patch - ntp.conf - ntp-client.conf - ntpd - ntpdate) -md5sums=('59876a9009b098ff59767ee45a88ebd2' '1b04e888717bb31479a6087632981723' - '398a7f270f6ae083f47f86eb8b557a75' '58997d6cf4846d80e35a01b855376a33' - 'bf20804e75656609e808ca21b53ea4aa' '99b49d763e5866f4f81c48d922c80b93') - -build() { - cd "$srcdir/$pkgname-$_realver" - # fix man page generation - patch -Np1 -i ../ntp-4.2.4-html2man.patch - # configure - export LDFLAGS="${LDFLAGS//-Wl,--as-needed}" - # 4.2.6p3: aclocal too old, regenerate - rm -f aclocal.m4 - libtoolize --copy --force - ac_cv_header_dns_sd_h=0 ./configure --prefix=/usr \ - --mandir=/usr/share/man \ - --enable-linux-caps - # build - make -} - -package() { - cd "$srcdir/$pkgname-$_realver" +depends=('openssl' 'readline' 'libcap') +backup=('etc/ntp.conf' 'etc/conf.d/ntpd.conf') +source=("http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-${_realver}.tar.gz" + 'ntpd' + 'ntpdate' + 'ntp.conf' + 'ntpd.conf' + 'logrotate.d' + 'ntpd.service') +sha1sums=('4a5353a4791b6f4315a66c28d504ec6c7926b192' + '4e324e625c1f080b5c028be5092aa71adbf9bd99' + '01394b8a952f5edc85d19df8335eeac3980320f4' + 'eb1f63814b9adbd3d518e880fa3b38c375f0fe91' + '4537d1f58b299d463db5048129cb264511474b0b' + '4f76f7f9ffc8315ff9924f793f272d4f6939b816' + '81df5c4d51cb69bc29363625ff49e2bd388d1fa9') - # install - make DESTDIR="$pkgdir" install +install=install - # install conf files - install -d "$pkgdir/usr/share/ntp" - install -D -m644 conf/* "${pkgdir}/usr/share/ntp" +build() { + cd "${srcdir}/${pkgname}-${_realver}" - # install launch scripts - install -d "$pkgdir/etc/rc.d" - install -D -m755 ${srcdir}/{ntpd,ntpdate} "$pkgdir/etc/rc.d" + ./configure \ + --prefix=/usr \ + --mandir=/usr/share/man \ + --enable-linuxcaps \ - # install man pages - cd html - ../scripts/html2man - sed -i 's/^[\t\ ]*$//;/./,/^$/!d' man/man*/*.[58] - install -d "$pkgdir"/usr/share/man/man{5,8} - install -m644 man/man5/* "$pkgdir/usr/share/man/man5/" - install -m644 man/man8/* "$pkgdir/usr/share/man/man8/" - mv "$pkgdir/usr/share/man/man8/ntpd.8" "$pkgdir/usr/share/man/man8/ntp-ntpd.8" - cd .. + make +} - # install sample configs - install -D -m644 "$srcdir/ntp.conf" "$pkgdir/etc/ntp.conf" - install -D -m644 "$srcdir/ntp-client.conf" \ - "$pkgdir/etc/conf.d/ntp-client.conf" +package() { + cd "${srcdir}/${pkgname}-$_realver" - # create /var/lib/ntp - install -d "$pkgdir/var/lib/ntp" - touch "$pkgdir/var/lib/ntp/.placeholder" + make DESTDIR="${pkgdir}" install - install -Dm644 "$srcdir/$pkgname-$_realver/COPYRIGHT" \ - "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + rmdir "${pkgdir}"/usr/{lib,sbin} + install -d -o 87 "${pkgdir}"/var/lib/ntp + install -Dm755 ../ntpd "${pkgdir}"/etc/rc.d/ntpd + install -Dm755 ../ntpdate "${pkgdir}"/etc/rc.d/ntpdate + install -Dm644 ../ntp.conf "${pkgdir}"/etc/ntp.conf + install -Dm644 ../ntpd.conf "${pkgdir}"/etc/conf.d/ntpd.conf + install -Dm644 ../logrotate.d "${pkgdir}"/etc/logrotate.d/ntpd + install -Dm644 ../ntpd.service "${pkgdir}"/usr/lib/systemd/system/ntpd.service + install -Dm644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" + + cd html + ../scripts/html2man + install -d "${pkgdir}"/usr/share/man + mv man/man* "${pkgdir}"/usr/share/man + mv "${pkgdir}/usr/share/man/man8/ntpd.8" "${pkgdir}/usr/share/man/man8/ntp-ntpd.8" # we should ditch openntpd } diff --git a/abs/core/ntp/changelog b/abs/core/ntp/changelog deleted file mode 100644 index 528a078..0000000 --- a/abs/core/ntp/changelog +++ /dev/null @@ -1,25 +0,0 @@ -2011-04-03 andrea <andrea@archlinux.org> - - * ntp 4.2.6p3-3 - - Use 'ntpd -p' to get the PID in ntpd - - Don't run the ntp client in background in ntpdate - -2011-03-28 andrea <andrea@archlinux.org> - - * ntp 4.2.6p3-2 - - Improved daemon scripts - -2010-10-16 kevin <kevin@archlinux.org> - - * ntp 4.2.6p3 - - Implemented FS#18469, replace ntpdate with ntpd -q - - Removed LIBS - - Removed old IPv6 and nano patch - -2010-10-16 kevin <kevin@archlinux.org> - - * ntp 4.2.6p2 - - Added changelog - - Set LIBS to use librt since configure doesn't set it - - Convert PKGBUILD to build()/package() format - - removed "|| return 1" diff --git a/abs/core/ntp/install b/abs/core/ntp/install new file mode 100644 index 0000000..e6eddf8 --- /dev/null +++ b/abs/core/ntp/install @@ -0,0 +1,37 @@ +post_install() { + getent group ntp &>/dev/null || groupadd -g 87 ntp >/dev/null + getent passwd ntp &>/dev/null || useradd -u 87 -g ntp -d /var/lib/ntp -c 'Network Time Protocol' -s /bin/false ntp >/dev/null + true +} + +post_upgrade() { + if [[ $(vercmp $2 4.2.6.p3) -le 0 ]]; then + cat <<EOF + +==> The file /etc/conf.d/ntp-client.conf has been renamed /etc/conf.d/ntpd.conf +==> If you made changes to the former, please update the latter. + +EOF + fi + if [[ $(vercmp $2 4.2.6.p5-1) -le 0 ]]; then + cat <<EOF + +==> The PID file /var/run/ntpd.pid has been renamed /run/ntpd.pid +==> and the new rc.d script only takes the latter into account. +==> To stop your old ntpd process, please kill it manually. + +EOF + fi + if [[ $(vercmp $2 4.2.6.p5-3) -le 0 ]]; then + post_install + fi + if [[ $(vercmp $2 4.2.6.p5-5) -le 0 ]]; then + chown -R ntp /var/lib/ntp + fi +} + +post_remove() { + getent passwd ntp &>/dev/null && userdel ntp >/dev/null + getent group ntp &>/dev/null && groupdel ntp >/dev/null + true +} diff --git a/abs/core/ntp/logrotate.d b/abs/core/ntp/logrotate.d new file mode 100644 index 0000000..8a9f066 --- /dev/null +++ b/abs/core/ntp/logrotate.d @@ -0,0 +1,4 @@ +/var/log/ntp.log { + missingok + copytruncate +} diff --git a/abs/core/ntp/ntp-4.2.4-html2man.patch b/abs/core/ntp/ntp-4.2.4-html2man.patch deleted file mode 100644 index 333d452..0000000 --- a/abs/core/ntp/ntp-4.2.4-html2man.patch +++ /dev/null @@ -1,183 +0,0 @@ ---- ntp-4.2.4/scripts/html2man.in.html2man 2006-06-06 22:17:10.000000000 +0200 -+++ ntp-4.2.4/scripts/html2man.in 2007-01-08 12:47:31.000000000 +0100 -@@ -23,10 +23,10 @@ - 'ntpq' => ['ntpq', 8, 'ntpd(8), ntpdc(8)'], - 'ntpdate' => ['ntpdate', 8, 'ntpd(8)'], - 'ntpdc' => ['ntpdc', 8, 'ntpd(8)'], -- 'ntptime' => ['ntpdtime', 8, 'ntpd(8), ntpdate(8)'], -+ 'ntptime' => ['ntptime', 8, 'ntpd(8), ntpdate(8)'], - 'ntptrace' => ['ntptrace', 8, 'ntpd(8)'], - 'keygen' => ['ntp-keygen', 8, 'ntpd(8), ntp_auth(5)'], -- 'confopt' => ['ntp.conf', 5, 'ntpd(8)'], -+ 'confopt' => ['ntp.conf', 5, 'ntpd(8), ntp_auth(5), ntp_mon(5), ntp_acc(5), ntp_clock(5), ntp_misc(5)'], - 'authopt' => ['ntp_auth', 5, 'ntp.conf(5), ntpd(8)'], - 'monopt' => ['ntp_mon', 5, 'ntp.conf(5)'], - 'accopt' => ['ntp_acc', 5, 'ntp.conf(5)'], -@@ -34,17 +34,8 @@ - 'miscopt' => ['ntp_misc', 5, 'ntp.conf(5)']); - - # Disclaimer to go in SEE ALSO section of the man page --$seealso_disclaimer = 'These man pages are automatically hacked from the main NTP ' . -- 'documentation pages, which are maintained in HTML format. These files are ' . -- 'included in the NTP source distribution. If you installed NTP from a binary ' . -- 'package, or it came pre-installed on your system, chances are the documentation ' . -- 'was also included in the usual place for your system. The HTML files are more ' . -- 'correct and complete than these man pages, which are provided for your reference ' . -- 'only.'; -- --# Disclaimer to go right at the top --$top_disclaimer = 'This file was automatically generated from HTML source, and may be ' . -- 'incorrect. See the SEE ALSO section at the end of this file for more info'; -+$seealso_disclaimer = "Primary source of documentation: /usr/share/doc/ntp-*\n\n" . -+ "This file was automatically generated from HTML source.\n"; - - mkdir $MANDIR, 0777; - mkdir "$MANDIR/man8", 0777; -@@ -64,7 +55,8 @@ - $fileinfo = $manfiles{$filename}; - - $p = HTML::TokeParser->new("$filename.html") || die "Can't open $filename.html: $!"; -- open(MANOUT, ">$MANDIR/man$fileinfo->[1]/$fileinfo->[0].$fileinfo->[1]") -+ $fileout = "$MANDIR/man$fileinfo->[1]/$fileinfo->[0].$fileinfo->[1]"; -+ open(MANOUT, ">$fileout") - || die "Can't open: $!"; - - $p->get_tag("title"); -@@ -73,7 +65,6 @@ - - # Setup man header - print MANOUT ".TH " . $fileinfo->[0] . " " . $fileinfo->[1] . "\n"; -- print MANOUT ".UC 4\n"; - print MANOUT ".SH NAME\n"; - $pat = $fileinfo->[0]; - if ($name =~ /$pat/) { -@@ -81,10 +72,12 @@ - # Add the manpage name, if not in the HTML title already - print MANOUT "$fileinfo->[0] - "; - } -- print MANOUT "$name\n\n"; -- -- print MANOUT "$top_disclaimer\n"; -+ print MANOUT "$name\n.SH \\ \n\n"; - -+ @fontstack = (); -+ $deflevel = 0; -+ $pre = 0; -+ $ignore = 0; - # Now start scanning. We basically print everything after translating some tags. - # $token->[0] has "T", "S", "E" for Text, Start, End - # $token->[1] has the tag name, or text (for "T" case) -@@ -92,19 +85,37 @@ - while (my $token = $p->get_token) { - if($token->[0] eq "T") { - my $text = $token->[1]; -- if($tag) { -- $text =~ s/^[\n ]*//; -- $text =~ s/[\n ]*$/ /; -+ if (!$pre) { -+ if($tag) { -+ $text =~ s/^[\n\t ]*//; -+ } -+ $text =~ s/^[\n\t ][\n\t ]+$//; -+ $text =~ s/[\n\t ]+/ /g; -+ $text =~ s/ \;/ /g; -+ $text =~ s/>\;/>/g; -+ $text =~ s/<\;/</g; -+ $text =~ s/"\;/"/g; -+ $text =~ s/&\;/&/g; -+ $text =~ s/^\./\\[char46]/; - } -- $text =~ s/ \;/ /g; -- $text =~ s/^\./\\./; - print MANOUT "$text"; - $tag = 0; - } - if($token->[0] eq "S") { - if($token->[1] eq "h4") { - my $text = uc($p->get_trimmed_text("/h4")); -- print MANOUT ".SH $text\n"; -+ # ignore these two sections in ntpd.html -+ if ($filename eq "ntpd" && -+ ($text eq "FILES" || $text eq "CONFIGURATION OPTIONS")) { -+ $ignore = 1; -+ close(MANOUT); -+ open(MANOUT, ">/dev/null"); -+ } elsif ($ignore) { -+ $ignore = 0; -+ close(MANOUT); -+ open(MANOUT, ">>$fileout"); -+ } -+ print MANOUT "\n\n.SH $text\n"; - } - if($token->[1] eq "tt") { - push @fontstack, "tt"; -@@ -118,22 +129,30 @@ - my $text = $p->get_trimmed_text("/address"); - print MANOUT "\n.SH AUTHOR\n$text\n"; - } -- if($token->[1] eq "dt") { -- $tmp = $deflevel-4; -- print MANOUT "\n.RS $tmp\n"; -+ if($token->[1] eq "dt" || $token->[1] eq "br" && $deflevel > 0) { -+ print MANOUT "\n.TP 8\n"; - $tag = 1; - } - if($token->[1] eq "dd") { -- print MANOUT "\n.RS $deflevel\n"; -+ print MANOUT "\n"; - $tag = 1; - } - if($token->[1] eq "dl") { -- $deflevel+=4; -+ $deflevel+=1; -+ if ($deflevel > 0) { -+ print MANOUT "\n.RS ", $deflevel > 1 ? 8 : 0; -+ } -+ } -+ if($token->[1] eq "p") { -+ print MANOUT "\n"; -+ } -+ if($token->[1] eq "pre") { -+ print MANOUT "\n.nf"; -+ $pre = 1; - } - } - elsif($token->[0] eq "E") { -- if($token->[1] eq "dd") { -- print MANOUT "\n.RE\n"; -+ if($token->[1] eq "h4") { - $tag = 1; - } - if($token->[1] eq "tt") { -@@ -157,15 +176,27 @@ - print MANOUT "$fontswitch"; - } - if($token->[1] eq "dl") { -- $deflevel-=4; -+ if ($deflevel > 0) { -+ print MANOUT "\n.RE"; -+ } -+ print MANOUT "\n"; -+ $deflevel-=1; - } -- if($token->[1] eq "dt") { -- print MANOUT "\n.RE"; -+ if($token->[1] eq "p") { -+ print MANOUT "\n"; - $tag = 1; - } -+ if($token->[1] eq "pre") { -+ print MANOUT "\n.fi"; -+ $pre = 0; -+ } - } - } -- print MANOUT ".SH SEE ALSO\n\n"; -+ if ($ignore) { -+ close(MANOUT); -+ open(MANOUT, ">>$fileout"); -+ } -+ print MANOUT "\n.SH SEE ALSO\n\n"; - print MANOUT "$fileinfo->[2]\n\n"; - print MANOUT "$seealso_disclaimer\n"; - close(MANOUT); diff --git a/abs/core/ntp/ntp.conf b/abs/core/ntp/ntp.conf index 7f888e4..a27b228 100644 --- a/abs/core/ntp/ntp.conf +++ b/abs/core/ntp/ntp.conf @@ -1,52 +1,23 @@ -# NOTES: -# - you should only have to update the server line below -# - if you start getting lines like 'restrict' and 'fudge' -# and you didnt add them, AND you run dhcpcd on your -# network interfaces, be sure to add '-Y -N' to the -# dhcpcd_ethX variables in /etc/conf.d/net - -# Name of the servers ntpd should sync with -# Please respect the access policy as stated by the responsible person. -#server ntp.example.tld iburst - -server pool.ntp.org - -## -# A list of available servers can be found here: -# http://www.pool.ntp.org/ -# http://www.pool.ntp.org/#use -# A good way to get servers for your machine is: -# netselect -s 3 pool.ntp.org -## - -#server ntplocal.example.com prefer -#server timeserver.example.org - -# Warning: Using default NTP settings will leave your NTP -# server accessible to all hosts on the Internet. - -# A default deny all (including localhost) policy -# To use this define restrictions for all servers and clients -#restrict default ignore -#restrict -6 default ignore - -# A more open policy, allow access but deny changing the configuration -restrict default nomodify nopeer -#restrict -6 default nomodify nopeer - -# Allow localhost -restrict 127.0.0.1 -#restrict -6 ::1 - - -# To allow machines within your network to synchronize -# their clocks with your server, but ensure they are -# not allowed to configure the server or used as peers -# to synchronize against, uncomment this line. +# With the default settings below, ntpd will only synchronize your clock. # -#restrict 192.168.0.0 mask 255.255.255.0 nomodify nopeer notrap - +# For details, see: +# - the ntp.conf man page +# - http://support.ntp.org/bin/view/Support/GettingStarted +# - https://wiki.archlinux.org/index.php/Network_Time_Protocol_daemon + +# Associate to public NTP pool servers; see http://www.pool.ntp.org/ +server 0.pool.ntp.org +server 1.pool.ntp.org +server 2.pool.ntp.org + +# Only allow read-only access from localhost +restrict default noquery nopeer +restrict 127.0.0.1 +restrict ::1 -# you should not need to modify the following paths -driftfile /var/lib/ntp/ntp.drift +# Location of drift and log files +driftfile /var/lib/ntp/ntp.drift +logfile /var/log/ntp.log +# NOTE: If you run dhcpcd and have lines like 'restrict' and 'fudge' appearing +# here, be sure to add '-Y -N' to the dhcpcd_ethX variables in /etc/conf.d/net diff --git a/abs/core/ntp/ntpd b/abs/core/ntp/ntpd index 825efc1..480fa10 100644..100755 --- a/abs/core/ntp/ntpd +++ b/abs/core/ntp/ntpd @@ -2,51 +2,46 @@ . /etc/rc.conf . /etc/rc.d/functions -. /etc/conf.d/ntp-client.conf +. /etc/conf.d/ntpd.conf -PIDFILE="/var/run/ntpd/ntpd.pid" -PID=$(cat $PIDFILE 2> /dev/null) +unset PID +PIDFILE='/run/ntpd.pid' + +if [[ -r ${PIDFILE} ]]; then + read -r PID <"${PIDFILE}" + if [[ -n ${PID} && ! -d /proc/${PID} ]]; then + rm -f "${PIDFILE}" + unset PID + fi +fi case "$1" in - start) - stat_busy "Starting NTP Daemon" - [ ! -d /var/run/ntpd ] && install -d /var/run/ntpd &>/dev/null - if [ -z "$PID" ]; then - /usr/bin/ntpd $NTPD_ARGS -p /var/run/ntpd/ntpd.pid &>/dev/null - if [ $? -gt 0 ]; then - stat_fail - exit 1 - else - add_daemon ntpd - stat_done - fi - else - stat_fail - exit 1 - fi - ;; - stop) - stat_busy "Stopping NTP Daemon" - if [ -n "$PID" ]; then - kill $PID &> /dev/null - if [ $? -gt 0 ]; then - stat_fail - exit 1 - else - rm $PIDFILE &>/dev/null - rm_daemon ntpd - stat_done - fi - else - stat_fail - exit 1 - fi - ;; - restart) - $0 stop - sleep 1 - $0 start - ;; - *) - echo "usage: $0 {start|stop|restart}" + start) + stat_busy "Starting NTP Daemon" + if [[ -z ${PID} ]] && /usr/bin/ntpd ${NTPD_ARGS} -p "${PIDFILE}" &>/dev/null; then + add_daemon ntpd + stat_done + else + stat_fail + exit 1 + fi + ;; + stop) + stat_busy "Stopping NTP Daemon" + if [[ -n ${PID} ]] && kill "${PID}" &>/dev/null; then + rm ${PIDFILE} + rm_daemon ntpd + stat_done + else + stat_fail + exit 1 + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" esac diff --git a/abs/core/ntp/ntp-client.conf b/abs/core/ntp/ntpd.conf index e728db5..047961f 100644 --- a/abs/core/ntp/ntp-client.conf +++ b/abs/core/ntp/ntpd.conf @@ -1,5 +1,5 @@ # client options for "ntpd -q" - ntpdate equivalent -NTP_CLIENT_OPTION="-g" +NTP_CLIENT_OPTION="-g -u ntp" # arguments passed to ntpd when started -NTPD_ARGS="-g" +NTPD_ARGS="-g -u ntp" diff --git a/abs/core/ntp/ntpd.service b/abs/core/ntp/ntpd.service new file mode 100644 index 0000000..e0cbf87 --- /dev/null +++ b/abs/core/ntp/ntpd.service @@ -0,0 +1,12 @@ +[Unit] +Description=Network Time Service +After=network.target + +[Service] +Type=forking +PIDFile=/run/ntpd.pid +EnvironmentFile=/etc/conf.d/ntpd.conf +ExecStart=/usr/bin/ntpd $NTPD_ARGS -p /run/ntpd.pid + +[Install] +WantedBy=multi-user.target diff --git a/abs/core/ntp/ntpdate b/abs/core/ntp/ntpdate index 99508f4..a8e7467 100644..100755 --- a/abs/core/ntp/ntpdate +++ b/abs/core/ntp/ntpdate @@ -2,30 +2,28 @@ . /etc/rc.conf . /etc/rc.d/functions -. /etc/conf.d/ntp-client.conf +. /etc/conf.d/ntpd.conf case "$1" in - start) - stat_busy "Starting NTP Client" - /usr/bin/ntpd -q $NTP_CLIENT_OPTION &> /dev/null - if [ $? -gt 0 ]; then - stat_fail - exit 1 - else - add_daemon ntpdate - stat_done - fi - ;; - stop) - stat_busy "Stopping NTP Client" - rm_daemon ntpdate - stat_done - ;; - restart) - $0 stop - $0 start - ;; - *) - echo "usage: $0 {start|stop|restart}" + start) + stat_busy "Starting NTP Client" + if /usr/bin/ntpd -q ${NTP_CLIENT_OPTION} &>/dev/null; then + add_daemon ntpdate + stat_done + else + stat_fail + exit 1 + fi + ;; + stop) + stat_busy "Stopping NTP Client" + rm_daemon ntpdate + stat_done + ;; + restart) + $0 stop + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" esac - |