From 12e90ce989a44888c1e5f8726a83c8d764dfb881 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 22 Sep 2015 04:23:20 +0000 Subject: [PATCH] Use systemd RuntimeDirectory for /run/freeswitch This changes how we create the temporary directory /run/freeswitch when starting FS with systemd. The /run directory starts empty after a system reboot, so we need to ensure this directory is present. Originally for the FS systemd unit we created /run/freeswitch using ExecStartPre and mkdir. With commit adb5f0d this was changed to use the tmpfiles.d(5) mechanism (but the ExecStartPre/mkdir code was not removed). As part of systemd.exec(5), systemd provides a mechanism to automatically manage these directories under /run and to bind their lifetime to the lifetime of the process. This is actually what we want here as compared to the more general tmpfiles.d(5) mechanism. This commit moves to using the RuntimeDirectory= mechanism and removes the obsolete ExecStartPre/mkdir code. References-commit: adb5f0d278bae7ccda1d1807f094876a4671f94d --- debian/freeswitch-systemd.freeswitch.conf | 1 - debian/freeswitch-systemd.freeswitch.service | 4 ++-- debian/freeswitch-systemd.install | 1 - debian/rules | 4 ---- 4 files changed, 2 insertions(+), 8 deletions(-) delete mode 100644 debian/freeswitch-systemd.freeswitch.conf diff --git a/debian/freeswitch-systemd.freeswitch.conf b/debian/freeswitch-systemd.freeswitch.conf deleted file mode 100644 index 77dfd6908c..0000000000 --- a/debian/freeswitch-systemd.freeswitch.conf +++ /dev/null @@ -1 +0,0 @@ -d /run/freeswitch 0755 freeswitch freeswitch - diff --git a/debian/freeswitch-systemd.freeswitch.service b/debian/freeswitch-systemd.freeswitch.service index 3ddae52112..ac24c49a3e 100644 --- a/debian/freeswitch-systemd.freeswitch.service +++ b/debian/freeswitch-systemd.freeswitch.service @@ -9,13 +9,13 @@ After=syslog.target network.target local-fs.target Type=forking PIDFile=/run/freeswitch/freeswitch.pid PermissionsStartOnly=true -ExecStartPre=/bin/mkdir -p /run/freeswitch -ExecStartPre=/bin/chown freeswitch:freeswitch /run/freeswitch ExecStartPre=/bin/chown freeswitch:freeswitch /etc/freeswitch/tls ExecStart=/usr/bin/freeswitch -ncwait -nonat TimeoutSec=45s Restart=always ; exec +RuntimeDirectory=freeswitch +RuntimeDirectoryMode=0755 WorkingDirectory=/var/log/freeswitch User=freeswitch Group=freeswitch diff --git a/debian/freeswitch-systemd.install b/debian/freeswitch-systemd.install index b554d1b2bd..d647282ecd 100644 --- a/debian/freeswitch-systemd.install +++ b/debian/freeswitch-systemd.install @@ -1,2 +1 @@ /lib/systemd/system/freeswitch.service -/usr/lib/tmpfiles.d/freeswitch.conf diff --git a/debian/rules b/debian/rules index 07437f271a..b2e43d68d0 100755 --- a/debian/rules +++ b/debian/rules @@ -100,10 +100,6 @@ override_dh_auto_install: dh_auto_install -- -C libs/esl pymod-install mkdir -p debian/tmp/lib/systemd/system install -m0644 debian/freeswitch-systemd.freeswitch.service debian/tmp/lib/systemd/system/freeswitch.service - - mkdir -p debian/tmp/usr/lib/tmpfiles.d - install -m0644 debian/freeswitch-systemd.freeswitch.conf debian/tmp/usr/lib/tmpfiles.d/freeswitch.conf - rm -f debian/tmp/usr/share/freeswitch/grammar/model/communicator/COPYING override_dh_installinit: