2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 09:57:41 +00:00

Disable systemd support on Linux systems that don't use it.

This commit is contained in:
Todd C. Miller 2020-04-16 15:32:07 -06:00
parent 024b146d06
commit a89ddb63fd
2 changed files with 67 additions and 20 deletions

View File

@ -221,21 +221,27 @@ This makes it possible to have all sudo I/O logs on a central server."
pidfile=${rundir}/sudo_logsrvd.pid
%endif
%if [rpm,deb]
pp_systemd_service_description="Sudo central log server"
pp_systemd_service_exec="${cmd}"
pp_systemd_service_exec_args="-n"
pp_systemd_service_dir=`pkg-config systemd --variable=systemdsystemunitdir 2>/dev/null`
if test X"$pp_systemd_service_dir" = X""; then
if test -d /lib/systemd/system; then
pp_systemd_service_dir=/lib/systemd/system
else
pp_systemd_service_dir=/usr/lib/systemd/system
fi
# Only include systemd support if we find systemctl on the build
# machine. This assumes that we are building on the same distro
# that the package will be installed on.
if command -v systemctl >/dev/null; then
for d in `pkg-config systemd --variable=systemdsystemunitdir 2>/dev/null` /lib/systemd/system /usr/lib/systemd/system; do
if test -d "$d"; then
break
fi
done
pp_systemd_service_description="Sudo central log server"
pp_systemd_service_dir="$d"
pp_systemd_service_exec="${cmd}"
pp_systemd_service_exec_args="-n"
pp_systemd_service_man="man:sudo_logsrvd(8) man:sudo_logsrvd.conf(5)"
pp_systemd_service_documentation="https://www.sudo.ws/man.html"
pp_systemd_service_after="syslog.target network.target auditd.service"
pp_systemd_service_killmode="process"
pp_systemd_service_type="exec"
pp_systemd_system_target="multi-user.target"
else
# No systemd support
pp_systemd_disabled=true
fi
pp_systemd_service_man="man:sudo_logsrvd(8) man:sudo_logsrvd.conf(5)"
pp_systemd_service_documentation="https://www.sudo.ws/man.html"
pp_systemd_service_after="syslog.target network.target auditd.service"
pp_systemd_service_killmode="process"
pp_systemd_service_type="exec"
pp_systemd_system_target="multi-user.target"
%endif

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Copyright 2020 One Identity LLC. ALL RIGHTS RESERVED
pp_revision="20200414"
pp_revision="20200416"
# Copyright 2018 One Identity LLC. ALL RIGHTS RESERVED.
#
# Redistribution and use in source and binary forms, with or without
@ -8805,11 +8805,14 @@ pp_backend_bsd_function() {
esac
}
pp_systemd_make_service_file() {
local svc f
if [ "${pp_systemd_disabled}:-false" = "true" ]; then
return
fi
svc="$1"
f="${pp_systemd_service_dir:-'/opt/quest/libexec/vas'}/$svc.service"
f="${pp_systemd_service_dir:-/opt/quest/libexec/vas}/$svc.service"
pp_add_file_if_missing $f run 644 v || return 0
cat <<. >$pp_destdir$f
@ -8838,7 +8841,7 @@ pp_systemd_service_init_common () {
cat <<.
_pp_systemd_init () {
systemd_service_dir=${pp_systemd_service_dir:-'/opt/quest/libexec/vas'}
systemd_service_dir=${pp_systemd_service_dir:-/opt/quest/libexec/vas}
systemd_target=${pp_systemd_system_target:-"multi-user.target"}
systemd_target_wants="\${systemd_target}.wants"
@ -8881,6 +8884,25 @@ pp_systemd_service_init_common () {
}
pp_systemd_service_install_common () {
if [ "${pp_systemd_disabled}:-false" = "true" ]; then
cat<<'.'
# systemd support disabled
_pp_systemd_init () {
return
}
_pp_systemd_install () {
return
}
_pp_systemd_enable () {
return
}
.
return
fi
pp_systemd_service_init_common
cat<<'.'
@ -8949,6 +8971,25 @@ pp_systemd_service_install_common () {
}
pp_systemd_service_remove_common () {
if [ "${pp_systemd_disabled}:-false" = "true" ]; then
cat<<'.'
# systemd support disabled
_pp_systemd_init () {
return
}
_pp_systemd_disable () {
return
}
_pp_systemd_remove () {
return
}
.
return
fi
pp_systemd_service_init_common
cat<<'.'