wok-current rev 1751

ntp: add /etc/init.d/ntp
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Nov 23 14:27:12 2008 +0000 (2008-11-23)
parents 2d03cdc832cb
children 5cca1d5310fc
files ntp/receipt ntp/stuff/ntp
line diff
     1.1 --- a/ntp/receipt	Sun Nov 23 12:23:06 2008 +0000
     1.2 +++ b/ntp/receipt	Sun Nov 23 14:27:12 2008 +0000
     1.3 @@ -8,6 +8,8 @@
     1.4  TARBALL="$PACKAGE-$VERSION.tar.gz"
     1.5  WEB_SITE="http://www.ntp.org/"
     1.6  WGET_URL="http://archive.ntp.org/ntp4/$TARBALL"
     1.7 +DEPENDS="libcrypto"
     1.8 +CONFIG_FILES="/etc/ntp.conf"
     1.9  
    1.10  # Rules to configure and make the package.
    1.11  compile_rules()
    1.12 @@ -22,7 +24,11 @@
    1.13  # Rules to gen a SliTaz package suitable for Tazpkg.
    1.14  genpkg_rules()
    1.15  {
    1.16 -	mkdir -p $fs/usr
    1.17 -	cp -a $_pkg/usr/bin $fs
    1.18 +	mkdir -p $fs/usr $fs/etc/init.d
    1.19 +	cp -a $_pkg/usr/bin $fs/usr
    1.20 +	cp stuff/ntp $fs/etc/init.d
    1.21 +	cat > $fs/etc/ntp.conf <<EOT
    1.22 +server fr.pool.ntp.org
    1.23 +EOT
    1.24  }
    1.25  
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/ntp/stuff/ntp	Sun Nov 23 14:27:12 2008 +0000
     2.3 @@ -0,0 +1,57 @@
     2.4 +#!/bin/sh
     2.5 +# /etc/init.d/ntp : Start, stop and restart ntp server on SliTaz, at 
     2.6 +# boot time or with the command line.
     2.7 +#
     2.8 +# To start ntp server at boot time, just put ntp in the $RUN_DAEMONS
     2.9 +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf
    2.10 +#
    2.11 +. /etc/init.d/rc.functions
    2.12 +. /etc/daemons.conf
    2.13 +
    2.14 +NAME=ntp
    2.15 +DESC="ntp server"
    2.16 +DAEMON=/usr/bin/ntpd
    2.17 +OPTIONS=$NTP_OPTIONS
    2.18 +PIDFILE=/var/run/ntpd.pid
    2.19 +[ -n "$OPTIONS" ] || OPTIONS="-p $PIDFILE -c /etc/ntp.conf"
    2.20 + 
    2.21 +
    2.22 +case "$1" in
    2.23 +  start)
    2.24 +    if [ -f $PIDFILE ] ; then
    2.25 +      echo "$NAME already running."
    2.26 +      exit 1
    2.27 +    fi
    2.28 +    echo -n "Starting $DESC: $NAME... "
    2.29 +    $DAEMON $OPTIONS
    2.30 +    status
    2.31 +    ;;
    2.32 +  stop)
    2.33 +    if [ ! -f $PIDFILE ] ; then
    2.34 +      echo "$NAME is not running."
    2.35 +      exit 1
    2.36 +    fi
    2.37 +    echo -n "Stopping $DESC: $NAME... "
    2.38 +    kill `cat $PIDFILE`
    2.39 +    rm $PIDFILE
    2.40 +    status
    2.41 +    ;;
    2.42 +  restart)
    2.43 +    if [ ! -f $PIDFILE ] ; then
    2.44 +      echo "$NAME is not running."
    2.45 +      exit 1
    2.46 +    fi
    2.47 +    echo -n "Restarting $DESC: $NAME... "
    2.48 +    kill `cat $PIDFILE`
    2.49 +    $DAEMON $OPTIONS
    2.50 +    status
    2.51 +    ;;
    2.52 +  *)
    2.53 +    echo ""
    2.54 +    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    2.55 +    echo ""
    2.56 +    exit 1
    2.57 +    ;;
    2.58 +esac
    2.59 +
    2.60 +exit 0