config/CMakeLists.txt: SYSTEMD_SYSTEM_DIR should respect LIBDIR
Expected behavior
Systemd service file should be installed into the location where $LIBDIR points to
Actual behavior
The file will always be installed into /lib/systemd/system/
Steps to reproduce
Log output: (Please ignore the /tmp/makepkg/gvmd/pkg/gvmd part from the paths. I took the log from the output of a program which creates a distribution package.)
[100%] Built target gvmd
Install the project...
-- Install configuration: "Release"
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/var/lib/gvm/gvmd
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/etc/gvm/gvmd_log.conf
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/etc/gvm/pwpolicy.conf
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/global_schema_formats/rnc.xsl
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/global_schema_formats/02052818-dab6-11df-9be4-002264764cea/rnc.xsl
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/global_schema_formats/02052818-dab6-11df-9be4-002264764cea/HTML.xsl
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/global_schema_formats/02052818-dab6-11df-9be4-002264764cea/generate
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/global_schema_formats/787a4a18-dabc-11df-9486-002264764cea/rnc.xsl
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/global_schema_formats/787a4a18-dabc-11df-9486-002264764cea/RNC.xsl
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/global_schema_formats/787a4a18-dabc-11df-9486-002264764cea/generate
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/global_schema_formats/18e826fc-dab6-11df-b913-002264764cea/GMP.xml
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/global_schema_formats/18e826fc-dab6-11df-b913-002264764cea/generate
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/global_schema_formats/d6cf255e-947c-11e1-829a-406186ea4fc5/GMP.xsl
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/global_schema_formats/d6cf255e-947c-11e1-829a-406186ea4fc5/generate
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/global_alert_methods/2db07698-ec49-11e5-bcff-28d24461215b/alert
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/global_alert_methods/4a398d42-87c0-11e5-a1c0-28d24461215b/alert
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/global_alert_methods/c427a688-b653-40ab-a9d0-d6ba842a9d63/alert
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/global_alert_methods/9d435134-15d3-11e6-bf5c-28d24461215b/alert
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/global_alert_methods/cd1f5a34-6bdc-11e0-9827-002264764cea/alert
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/global_alert_methods/5b39c481-9137-4876-b734-263849dd96ce/alert
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/global_alert_methods/5b39c481-9137-4876-b734-263849dd96ce/report-convert.py
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/global_alert_methods/f9d97653-f89b-41af-9ba1-0f6ee00e9c1a/alert
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/global_alert_methods/159f79a5-fce8-4ec5-aa49-7d17a77739a3/alert
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/wizards/quick_first_scan.xml
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/wizards/get_tasks_deep.xml
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/wizards/delete_task_deep.xml
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/wizards/quick_auth_scan.xml
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/wizards/quick_task.xml
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/wizards/reset_task.xml
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/wizards/modify_task.xml
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/scap/cpe_getbyname.xsl
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/scap/cve_getbyname.xsl
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/cert/cert_bund_getbyname.xsl
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/cert/dfn_cert_getbyname.xsl
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvm-lsc-deb-creator
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvm-lsc-exe-creator
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvm-lsc-rpm-creator
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/gvm/gvmd/template.nsis
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/bin/gvm-manage-certs
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/man/man1/gvm-manage-certs.1
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/doc/gvm/example-gvm-manage-certs.conf
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/bin/gvmd
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/lib/libgvm-pg-server.so.23.10.0
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/lib/libgvm-pg-server.so.23
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/lib/libgvm-pg-server.so
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/lib/systemd/system/gvmd.service
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/etc/logrotate.d/gvmd
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/doc/gvm/html/gmp.html
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/share/man/man8/gvmd.8
make: Leaving directory '/tmp/makepkg/gvmd/src/build'
Significant part:
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/lib/libgvm-pg-server.so.23.10.0
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/lib/libgvm-pg-server.so.23
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/lib/libgvm-pg-server.so
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/lib/systemd/system/gvmd.service
The shared libs are going into /usr/lib whereas the unit file goes into /lib/
Suggested change:
Replace /lib with ${LIBDIR} to https://github.com/greenbone/gvmd/blob/main/config/CMakeLists.txt#L20
--- a/gvmd-23.10.0/config/CMakeLists.txt
+++ b/gvmd-23.10.0/config/CMakeLists.txt
@@ -17,7 +17,7 @@
if (NOT SYSTEMD_SERVICE_DIR)
- set (SYSTEMD_SERVICE_DIR "/lib/systemd/system")
+ set (SYSTEMD_SERVICE_DIR "${LIBDIR}/systemd/system")
endif (NOT SYSTEMD_SERVICE_DIR)
if (NOT LOGROTATE_DIR)
Output after that change:
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/lib/libgvm-pg-server.so.23.10.0
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/lib/libgvm-pg-server.so.23
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/lib/libgvm-pg-server.so
-- Installing: /tmp/makepkg/gvmd/pkg/gvmd/usr/lib/systemd/system/gvmd.service
Only a note that it seems this is (at least currently) expected / as designed according to some comments in #1662 so this doesn't look like a bug and the automatically added bug label could be dropped.
Back then the change may have made sense, but nowadays it my not represent the state of the art with most of the distros, as those may have undertaken the usr-merge.
Reference page for Debian: https://wiki.debian.org/UsrMerge