summaryrefslogtreecommitdiffstats
path: root/unstable/freeradius
diff options
context:
space:
mode:
authorMichael Mason <ms13sp@gmail.com>2009-03-25 21:33:44 +0000
committerMichael Mason <ms13sp@gmail.com>2009-03-25 21:33:44 +0000
commitc8ead0c73cd6aa35d30e741b2ca7b64a70f76051 (patch)
treecc030dc3ba684b8bb42fca428c9e49c7e79636e5 /unstable/freeradius
parentca786c40b993ab33f43b65b4bf5644b6ea2b3643 (diff)
downloadaports-c8ead0c73cd6aa35d30e741b2ca7b64a70f76051.tar.bz2
aports-c8ead0c73cd6aa35d30e741b2ca7b64a70f76051.tar.xz
unstable/freeradius Initial commit
Diffstat (limited to 'unstable/freeradius')
-rw-r--r--unstable/freeradius/freeradius.confd5
-rw-r--r--unstable/freeradius/freeradius.initd69
-rw-r--r--unstable/freeradius/freeradius.pre-install3
3 files changed, 77 insertions, 0 deletions
diff --git a/unstable/freeradius/freeradius.confd b/unstable/freeradius/freeradius.confd
new file mode 100644
index 00000000..9811289b
--- /dev/null
+++ b/unstable/freeradius/freeradius.confd
@@ -0,0 +1,5 @@
+# Config file for /etc/init.d/radiusd
+
+# see man pages for radiusd run `radiusd -h`
+# for valid cmdline options
+#RADIUSD_OPTS=""
diff --git a/unstable/freeradius/freeradius.initd b/unstable/freeradius/freeradius.initd
new file mode 100644
index 00000000..31ca4bfa
--- /dev/null
+++ b/unstable/freeradius/freeradius.initd
@@ -0,0 +1,69 @@
+#!/sbin/runscript
+
+opts="${opts} reload"
+
+depend() {
+ need net
+ use dns
+}
+
+checkconfig() {
+ #set the location of log files, including startup.log created by check-radiusd-config
+ if ! cd /var/log/radius ; then
+ eerror "Failed to change current directory to /var/log/radius"
+ return 1
+ fi
+
+ if [ ! -d /var/run/radiusd ] && ! mkdir /var/run/radiusd ; then
+ eerror "Failed to create /var/run/radiusd"
+ return 1
+ fi
+
+ if [ ! -f /etc/raddb/radiusd.conf ] ; then
+ eerror "No /etc/raddb/radiusd.conf file exists!"
+ return 1
+ fi
+
+ if [ "`/usr/sbin/check-radiusd-config >/dev/null 2>&1; echo $?`" != "0" ] ; then
+ eerror "Config not ok! (try /usr/sbin/check-radiusd-config )"
+ return 1
+ fi
+
+ RADIUSD_USER=`grep '^ *user *=' /etc/raddb/radiusd.conf | cut -d ' ' -f 3`
+ RADIUSD_GROUP=`grep '^ *group *=' /etc/raddb/radiusd.conf | cut -d ' ' -f 3`
+ if [ -n "${RADIUSD_USER}" ] && ! getent passwd ${RADIUSD_USER} > /dev/null ; then
+ eerror "${RADIUSD_USER} user missing!"
+ return 1
+ fi
+ if [ -n "${RADIUSD_GROUP}" ] && ! getent group ${RADIUSD_GROUP} > /dev/null ; then
+ eerror "${RADIUSD_GROUP} group missing!"
+ return 1
+ fi
+
+ #radius.log is created before privileges drop; we need to set proper permissions on it
+ [ -f radius.log ] || touch radius.log || return 1
+
+ chown -R "${RADIUSD_USER:-root}:${RADIUSD_GROUP:-root}" . /var/run/radiusd && \
+ chmod -R u+rwX,g+rX . /var/run/radiusd || return 1
+}
+
+start() {
+ checkconfig || return 1
+
+ ebegin "Starting radiusd"
+ start-stop-daemon --start --quiet --exec /usr/sbin/radiusd -- ${RADIUSD_OPTS} >/dev/null
+ eend $?
+}
+
+stop () {
+ ebegin "Stopping radiusd"
+ start-stop-daemon --stop --quiet --pidfile=/var/run/radiusd/radiusd.pid
+ eend $?
+}
+
+reload () {
+ ebegin "Reloading radiusd"
+ kill -HUP `</var/run/radiusd/radiusd.pid`
+ eend $?
+}
+
diff --git a/unstable/freeradius/freeradius.pre-install b/unstable/freeradius/freeradius.pre-install
new file mode 100644
index 00000000..87502274
--- /dev/null
+++ b/unstable/freeradius/freeradius.pre-install
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+adduser -h /var/log/radius -s /bin/false -D radiusd 2>/dev/null