wok rev 19366

freeradius: add init script
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Aug 03 21:33:44 2016 +0200 (2016-08-03)
parents b5362b1abeb7
children 07880f53b26e
files freeradius/receipt freeradius/stuff/freeradius
line diff
     1.1 --- a/freeradius/receipt	Wed Aug 03 14:21:25 2016 +0200
     1.2 +++ b/freeradius/receipt	Wed Aug 03 21:33:44 2016 +0200
     1.3 @@ -10,6 +10,7 @@
     1.4  TARBALL="$SOURCE-$VERSION.tar.gz"
     1.5  WEB_SITE="http://www.freeradius.org/"
     1.6  WGET_URL="ftp://ftp.freeradius.org/pub/freeradius/$TARBALL"
     1.7 +CONFIG_FILES="/etc/raddb"
     1.8  
     1.9  DEPENDS="libssl cyrus-sasl libldap libltdl python readline libunixODBC \
    1.10  libkrb5 libcomerr3 libmysqlclient gdbm"
    1.11 @@ -19,7 +20,6 @@
    1.12  # Rules to configure and make the package.
    1.13  compile_rules()
    1.14  {
    1.15 -	cd $src
    1.16  	export CFLAGS="$CFLAGS -fno-strict-aliasing"
    1.17  	./configure --sysconfdir=/etc \
    1.18  		--localstatedir=/var \
    1.19 @@ -33,7 +33,7 @@
    1.20  # Rules to gen a SliTaz package suitable for Tazpkg.
    1.21  genpkg_rules()
    1.22  {
    1.23 -	mkdir -p $fs/usr/lib $fs/usr/share
    1.24 +	mkdir -p $fs/usr/lib $fs/usr/share $fs/etc/init.d $fs/var/run/radiusd
    1.25  
    1.26  	cp -a $install/usr/bin $fs/usr
    1.27  	cp -a $install/usr/sbin $fs/usr
    1.28 @@ -42,4 +42,5 @@
    1.29  	cp -a $install/etc $fs
    1.30  	cp -a $install/var $fs
    1.31  	rm -f $fs/usr/lib/rlm_pam* $fs/etc/raddb/modules/pam
    1.32 +	cp -a $stuff/freeradius $fs/etc/init.d/
    1.33  }
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/freeradius/stuff/freeradius	Wed Aug 03 21:33:44 2016 +0200
     2.3 @@ -0,0 +1,56 @@
     2.4 +#!/bin/sh
     2.5 +# /etc/init.d/freeradius : Start, stop and restart freeradius server on SliTaz, at 
     2.6 +# boot time or with the command line.
     2.7 +#
     2.8 +# To start freeradius server at boot time, just put freeradius 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=freeradius
    2.15 +DESC="freeradius server"
    2.16 +DAEMON=/usr/sbin/radiusd
    2.17 +OPTIONS=$FREERADIUS_OPTIONS
    2.18 +PIDFILE=/var/run/radiusd/radiusd.pid
    2.19 +[ -n "$OPTIONS" ] || OPTIONS="-d /etc/raddb -i 0.0.0.0 -p 1812"
    2.20 +
    2.21 +case "$1" in
    2.22 +  start)
    2.23 +    if active_pidfile $PIDFILE radiusd ; then
    2.24 +      echo "$NAME already running."
    2.25 +      exit 1
    2.26 +    fi
    2.27 +    echo -n "Starting $DESC: $NAME... "
    2.28 +    $DAEMON $OPTIONS
    2.29 +    status
    2.30 +    ;;
    2.31 +  stop)
    2.32 +    if ! active_pidfile $PIDFILE radiusd ; then
    2.33 +      echo "$NAME is not running."
    2.34 +      exit 1
    2.35 +    fi
    2.36 +    echo -n "Stopping $DESC: $NAME... "
    2.37 +    kill $(cat $PIDFILE)
    2.38 +    status
    2.39 +    ;;
    2.40 +  restart)
    2.41 +    if ! active_pidfile $PIDFILE radiusd ; then
    2.42 +      echo "$NAME is not running."
    2.43 +      exit 1
    2.44 +    fi
    2.45 +    echo -n "Restarting $DESC: $NAME... "
    2.46 +    kill $(cat $PIDFILE)
    2.47 +    sleep 2
    2.48 +    $DAEMON $OPTIONS
    2.49 +    status
    2.50 +    ;;
    2.51 +  *)
    2.52 +    echo ""
    2.53 +    echo -e "\033[1mUsage:\033[0m /etc/init.d/$(basename $0) [start|stop|restart]"
    2.54 +    echo ""
    2.55 +    exit 1
    2.56 +    ;;
    2.57 +esac
    2.58 +
    2.59 +exit 0