# HG changeset patch # User Pascal Bellard # Date 1470252824 -7200 # Node ID 57fe5697320040b7b367c21213e888923f0c9b0a # Parent b5362b1abeb705110750a68acfc653a6e5807dec freeradius: add init script diff -r b5362b1abeb7 -r 57fe56973200 freeradius/receipt --- a/freeradius/receipt Wed Aug 03 14:21:25 2016 +0200 +++ b/freeradius/receipt Wed Aug 03 21:33:44 2016 +0200 @@ -10,6 +10,7 @@ TARBALL="$SOURCE-$VERSION.tar.gz" WEB_SITE="http://www.freeradius.org/" WGET_URL="ftp://ftp.freeradius.org/pub/freeradius/$TARBALL" +CONFIG_FILES="/etc/raddb" DEPENDS="libssl cyrus-sasl libldap libltdl python readline libunixODBC \ libkrb5 libcomerr3 libmysqlclient gdbm" @@ -19,7 +20,6 @@ # Rules to configure and make the package. compile_rules() { - cd $src export CFLAGS="$CFLAGS -fno-strict-aliasing" ./configure --sysconfdir=/etc \ --localstatedir=/var \ @@ -33,7 +33,7 @@ # Rules to gen a SliTaz package suitable for Tazpkg. genpkg_rules() { - mkdir -p $fs/usr/lib $fs/usr/share + mkdir -p $fs/usr/lib $fs/usr/share $fs/etc/init.d $fs/var/run/radiusd cp -a $install/usr/bin $fs/usr cp -a $install/usr/sbin $fs/usr @@ -42,4 +42,5 @@ cp -a $install/etc $fs cp -a $install/var $fs rm -f $fs/usr/lib/rlm_pam* $fs/etc/raddb/modules/pam + cp -a $stuff/freeradius $fs/etc/init.d/ } diff -r b5362b1abeb7 -r 57fe56973200 freeradius/stuff/freeradius --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/freeradius/stuff/freeradius Wed Aug 03 21:33:44 2016 +0200 @@ -0,0 +1,56 @@ +#!/bin/sh +# /etc/init.d/freeradius : Start, stop and restart freeradius server on SliTaz, at +# boot time or with the command line. +# +# To start freeradius server at boot time, just put freeradius in the $RUN_DAEMONS +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf +# +. /etc/init.d/rc.functions +. /etc/daemons.conf + +NAME=freeradius +DESC="freeradius server" +DAEMON=/usr/sbin/radiusd +OPTIONS=$FREERADIUS_OPTIONS +PIDFILE=/var/run/radiusd/radiusd.pid +[ -n "$OPTIONS" ] || OPTIONS="-d /etc/raddb -i 0.0.0.0 -p 1812" + +case "$1" in + start) + if active_pidfile $PIDFILE radiusd ; then + echo "$NAME already running." + exit 1 + fi + echo -n "Starting $DESC: $NAME... " + $DAEMON $OPTIONS + status + ;; + stop) + if ! active_pidfile $PIDFILE radiusd ; then + echo "$NAME is not running." + exit 1 + fi + echo -n "Stopping $DESC: $NAME... " + kill $(cat $PIDFILE) + status + ;; + restart) + if ! active_pidfile $PIDFILE radiusd ; then + echo "$NAME is not running." + exit 1 + fi + echo -n "Restarting $DESC: $NAME... " + kill $(cat $PIDFILE) + sleep 2 + $DAEMON $OPTIONS + status + ;; + *) + echo "" + echo -e "\033[1mUsage:\033[0m /etc/init.d/$(basename $0) [start|stop|restart]" + echo "" + exit 1 + ;; +esac + +exit 0