From 9f8680aebef0027f0b6082c522c4c024ff25c4a7 Mon Sep 17 00:00:00 2001 From: Morgan Willcock Date: Tue, 3 Sep 2024 21:20:14 +0100 Subject: [PATCH] GUACAMOLE-1981: Add configure argument for systemd user --- configure.ac | 10 ++++++++++ src/guacd/Makefile.am | 5 ++++- src/guacd/systemd/guacd.service.in | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 1f0543fd2..3e02c33a7 100644 --- a/configure.ac +++ b/configure.ac @@ -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=], + [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=], @@ -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. " diff --git a/src/guacd/Makefile.am b/src/guacd/Makefile.am index 356f72f23..b39b2db59 100644 --- a/src/guacd/Makefile.am +++ b/src/guacd/Makefile.am @@ -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 diff --git a/src/guacd/systemd/guacd.service.in b/src/guacd/systemd/guacd.service.in index da3af2153..77c98451f 100644 --- a/src/guacd/systemd/guacd.service.in +++ b/src/guacd/systemd/guacd.service.in @@ -21,7 +21,7 @@ Documentation=man:guacd(8) After=network.target [Service] -User=daemon +User=@systemduser@ ExecStart=@sbindir@/guacd -f Restart=on-abnormal