1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-22 01:19:52 +03:00

Fix systemd unit file generation

This commit is contained in:
Ron Isaacson 2020-06-30 01:22:37 -04:00
parent eeaac4e78c
commit 40ed982079
7 changed files with 36 additions and 33 deletions

View File

@ -23,6 +23,24 @@ if(UNIX)
RENAME ${component} RENAME ${component}
) )
endmacro(install_wrapper_script) endmacro(install_wrapper_script)
# Same approach for systemd unit files
#
macro(install_unit_file component)
file(GENERATE OUTPUT ${BUILD_DIRECTORY}/softether-${component}.service
CONTENT "# placeholder\n"
)
install(CODE "set(DIR \"\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBEXECDIR}\")\nconfigure_file(${TOP_DIRECTORY}/systemd/softether-${component}.service ${BUILD_DIRECTORY}/softether-${component}.service)"
COMPONENT ${component}
)
install(FILES ${BUILD_DIRECTORY}/softether-${component}.service
COMPONENT ${component}
DESTINATION ${CMAKE_INSTALL_SYSTEMD_UNITDIR}
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endmacro(install_unit_file)
endif() endif()
if(BUILD_TYPE STREQUAL "Debug") if(BUILD_TYPE STREQUAL "Debug")

View File

@ -41,11 +41,6 @@ if(UNIX)
install_wrapper_script("vpnbridge") install_wrapper_script("vpnbridge")
if(NOT "${CMAKE_INSTALL_SYSTEMD_UNITDIR}" STREQUAL "") if(NOT "${CMAKE_INSTALL_SYSTEMD_UNITDIR}" STREQUAL "")
configure_file(${TOP_DIRECTORY}/systemd/softether-vpnbridge.service ${CMAKE_BINARY_DIR}/systemd/softether-vpnbridge.service) install_unit_file("vpnbridge")
install(FILES ${CMAKE_BINARY_DIR}/systemd/softether-vpnbridge.service
COMPONENT "vpnbridge"
DESTINATION ${CMAKE_INSTALL_SYSTEMD_UNITDIR}
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endif() endif()
endif() endif()

View File

@ -41,11 +41,6 @@ if(UNIX)
install_wrapper_script("vpnclient") install_wrapper_script("vpnclient")
if(NOT "${CMAKE_INSTALL_SYSTEMD_UNITDIR}" STREQUAL "") if(NOT "${CMAKE_INSTALL_SYSTEMD_UNITDIR}" STREQUAL "")
configure_file(${TOP_DIRECTORY}/systemd/softether-vpnclient.service ${CMAKE_BINARY_DIR}/systemd/softether-vpnclient.service) install_unit_file("vpnclient")
install(FILES ${CMAKE_BINARY_DIR}/systemd/softether-vpnclient.service
COMPONENT "vpnclient"
DESTINATION ${CMAKE_INSTALL_SYSTEMD_UNITDIR}
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endif() endif()
endif() endif()

View File

@ -41,11 +41,6 @@ if(UNIX)
install_wrapper_script("vpnserver") install_wrapper_script("vpnserver")
if(NOT "${CMAKE_INSTALL_SYSTEMD_UNITDIR}" STREQUAL "") if(NOT "${CMAKE_INSTALL_SYSTEMD_UNITDIR}" STREQUAL "")
configure_file(${TOP_DIRECTORY}/systemd/softether-vpnserver.service ${CMAKE_BINARY_DIR}/systemd/softether-vpnserver.service) install_unit_file("vpnserver")
install(FILES ${CMAKE_BINARY_DIR}/systemd/softether-vpnserver.service
COMPONENT "vpnserver"
DESTINATION ${CMAKE_INSTALL_SYSTEMD_UNITDIR}
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endif() endif()
endif() endif()

View File

@ -1,13 +1,13 @@
[Unit] [Unit]
Description=SoftEther VPN Bridge Description=SoftEther VPN Bridge
After=network.target auditd.service After=network.target auditd.service
ConditionPathExists=!${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnbridge/do_not_run ConditionPathExists=!@DIR@/softether/vpnbridge/do_not_run
[Service] [Service]
Type=forking Type=forking
EnvironmentFile=-${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnbridge EnvironmentFile=-@DIR@/softether/vpnbridge
ExecStart=${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnbridge/vpnbridge start ExecStart=@DIR@/softether/vpnbridge/vpnbridge start
ExecStop=${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnbridge/vpnbridge stop ExecStop=@DIR@/softether/vpnbridge/vpnbridge stop
KillMode=process KillMode=process
Restart=on-failure Restart=on-failure
@ -16,7 +16,7 @@ PrivateTmp=yes
ProtectHome=yes ProtectHome=yes
ProtectSystem=full ProtectSystem=full
ReadOnlyDirectories=/ ReadOnlyDirectories=/
ReadWriteDirectories=-${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnbridge ReadWriteDirectories=-@DIR@/softether/vpnbridge
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYSLOG CAP_SETUID CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYSLOG CAP_SETUID
[Install] [Install]

View File

@ -1,13 +1,13 @@
[Unit] [Unit]
Description=SoftEther VPN Client Description=SoftEther VPN Client
After=network.target auditd.service After=network.target auditd.service
ConditionPathExists=!${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnclient/do_not_run ConditionPathExists=!@DIR@/softether/vpnclient/do_not_run
[Service] [Service]
Type=forking Type=forking
EnvironmentFile=-${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnclient EnvironmentFile=-@DIR@/softether/vpnclient
ExecStart=${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnclient/vpnclient start ExecStart=@DIR@/softether/vpnclient/vpnclient start
ExecStop=${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnclient/vpnclient stop ExecStop=@DIR@/softether/vpnclient/vpnclient stop
KillMode=process KillMode=process
Restart=on-failure Restart=on-failure
@ -16,7 +16,7 @@ PrivateTmp=yes
ProtectHome=yes ProtectHome=yes
ProtectSystem=full ProtectSystem=full
ReadOnlyDirectories=/ ReadOnlyDirectories=/
ReadWriteDirectories=-${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnclient ReadWriteDirectories=-@DIR@/softether/vpnclient
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYSLOG CAP_SETUID CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYSLOG CAP_SETUID
[Install] [Install]

View File

@ -1,14 +1,14 @@
[Unit] [Unit]
Description=SoftEther VPN Server Description=SoftEther VPN Server
After=network.target auditd.service After=network.target auditd.service
ConditionPathExists=!${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnserver/do_not_run ConditionPathExists=!@DIR@/softether/vpnserver/do_not_run
[Service] [Service]
Type=forking Type=forking
TasksMax=16777216 TasksMax=16777216
EnvironmentFile=-${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnserver EnvironmentFile=-@DIR@/softether/vpnserver
ExecStart=${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnserver/vpnserver start ExecStart=@DIR@/softether/vpnserver/vpnserver start
ExecStop=${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnserver/vpnserver stop ExecStop=@DIR@/softether/vpnserver/vpnserver stop
KillMode=process KillMode=process
Restart=on-failure Restart=on-failure
@ -17,7 +17,7 @@ PrivateTmp=yes
ProtectHome=yes ProtectHome=yes
ProtectSystem=full ProtectSystem=full
ReadOnlyDirectories=/ ReadOnlyDirectories=/
ReadWriteDirectories=-${CPACK_PACKAGING_INSTALL_PREFIX}/libexec/softether/vpnserver ReadWriteDirectories=-@DIR@/softether/vpnserver
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYSLOG CAP_SETUID CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SYS_NICE CAP_SYSLOG CAP_SETUID
[Install] [Install]