diff options
Diffstat (limited to 'app-backup/bareos/files/bareos-dir.initd')
-rw-r--r-- | app-backup/bareos/files/bareos-dir.initd | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/app-backup/bareos/files/bareos-dir.initd b/app-backup/bareos/files/bareos-dir.initd index 462ff07843a2..a2986d133cc3 100644 --- a/app-backup/bareos/files/bareos-dir.initd +++ b/app-backup/bareos/files/bareos-dir.initd @@ -1,30 +1,24 @@ #!/sbin/openrc-run -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 depend() { use dns bareos-fd bareos-sd } -start() { - ebegin "Starting bareos director" - # g+w until #631598 is resolved - checkpath -d -m 0770 -o root:bareos /run/bareos - start-stop-daemon --start --quiet --exec /usr/sbin/bareos-dir \ - -- ${DIR_OPTIONS} - # harden pid file until #631598 is resolved - ewaitfile 10 /run/bareos/bareos-dir.9101.pid - chown root:bareos /run/bareos/bareos-dir.9101.pid - eend $? +start_pre() { + checkpath --directory --owner root:bareos --mode 01775 /run/bareos + if [[ -e /run/bareos/bareos-dir.9101.pid && $(stat -c %U /run/bareos/bareos-dir.9101.pid) != "root" ]]; then + eerror "SECURITY ALERT: bareos owned pidfile found! (see #631598)" + exit 1 + fi } -stop() { - ebegin "Stopping bareos director" - # check pid file until #631598 is resolved - if [[ $(stat -c %U /run/bareos/bareos-dir.9101.pid) != "root" ]]; then - eerror "SECURITY ALERT: pid file is not root owned anymore?! (see #631598)" - else - start-stop-daemon --stop --quiet --pidfile /run/bareos/bareos-dir.9101.pid - fi - eend $? +start_post() { + ewaitfile 10 /run/bareos/bareos-dir.9101.pid + checkpath --file --owner root:bareos /run/bareos/bareos-dir.9101.pid } + +command="/usr/sbin/bareos-dir" +command_args="${DIR_OPTIONS}" +pidfile="/run/bareos/bareos-dir.9101.pid" |