diff --git a/CMakeLists.txt b/CMakeLists.txt index ababd2e0..e4247d16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -419,6 +419,11 @@ endif() # if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") configure_files (${CMAKE_CURRENT_SOURCE_DIR}/dist/rpm ${CMAKE_BINARY_DIR}/rpm) + if (DEFINED ENV{SNAPCRAFT_PART_BUILD}) + set (SYSTEMD_EXEC_PATH_PREFIX "/snap/bin/barrier.") + else() + set (SYSTEMD_EXEC_PATH_PREFIX "/usr/bin/") + endif() configure_files (${CMAKE_CURRENT_SOURCE_DIR}/dist/systemd ${CMAKE_BINARY_DIR}/systemd) install(FILES ${CMAKE_BINARY_DIR}/systemd/barrierc@.service DESTINATION lib/systemd/system) install(FILES ${CMAKE_BINARY_DIR}/systemd/barriers@.service DESTINATION lib/systemd/system) diff --git a/dist/systemd/barrierc@.service.in b/dist/systemd/barrierc@.service.in index ed2fc0f1..9bde2d12 100644 --- a/dist/systemd/barrierc@.service.in +++ b/dist/systemd/barrierc@.service.in @@ -50,7 +50,7 @@ openssl x509 -noout -sha1 -fingerprint |\ grep -oE '([A-Z0-9]{2}:?){20}' > ${FP_DIR}/TrustedServers.txt" # Main executable -ExecStart=/usr/bin/barrierc --enable-crypto --display ${DISPLAY} --debug ${LOG_LEVEL} --no-daemon %i +ExecStart=@SYSTEMD_EXEC_PATH_PREFIX@barrierc --enable-crypto --display ${DISPLAY} --debug ${LOG_LEVEL} --no-daemon %i # Restart on fail Restart=always diff --git a/dist/systemd/barriers.service.in b/dist/systemd/barriers.service.in index 95f46adb..168c1964 100644 --- a/dist/systemd/barriers.service.in +++ b/dist/systemd/barriers.service.in @@ -33,7 +33,7 @@ ExecStartPre=+/usr/bin/mkdir -p ${CERT_DIR} ExecStartPre=/usr/bin/sh -c "[ -f ${CERT_DIR}/Barrier.pem ] || openssl req -x509 -nodes -days 365 -subj '/CN=Barrier' -newkey rsa:2048 -text -keyout ${CERT_DIR}/Barrier.pem -out ${CERT_DIR}/Barrier.pem" # Main executable -ExecStart=/usr/bin/barriers --enable-crypto --display ${DISPLAY} --debug ${LOG_LEVEL} --config /etc/barrier.conf --no-daemon --address :24800 +ExecStart=@SYSTEMD_EXEC_PATH_PREFIX@barriers --enable-crypto --display ${DISPLAY} --debug ${LOG_LEVEL} --config /etc/barrier.conf --no-daemon --address :24800 # Restart on fail Restart=always diff --git a/dist/systemd/barriers@.service.in b/dist/systemd/barriers@.service.in index bf81f6a9..8be2e8bf 100644 --- a/dist/systemd/barriers@.service.in +++ b/dist/systemd/barriers@.service.in @@ -45,7 +45,7 @@ ExecStartPre=+/usr/bin/mkdir -p ${CERT_DIR} ExecStartPre=/usr/bin/sh -c "[ -f ${CERT_DIR}/Barrier.pem ] || openssl req -x509 -nodes -days 365 -subj '/CN=Barrier' -newkey rsa:2048 -text -keyout ${CERT_DIR}/Barrier.pem -out ${CERT_DIR}/Barrier.pem" # Main executable -ExecStart=/usr/bin/barriers --enable-crypto --display ${DISPLAY} --debug ${LOG_LEVEL} --config /etc/barrier.conf --no-daemon --address %i +ExecStart=@SYSTEMD_EXEC_PATH_PREFIX@barriers --enable-crypto --display ${DISPLAY} --debug ${LOG_LEVEL} --config /etc/barrier.conf --no-daemon --address %i # Restart on fail Restart=always