www.nico.schottelius.org/software/cinit/browse_source/cinit-0.3pre1/bin/cinit.install.service.ntpdate.debian

48 lines
980 B
Text
Raw Normal View History

#!/bin/sh
# Nico Schottelius
# cinit: install ntpdate
# Date: 2005-10-15
#
. $(dirname $0)/cinit.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