www.nico.schottelius.org/software/cinit/browse_source/cinit-0.3pre17/bin/cinit.svc.linux.debian.ntpdate
Nico Schottelius 759b58c293 released cinit-0.3pre17
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-10-05 19:14:52 +02:00

47 lines
987 B
Bash
Executable file

#!/bin/sh
# Nico Schottelius
# cinit: install ntpdate
# Date: 2005-10-15
#
. "$(dirname $0)/cinit-conf.read-conf"
set -e
if [ $# -ne 0 ]; then
echo "$(basename $0) (no args)"
exit 1
fi
. /etc/default/ntpdate
if [ -z "$NTPSERVERS" ]; then
echo "No ntp servers found, aborting"
exit 1
fi
BINARY_PATH=$($(dirname $0)/cinit.path-find ntpdate)
if [ $? -ne 0 ]; then
echo "Did not find binary ntpdate."
exit 1
fi
if [ -d "${DESTDIR}/${CINIT_DIR}/local-tuning/ntpdate" ]; then
echo "Service ntpdate already exists."
exit 1
fi
echo -n "Installing ntpdate to ${DESTDIR}/${CINIT_DIR}/local-tuning/ntpdate ..."
"$INSTALL_PROG" "$INSTALL_DIRECTORY" \
"${DESTDIR}/${CINIT_DIR}/local-tuning/ntpdate"
ln -sf "$BINARY_PATH" "${DESTDIR}/${CINIT_DIR}/local-tuning/ntpdate/$C_ON"
for server in $NTPSERVERS; do
echo "$server" >> "${DESTDIR}/${CINIT_DIR}/local-tuning/ntpdate/$C_ON$C_PARAMS"
done
echo "finished."
exit 0