GUACAMOLE-1981: Add configure argument for systemd user

This commit is contained in:
Morgan Willcock 2024-09-03 21:20:14 +01:00
parent 13868fac10
commit 9f8680aebe
3 changed files with 15 additions and 2 deletions

View File

@ -229,6 +229,14 @@ AC_ARG_WITH(systemd_dir,
AM_CONDITIONAL([ENABLE_SYSTEMD], [test "x${systemd_dir}" != "x"])
AC_SUBST(systemd_dir)
# Systemd user
AC_ARG_WITH(systemd_user,
[AS_HELP_STRING([--with-systemd-user=<username>],
[the user configured in the systemd unit to run guacd @<:@default=daemon@:>@])],
[systemd_user=$withval],
[systemd_user=daemon])
AC_SUBST(systemd_user)
# guacd config file
AC_ARG_WITH(guacd_conf,
[AS_HELP_STRING([--with-guacd-conf=<path>],
@ -1480,6 +1488,7 @@ AM_COND_IF([ENABLE_INIT], [build_init="${init_dir}"], [build_init=no])
#
AM_COND_IF([ENABLE_SYSTEMD], [build_systemd="${systemd_dir}"], [build_systemd=no])
AM_COND_IF([ENABLE_SYSTEMD], [build_systemd_user="${systemd_user}"], [build_systemd_user=no])
#
# FreeRDP plugins
@ -1531,6 +1540,7 @@ $PACKAGE_NAME version $PACKAGE_VERSION
FreeRDP plugins: ${build_rdp_plugins}
Init scripts: ${build_init}
Systemd units: ${build_systemd}
Systemd user: ${build_systemd_user}
Type \"make\" to compile $PACKAGE_NAME.
"

View File

@ -87,9 +87,12 @@ endif
# Systemd service
if ENABLE_SYSTEMD
systemddir = @systemd_dir@
systemduser = @systemd_user@
systemd_DATA = systemd/guacd.service
systemd/guacd.service: systemd/guacd.service.in
sed -e 's,[@]sbindir[@],$(sbindir),g' < systemd/guacd.service.in > systemd/guacd.service
sed -e 's,[@]sbindir[@],$(sbindir),g' \
-e 's,[@]systemduser[@],$(systemduser),g' \
< systemd/guacd.service.in > systemd/guacd.service
endif

View File

@ -21,7 +21,7 @@ Documentation=man:guacd(8)
After=network.target
[Service]
User=daemon
User=@systemduser@
ExecStart=@sbindir@/guacd -f
Restart=on-abnormal