Skip to content

Commit

Permalink
GUACAMOLE-1981: Add configure argument for systemd user
Browse files Browse the repository at this point in the history
  • Loading branch information
Morgan Willcock committed Sep 3, 2024
1 parent 13868fa commit 9f8680a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
10 changes: 10 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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>],
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
"
5 changes: 4 additions & 1 deletion src/guacd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 changes: 1 addition & 1 deletion src/guacd/systemd/guacd.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Documentation=man:guacd(8)
After=network.target

[Service]
User=daemon
User=@systemduser@
ExecStart=@sbindir@/guacd -f
Restart=on-abnormal

Expand Down

0 comments on commit 9f8680a

Please sign in to comment.