summaryrefslogtreecommitdiffstats
path: root/debian/freeradius.postinst
diff options
context:
space:
mode:
Diffstat (limited to 'debian/freeradius.postinst')
-rw-r--r--debian/freeradius.postinst69
1 files changed, 69 insertions, 0 deletions
diff --git a/debian/freeradius.postinst b/debian/freeradius.postinst
new file mode 100644
index 0000000..b1f853f
--- /dev/null
+++ b/debian/freeradius.postinst
@@ -0,0 +1,69 @@
+#!/bin/sh
+# vim:ts=2:sw=2:et
+
+set -e
+
+case "$1" in
+ configure)
+ if [ -z "$2" ]; then
+ # Changed in 1.1.5-1 for new installs (we used to start at S50
+ # and stop at K50) We now start at S50 and stop at K19 so we
+ # start after services which may be used and stop before them.
+ update-rc.d freeradius start 50 2 3 4 5 . stop 19 0 1 6 . >/dev/null
+
+ for file in radius.log radwtmp; do
+ [ ! -f "/var/log/freeradius/${file}" ] && install -o freerad -g freerad -m 644 /dev/null /var/log/freeradius/${file}
+ done
+
+ action="start"
+ else
+ action="restart"
+ fi
+
+ if [ -z "$2" ]; then
+ # Set up initial permissions on all the freeradius directories
+ chown -R freerad:adm /var/log/freeradius
+ chown -R freerad:freerad /etc/freeradius
+ chmod 2750 /etc/freeradius
+ find /etc/freeradius -type f -exec chmod 640 '{}' \;
+ fi
+
+ if dpkg --compare-versions "$2" lt 3.0.16+dfsg-3; then
+ chmod 2750 /etc/freeradius
+ fi
+
+ # Create links for default sites, but only if this is an initial
+ # install or an upgrade from before there were links; users may
+ # want to remove them...
+ if [ -z "$2" ]; then
+ for site in default inner-tunnel; do
+ if test ! -h /etc/freeradius/3.0/sites-enabled/$site && \
+ test ! -e /etc/freeradius/3.0/sites-enabled/$site; then
+ ln -s ../sites-available/$site /etc/freeradius/3.0/sites-enabled/$site
+ fi
+ done
+ fi
+
+ invoke-rc.d freeradius $action || true
+ ;;
+
+ abort-upgrade)
+ invoke-rc.d freeradius restart || true
+ ;;
+
+ abort-remove)
+ invoke-rc.d freeradius start || true
+ ;;
+esac
+
+#DEBHELPER#
+
+case "$1" in
+ configure)
+ # After removing conffiles (in the DEBHELPER part above), delete all
+ # directories underneath /etc/freeradius which are now empty.
+ find /etc/freeradius -type d -empty -delete
+ ;;
+esac
+
+exit 0