aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2020-02-14 16:46:34 +0100
committerJakub Jirutka <jakub@jirutka.cz>2020-02-14 16:52:17 +0100
commitae11feb6de2fb98c584b9716d91ef4461168cc35 (patch)
treeef1175489910eafee6b235ed32d64910a717648c
parentf5a34691b8c45e75d1fe686865960b357d652b7a (diff)
downloadaports-ae11feb6de2fb98c584b9716d91ef4461168cc35.tar.bz2
aports-ae11feb6de2fb98c584b9716d91ef4461168cc35.tar.xz
main/freeradius: rewrite init script
It's RC/init system's job to daemonize process, processes shouldn't do it themself. Also it's required for using OpenRC's daemon supervisor.
-rw-r--r--main/freeradius/APKBUILD14
-rw-r--r--main/freeradius/default-config.patch19
-rw-r--r--main/freeradius/freeradius.confd5
-rw-r--r--main/freeradius/freeradius.initd27
-rw-r--r--main/freeradius/radiusd.confd9
-rw-r--r--main/freeradius/radiusd.initd43
6 files changed, 78 insertions, 39 deletions
diff --git a/main/freeradius/APKBUILD b/main/freeradius/APKBUILD
index b6e6adc718..9d9e3e7860 100644
--- a/main/freeradius/APKBUILD
+++ b/main/freeradius/APKBUILD
@@ -65,8 +65,8 @@ subpackages="
"
provides="freeradius3=$pkgver-r$pkgrel"
source="ftp://ftp.freeradius.org/pub/freeradius/$pkgname-server-$pkgver.tar.gz
- $pkgname.confd
- $pkgname.initd
+ radiusd.confd
+ radiusd.initd
setup-freeradius.in
print-var.mk
@@ -156,8 +156,8 @@ package() {
chown -R root:radius "$pkgdir"/etc/raddb/*
- install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/radiusd
- install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/radiusd
+ install -m755 -D "$srcdir"/radiusd.initd "$pkgdir"/etc/init.d/radiusd
+ install -m644 -D "$srcdir"/radiusd.confd "$pkgdir"/etc/conf.d/radiusd
install -m755 -D setup-freeradius "$pkgdir"/usr/sbin/setup-freeradius
# Install misses to create this
@@ -367,13 +367,13 @@ _mvdb() {
}
sha512sums="513ed0a5d9e6b9a8d89a9b02c86ff528a9ff14d928f4c1040ca44702465abd711588fe6afa35554cb2c8e8bd7f19dd5be3dbc78445c62c7b00bf5cbc4c621312 freeradius-server-3.0.20.tar.gz
-e248159c0a44f722e405c51c8015d9ad672e42ad0d38ca28f8a051ff911aa4d3e630b9bd4543e9d610940bc4ae50c022594e219ce341b36abe85c572acad418b freeradius.confd
-ba3c424d4eabb147c7aa3e31575a87ddb26b6a792d2a8714e73d8763e07854326a03a83991a7420246ca06bf0b93d0a6f23ec198f5e48647f9d25b40067e852a freeradius.initd
+bb3df1fa2c9ed95514ae090e0f6619c4e3280f424c4351bc79f5254bf1a327fa7d27e5fe3add5ab8d9e5ba3792c9553bd9a0481fe9c5bc34945ce46627ef2638 radiusd.confd
+a66ab5d3f1c86450e9c50aa8be10a40fb4118467670048773ad8c80b5f3fb958dd3addc6ef245289d93ce2b184ce2c9882a8a2585d4a134d55c2326c9559f558 radiusd.initd
51f47db8dce93c4c4984093e8256bd0fb4d9c511fbbce610ef72478d8b216fb828fee3f70ae124d44c2a60b35d7792d05602480826845bb5bd4847ef6f745d84 setup-freeradius.in
5f940e200aa39b2fbbfaf5b24f2ad99869fa75bb7e2008876940ea96cb9dbc7f2b27dd1672aa56cdb5243faabdcbc38875594dd8792af965987183c0aa2aefd1 print-var.mk
c49e5eec7497fccde5fd09dba1ea9b846e57bc88015bd81640aa531fb5c9b449f37136f42c85fe1d7940c5963aed664b85da28442b388c9fb8cc27873df03b2d musl-fix-headers.patch
41d478c0e40ff82fc36232964037c1ab8ffca9fdbb7dca02ed49319906e751c133b5d7bc7773c645cec6d9d39d1de69cba25e8d59afa8d6662563dd17f35f234 fix-scopeid.patch
-14fdb7176a6e76bb078f71ae494da4f675bcdd4a90cac7ac17cc34fab5107b1faef7b37c5551917e9fb81ab26fb4e2186e23766ac2bba06db911d4b3cd7fad0b default-config.patch
+21b0613cfb4af600839bf9d5a348481ff5556a5df6c8c4a1b25bce5e2dfd16cf49198516ee6900c4160fb9b4e9fa63086245f88bf3ba99abea32920f458ad798 default-config.patch
096b7a89bf55da02055a5e41517b4240f74bed85b9487b5a3109b2a9e0974c5d741cd2d5ee704c1b4f2f897667e5a4543da259e407e4c6ea029164d1d8995b2e remove-eap-from-default-mods.patch
f88cb4ae335d67211c8563b6df88e20ee3729e57aa56423f99b518f83b190479b38bb189a0ab53c70ef9709a6229ccaa506ea6b79844cbfd4f2a7f0c7c292045 Fix-permissions-of-certs-in-bootstrap-fallback.patch
7ddf75901f635216b0d972c14631334a8138e0dbb021685bb6b3a996f38d232b84146c621dae541b00f6149fa401e835d1579bbacd27fad72a80bacd4391b404 fix-request_running-segfault.patch"
diff --git a/main/freeradius/default-config.patch b/main/freeradius/default-config.patch
index 879722670d..9de583dabd 100644
--- a/main/freeradius/default-config.patch
+++ b/main/freeradius/default-config.patch
@@ -13,6 +13,25 @@
#
# libdir: Where to find the rlm_* modules.
+@@ -137,18 +136,7 @@
+ #
+ libdir = @libdir@
+
+-# pidfile: Where to place the PID of the RADIUS server.
+ #
+-# The server may be signalled while it's running by using this
+-# file.
+-#
+-# This file is written when ONLY running in daemon mode.
+-#
+-# e.g.: kill -HUP `cat /var/run/radiusd/radiusd.pid`
+-#
+-pidfile = ${run_dir}/${name}.pid
+-
+-#
+ # correct_escapes: use correct backslash escaping
+ #
+ # Prior to version 3.0.5, the handling of backslashes was a little
@@ -501,8 +500,8 @@
# member. This can allow for some finer-grained access
# controls.
diff --git a/main/freeradius/freeradius.confd b/main/freeradius/freeradius.confd
deleted file mode 100644
index 9811289ba4..0000000000
--- a/main/freeradius/freeradius.confd
+++ /dev/null
@@ -1,5 +0,0 @@
-# Config file for /etc/init.d/radiusd
-
-# see man pages for radiusd run `radiusd -h`
-# for valid cmdline options
-#RADIUSD_OPTS=""
diff --git a/main/freeradius/freeradius.initd b/main/freeradius/freeradius.initd
deleted file mode 100644
index 5412d2b31c..0000000000
--- a/main/freeradius/freeradius.initd
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/sbin/openrc-run
-
-extra_started_commands="reload"
-run_dir="/var/run/radiusd"
-command="/usr/sbin/radiusd"
-command_args="$RADIUSD_OPTS"
-pidfile="$run_dir/radiusd.pid"
-name="Freeradius"
-conf="/etc/raddb/radiusd.conf"
-user="$(grep -v '#' $conf | grep 'user =' | awk -F " = " '{ print $2 }')"
-group="$(grep -v '#' $conf |grep 'group =' | awk -F " = " '{ print $2 }')"
-
-depend() {
- need net
- after firewall
- use dns
-}
-
-start_pre() {
- checkpath --directory --owner ${user}:${group} --mode 0775 ${run_dir}
-}
-
-reload () {
- ebegin "Reloading $name"
- kill -HUP `cat $pidfile`
- eend $?
-}
diff --git a/main/freeradius/radiusd.confd b/main/freeradius/radiusd.confd
new file mode 100644
index 0000000000..48b5f73ebb
--- /dev/null
+++ b/main/freeradius/radiusd.confd
@@ -0,0 +1,9 @@
+# Configuration for /etc/init.d/radiusd
+
+# Path of the main configuration file.
+# This variable sets -d <raddb> and -n <name> options.
+#cfgfile="/etc/raddb/radiusd.conf"
+
+# Additional options for radiusd.
+# Run `radius -h` to see valid options.
+#command_args=
diff --git a/main/freeradius/radiusd.initd b/main/freeradius/radiusd.initd
new file mode 100644
index 0000000000..5e3a0b4e34
--- /dev/null
+++ b/main/freeradius/radiusd.initd
@@ -0,0 +1,43 @@
+#!/sbin/openrc-run
+
+name="FreeRADIUS"
+description_checkconfig="Check configuration"
+description_reload="Reload configuration"
+
+extra_commands="checkconfig"
+extra_started_commands="reload"
+
+: ${cfgfile:="/etc/raddb/radiusd.conf"}
+cfgname="${cfgfile##*/}"
+
+command="/usr/sbin/radiusd"
+# RADIUSD_OPTS is for backward compatibility only
+command_args="-f -d ${cfgfile%/*} -n ${cfgname%.conf} ${command_args:-$RADIUSD_OPTS}"
+command_background="yes"
+pidfile="/run/$RC_SVCNAME.pid"
+
+required_files="$cfgfile"
+
+depend() {
+ need net
+ after firewall
+ use dns
+}
+
+start_pre() {
+ # XXX: Is this still needed?
+ checkpath -d -m 0755 -o radius:radius /run/radiusd
+ checkconfig
+}
+
+checkconfig() {
+ ebegin "Checking $name configuration"
+ $command $command_args -C || $command $command_args -Cx -lstdout
+ eend $?
+}
+
+reload () {
+ ebegin "Reloading $name"
+ start-stop-daemon --signal HUP --pidfile "$pidfile"
+ eend $?
+}