commit 9ae64ab593bb9555852074514e6190be09ed2884 Author: Jay Larson Date: Thu Jul 26 16:09:32 2018 -0500 First check in diff --git a/CONFIG/etc/ntp.conf b/CONFIG/etc/ntp.conf new file mode 100644 index 0000000..bfe5da2 --- /dev/null +++ b/CONFIG/etc/ntp.conf @@ -0,0 +1,12 @@ +# Time servers +pool 0.pool.ntp.org +pool 1.pool.ntp.org +pool 2.pool.ntp.org +pool 3.pool.ntp.org + +# Localhost (in case network connectivity is lost) +server 127.127.1.0 +fudge 127.127.1.0 stratum 10 + +# Drift file +driftfile /var/lib/ntp/driftfile diff --git a/CONFIG/ntp-4.2.8p10-0.snap b/CONFIG/ntp-4.2.8p10-0.snap new file mode 100644 index 0000000..b2316e4 Binary files /dev/null and b/CONFIG/ntp-4.2.8p10-0.snap differ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..dc8d448 --- /dev/null +++ b/Makefile @@ -0,0 +1,95 @@ +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation here: +# (http://www.gnu.org/licenses/gpl-2.0.html) +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +export ARCH = x86_64 +export DEPENDS = bash,glibc,libcap +export BUILDDEPS = +export SRCPKG = $(PACKAGE) +export URL = http://www.ntp.org/ +REPO = main +BRIEF = NTP daemon and utilities +DESC = NTP is widely used to synchronize a computer to Internet time servers \ +or other sources +SNAPVER = 0 + +ARCHIVE := $(PWD)/SRC/$(shell ls SRC|egrep '(bz2|gz|tar|xz)$$'|tail -1) +TYPE := $(shell file -ib $(ARCHIVE)|cut -d';' -f1|tr -d '\n') +SRCDIR := $(shell tar -tf $(ARCHIVE)|head -1|sed 's/\/.*//') +PATCHDIR := $(PWD)/SRC/patches +export VERSION := $(shell echo $(SRCDIR)|egrep -o '\-[0-9].*'| \ + sed 's/^-//')-$(SNAPVER) + +include /usr/share/snap/Makefile.snaplinux + +DOC := $(PWD)/$(PACKAGE)-doc +DOCROOT := $(DOC)/ROOT + +$(SRCDIR)/configure: $(ARCHIVE) + @if [ '$(TYPE)' == 'application/x-bzip2' ]; then \ + tar -jxf $(ARCHIVE); \ + elif [ '$(TYPE)' == 'application/x-gzip' ]; then \ + tar -zxf $(ARCHIVE); \ + elif [ '$(TYPE)' == 'application/x-tar' ]; then \ + tar -xf $(ARCHIVE); \ + elif [ '$(TYPE)' == 'application/x-xz' ]; then \ + tar -xf $(ARCHIVE); \ + else \ + echo 'Unable to determine archive type'; \ + exit 1; \ + fi + @touch $(SRCDIR)/configure + +$(SRCDIR)/config.log: $(SRCDIR)/configure + @cd $(SRCDIR) && \ + for patch in `find $(PATCHDIR) -name \*.patch|sort`; do \ + patch --verbose -Np1 -i $$patch; \ + done + @cd $(SRCDIR); \ + ./configure CFLAGS="-O2 -g -fPIC" \ + --prefix=/usr \ + --bindir=/usr/sbin \ + --sysconfdir=/etc \ + --enable-linuxcaps \ + --with-lineditlibs=readline \ + --build=x86_64-snap-linux-gnu \ + --host=x86_64-snap-linux-gnu \ + --target=x86_64-snap-linux-gnu + +$(SRCDIR)/ntpd/ntpd: $(SRCDIR)/config.log + @cd $(SRCDIR) && make + +$(ROOT): $(SRCDIR)/ntpd/ntpd + @if [ -d $(ROOT) ]; then \ + touch $(ROOT); \ + else \ + mkdir -v $(ROOT); \ + fi + + @cd $(SRCDIR) && make install DESTDIR=$(ROOT) && \ + install -v -d -m 755 $(ROOT)/etc/init.d && \ + install -v -d -m 755 $(ROOT)/var/lib/ntp && \ + install -v -m 755 $(PWD)/SNAP/ntpd.init $(ROOT)/etc/init.d/ntpd && \ + install -v -d $(DOC)/SNAP && \ + install -v -d $(DOCROOT)/usr/share && \ + mv -v $(ROOT)/usr/share/doc $(DOCROOT)/usr/share/doc && \ + cd $(DOC) && make -f ../Makefile.$(PACKAGE)-doc && mv *.snap ../ + +test: $(ROOT) + @cd $(SRCDIR); \ + make check + +clean: + @rm -rvf $(ROOT) \ + $(DOC) \ + $(SNAPINFO) \ + $(MANIFEST) \ + $(FILES) \ + $(SRCDIR) + diff --git a/Makefile.ntp-doc b/Makefile.ntp-doc new file mode 100644 index 0000000..5cb4631 --- /dev/null +++ b/Makefile.ntp-doc @@ -0,0 +1,16 @@ +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation here: +# (http://www.gnu.org/licenses/gpl-2.0.html) +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +DEPENDS = +REPO = main +BRIEF = HTML documentation for ntp +DESC = HTML documentation for ntp + +include /usr/share/snap/Makefile.snaplinux diff --git a/SNAP/README b/SNAP/README new file mode 100644 index 0000000..cb756b1 --- /dev/null +++ b/SNAP/README @@ -0,0 +1,5 @@ +This is the directory where the manifest, snapinfo, +and files.tar.gz files will be created. It is also +where the usher file should be placed if it is +required by the package. Any other files that need +to be included could also be placed here. diff --git a/SNAP/config.tar.gz b/SNAP/config.tar.gz new file mode 100644 index 0000000..add28bf Binary files /dev/null and b/SNAP/config.tar.gz differ diff --git a/SNAP/ntpd.init b/SNAP/ntpd.init new file mode 100755 index 0000000..e8b9f27 --- /dev/null +++ b/SNAP/ntpd.init @@ -0,0 +1,59 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: ntp +# Required-Start: $network $syslog +# Required-Stop: $network $syslog +# Should-Start: +# Should-Stop: +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Short-Description: NTP Daemon +### END INIT INFO + +. /lib/lsb/init-functions + +DAEMON=/usr/sbin/ntpd +PIDFILE=/var/run/ntpd.pid + +case "$1" in + start) + log_init_msg "Starting NTP server" + start_daemon -p "$PIDFILE" "$DAEMON" "-p $PIDFILE -g -u 87:87" \ + && log_success_msg || log_failure_msg + ;; + stop) + pid=$(pidofproc -p "$PIDFILE" "$DAEMON") + + if [ "$?" -ne 0 ]; then + log_init_msg "NTP server not running" && log_success_msg + exit 0 + fi + + log_init_msg "Stopping NTP server" + + killproc -p "$PIDFILE" "$DAEMON" -TERM && log_success_msg \ + || log_failure_msg + ;; + reload|restart) + log_init_msg "Restarting NTP server" + + killproc -p "$PIDFILE" "$DAEMON" -HUP && log_success_msg \ + || log_failure_msg + ;; + status) + pid=$(pidofproc -p "$PIDFILE" "$DAEMON") + + if [ "$?" -ne 0 ]; then + echo "NTP server not running" + else + echo "NTP server running with PID: $pid" + /usr/sbin/ntpq -pn + fi + ;; + *) + echo "Usage: $0 [start|stop|reload|restart|status]" + exit 1 + ;; +esac + +exit 0 diff --git a/SNAP/usher b/SNAP/usher new file mode 100755 index 0000000..b997de3 --- /dev/null +++ b/SNAP/usher @@ -0,0 +1,34 @@ +#!/bin/bash + +set -e + +case $1 in + preinst) + exit 0 + ;; + postinst) + if ! getent group ntp 2>&1 > /dev/null; then + if groupadd -g 87 ntp; then + echo 'Created group ntp' + else + echo 'Failed to create group ntp!' + exit 1 + fi + fi + if ! getent passwd ntp 2>&1 > /dev/null; then + if useradd -c "NTP service" -d /var/lib/ntp -g ntp \ + -s /bin/false -u 87 ntp; then + echo 'Created user ntp' + else + echo 'Failed to create user ntp!' + exit 1 + fi + fi + ;; + prerm) + exit 0 + ;; + postrm) + exit 0 + ;; +esac diff --git a/SRC/ntp-4.2.8p10.tar.gz b/SRC/ntp-4.2.8p10.tar.gz new file mode 100644 index 0000000..d0c17e9 Binary files /dev/null and b/SRC/ntp-4.2.8p10.tar.gz differ diff --git a/SRC/ntp-4.2.8p10.tar.gz.md5 b/SRC/ntp-4.2.8p10.tar.gz.md5 new file mode 100644 index 0000000..6006109 --- /dev/null +++ b/SRC/ntp-4.2.8p10.tar.gz.md5 @@ -0,0 +1 @@ +745384ed0dedb3f66b33fe84d66466f9 ntp-4.2.8p10.tar.gz diff --git a/SRC/patches/README b/SRC/patches/README new file mode 100644 index 0000000..976577a --- /dev/null +++ b/SRC/patches/README @@ -0,0 +1,3 @@ +Place any patch files here and preface each with a +number indicating the order of execution. Patch +files are expected to use a .patch extension.