Skip to content

Commit

Permalink
build: handle relative libexecdir instances
Browse files Browse the repository at this point in the history
With earlier commit, we've used exec_dir to reference the path of obexd
and bluetoothd within the service files.

At the same time, in my testing I was providing the complete path on the
configure command line. As result, things just worked.

In the default case, the variable contains relative references to ${}
variables, which as result end up literal in the services. Ultimately
the service files were broken.

Document are reuse the existing pattern of manually expanding the
variables.

Fixes: #736
  • Loading branch information
evelikov authored and Vudentz committed Feb 20, 2024
1 parent c2b9f35 commit 71d8fda
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Expand Up @@ -16,7 +16,7 @@ CLEANFILES =

EXTRA_DIST =

pkglibexecdir = $(libexecdir)/bluetooth
pkglibexecdir = @PKGLIBEXECDIR@

pkglibexec_PROGRAMS =

Expand Down
18 changes: 18 additions & 0 deletions configure.ac
Expand Up @@ -401,6 +401,24 @@ if (test "${prefix}" = "NONE"); then
prefix="${ac_default_prefix}"
fi

if (test "${exec_prefix}" = "NONE"); then
# exec_prefix defaults to prefix, although our manual handling of the
# latter (above) confuses autoconf. Manually set the exec_prefix.
exec_prefix="${prefix}"
fi

# Expand any variables containing relative references like ${prefix} and co.
#
# Otherwise we'll end up with literal references in the final binaries or
# manuals, which is not something we really want.

if (test "$libexecdir" = '${exec_prefix}/libexec'); then
pkglibexecdir="${exec_prefix}/libexec/bluetooth"
else
pkglibexecdir="${libexecdir}/bluetooth"
fi
AC_SUBST(PKGLIBEXECDIR, "${pkglibexecdir}")

if (test "$localstatedir" = '${prefix}/var'); then
storagedir="${prefix}/var/lib/bluetooth"
else
Expand Down
2 changes: 1 addition & 1 deletion mesh/bluetooth-mesh.service.in
Expand Up @@ -5,7 +5,7 @@ ConditionPathIsDirectory=/sys/class/bluetooth
[Service]
Type=dbus
BusName=org.bluez.mesh
ExecStart=@exec_prefix@/bluetooth/bluetooth-meshd
ExecStart=@PKGLIBEXECDIR@/bluetooth-meshd
NotifyAccess=main
LimitNPROC=1
ProtectHome=true
Expand Down
2 changes: 1 addition & 1 deletion obexd/src/obex.service.in
Expand Up @@ -4,7 +4,7 @@ Description=Bluetooth OBEX service
[Service]
Type=dbus
BusName=org.bluez.obex
ExecStart=@exec_prefix@/bluetooth/obexd
ExecStart=@PKGLIBEXECDIR@/obexd

[Install]
Alias=dbus-org.bluez.obex.service
2 changes: 1 addition & 1 deletion obexd/src/org.bluez.obex.service.in
@@ -1,4 +1,4 @@
[D-BUS Service]
Name=org.bluez.obex
Exec=@exec_prefix@/bluetooth/obexd
Exec=@PKGLIBEXECDIR@/obexd
SystemdService=dbus-org.bluez.obex.service
2 changes: 1 addition & 1 deletion src/bluetooth.service.in
Expand Up @@ -6,7 +6,7 @@ ConditionPathIsDirectory=/sys/class/bluetooth
[Service]
Type=dbus
BusName=org.bluez
ExecStart=@exec_prefix@/bluetooth/bluetoothd
ExecStart=@PKGLIBEXECDIR@/bluetoothd
NotifyAccess=main
#WatchdogSec=10
#Restart=on-failure
Expand Down
2 changes: 1 addition & 1 deletion tools/bluetooth-logger.service.in
Expand Up @@ -4,7 +4,7 @@ ConditionPathIsDirectory=/sys/class/bluetooth

[Service]
Type=simple
ExecStart=@exec_prefix@/bluetooth/btmon-logger -p -b /var/log/bluetooth/hci.log
ExecStart=@PKGLIBEXECDIR@/btmon-logger -p -b /var/log/bluetooth/hci.log
NotifyAccess=main
CapabilityBoundingSet=CAP_NET_RAW
LimitNPROC=1
Expand Down

0 comments on commit 71d8fda

Please sign in to comment.