File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9191SYSTEMD_UNIT_DIR=/usr/lib/systemd/user
9292if [ -d " $SYSTEMD_UNIT_DIR " ] || command -v systemctl > /dev/null 2>&1 ; then
9393 echo " Installing systemd user unit …"
94- # Rewrite ExecStart to match the actual install prefix. Escape the
95- # replacement string so sed metacharacters (& \ |) in the path are literal.
96- ESCAPED_EXEC =" $( printf ' %s\n' " ${BINDIR} /openlogi-agent " | sed ' s|[&\\|]|\\&|g' ) "
97- sed " s|ExecStart=.*|ExecStart= ${ESCAPED_EXEC} | " \
94+ # Expand the @BINDIR@ placeholder to match the actual install prefix.
95+ # Escape the replacement so sed metacharacters (& \ |) in the path are literal.
96+ ESCAPED_BINDIR =" $( printf ' %s\n' " ${BINDIR} " | sed ' s|[&\\|]|\\&|g' ) "
97+ sed " s|@BINDIR@| ${ESCAPED_BINDIR} |g " \
9898 " ${SCRIPT_DIR} /systemd/openlogi-agent.service" \
9999 | sudo tee " ${SYSTEMD_UNIT_DIR} /openlogi-agent.service" > /dev/null
100100 # Best-effort daemon-reload for the invoking user so a reinstall picks up
Original file line number Diff line number Diff line change 11# OpenLogi background agent — packaged user unit.
22#
3- # This file is installed to /usr/lib/systemd/user/ by the package manager (or
4- # install.sh). It is the system-provided template; the agent's launch_at_login
5- # setting writes its own copy to $XDG_CONFIG_HOME/systemd/user/ — both coexist,
3+ # This file is a template — @BINDIR@ is substituted at install time:
4+ # - nfpm (.deb/.rpm): postinstall.sh expands it to /usr/bin
5+ # - install.sh: expanded to PREFIX/bin (default /usr/local/bin)
6+ # The agent's launch_at_login setting writes its own copy to
7+ # $XDG_CONFIG_HOME/systemd/user/ using the current binary path — both coexist,
68# enabling either works.
79#
810# Enable for the current user:
@@ -14,7 +16,7 @@ After=graphical-session.target
1416
1517[Service]
1618Type =simple
17- ExecStart =/usr/bin /openlogi-agent
19+ ExecStart =@BINDIR@ /openlogi-agent
1820Restart =on-failure
1921RestartSec =5
2022
You can’t perform that action at this time.
0 commit comments