www.nico.schottelius.org/software/cinit/browse_source/cinit-0.3pre10/bin/cinit.install.service.ntpdate.debian
Nico Schottelius 423ba10303 import cinit from unix.schottelius.org
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-09-16 12:53:45 +02:00

47 lines
980 B
Bash

#!/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