First check in

This commit is contained in:
2018-07-26 16:09:32 -05:00
commit 9ae64ab593
11 changed files with 225 additions and 0 deletions

5
SNAP/README Normal file
View File

@@ -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.

BIN
SNAP/config.tar.gz Normal file

Binary file not shown.

59
SNAP/ntpd.init Executable file
View File

@@ -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

34
SNAP/usher Executable file
View File

@@ -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