Skip to content

Commit

Permalink
cmake: configure individual files in core/platforms/
Browse files Browse the repository at this point in the history
Instead of configuring all .in files, the CMakeLists now configure only
the files they need and put those in the output directory
  • Loading branch information
arogge committed Jan 31, 2024
1 parent 697d826 commit d3f4e9c
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 30 deletions.
2 changes: 1 addition & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ endif()
include(BareosConfigureFile)
bareos_configure_file(
GLOB_RECURSE "${CMAKE_SOURCE_DIR}/debian/*.in" "src/*.in" "scripts/*.in"
"platforms/*.in" IN_TREE
IN_TREE
)

add_subdirectory(platforms)
Expand Down
19 changes: 11 additions & 8 deletions core/platforms/darwin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2019-2020 Bareos GmbH & Co. KG
# Copyright (C) 2019-2024 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand All @@ -18,14 +18,17 @@
# 02110-1301, USA.
message("Entering ${CMAKE_CURRENT_SOURCE_DIR}")

include(BareosConfigureFile)
bareos_configure_file(GLOB_RECURSE "resources/*.in")

install(
FILES resources/com.bareos.bareos-fd.plist
FILES ${CMAKE_CURRENT_BINARY_DIR}/resources/com.bareos.bareos-fd.plist
DESTINATION "${scriptdir}"
COMPONENT filedaemon
)

install(
FILES resources/uninstall-bareos
FILES ${CMAKE_CURRENT_BINARY_DIR}/resources/uninstall-bareos
DESTINATION "${scriptdir}"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
Expand All @@ -49,13 +52,13 @@ set(CPACK_PACKAGE_DESCRIPTION_FILE

set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/bareos-logo.png")

set(CPACK_PRODUCTBUILD_RESOURCES_DIR "${CMAKE_CURRENT_LIST_DIR}/resources")
set(CPACK_PRODUCTBUILD_RESOURCES_DIR "${CMAKE_CURRENT_BINARY_DIR}/resources")

set(CPACK_RESOURCE_FILE_WELCOME
"${CMAKE_CURRENT_LIST_DIR}/resources/welcome.txt"
"${CMAKE_CURRENT_BINARY_DIR}/resources/welcome.txt"
)
set(CPACK_RESOURCE_FILE_README
"${CMAKE_CURRENT_LIST_DIR}/resources/ReadMe.html"
"${CMAKE_CURRENT_BINARY_DIR}/resources/ReadMe.html"
)
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/AGPL-3.0.txt")

Expand All @@ -66,10 +69,10 @@ set(CPACK_GENERATOR "productbuild")
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})

set(CPACK_PREFLIGHT_FILEDAEMON_SCRIPT
"${CMAKE_CURRENT_LIST_DIR}/resources/preinstall"
"${CMAKE_CURRENT_BINARY_DIR}/resources/preinstall"
)
set(CPACK_POSTFLIGHT_FILEDAEMON_SCRIPT
"${CMAKE_CURRENT_LIST_DIR}/resources/postinstall"
"${CMAKE_CURRENT_BINARY_DIR}/resources/postinstall"
)
set(CPACK_SET_DESTDIR TRUE)

Expand Down
7 changes: 5 additions & 2 deletions core/platforms/debian/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2023 Bareos GmbH & Co. KG
# Copyright (C) 2017-2024 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand All @@ -22,11 +22,14 @@ set(DESTSTARTDIR "${sysconfdir}/init.d/")

message(STATUS "installing startfiles to ${DESTSTARTDIR}")

include(BareosConfigureFile)
bareos_configure_file(FILES set_dbconfig_vars.sh.in)

# logrotate

# dbconfig
install(
FILES "${CMAKE_CURRENT_LIST_DIR}/../debian/set_dbconfig_vars.sh"
FILES "${CMAKE_CURRENT_BINARY_DIR}/set_dbconfig_vars.sh"
DESTINATION "${scriptdir}/"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
Expand Down
11 changes: 7 additions & 4 deletions core/platforms/freebsd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2018-2020 Bareos GmbH & Co. KG
# Copyright (C) 2018-2024 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand All @@ -18,29 +18,32 @@
# 02110-1301, USA.
message("Entering ${CMAKE_CURRENT_SOURCE_DIR}")

include(BareosConfigureFile)
bareos_configure_file(FILES bareos-fd.in bareos-sd.in bareos-dir.in)

set(DESTSTARTDIR "${sysconfdir}/rc.d/")

message(STATUS "installing startfiles to ${DESTSTARTDIR}")

# Install autostart fd
install(
FILES "${CMAKE_CURRENT_LIST_DIR}/bareos-fd"
FILES "${CMAKE_CURRENT_BINARY_DIR}/bareos-fd"
DESTINATION "${DESTSTARTDIR}/"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)

# Install autostart sd
install(
FILES "${CMAKE_CURRENT_LIST_DIR}/bareos-sd"
FILES "${CMAKE_CURRENT_BINARY_DIR}/bareos-sd"
DESTINATION "${DESTSTARTDIR}/"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)

# Install autostart dir
install(
FILES "${CMAKE_CURRENT_LIST_DIR}/bareos-dir"
FILES "${CMAKE_CURRENT_BINARY_DIR}/bareos-dir"
DESTINATION "${DESTSTARTDIR}/"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
Expand Down
6 changes: 3 additions & 3 deletions core/platforms/packaging/bareos.spec
Original file line number Diff line number Diff line change
Expand Up @@ -1022,9 +1022,9 @@ rm -f %{buildroot}%{plugin_dir}/bareos-fd-vmware.py*
# install systemd service files
%if 0%{?systemd_support}
install -d -m 755 %{buildroot}%{_unitdir}
install -m 644 core/platforms/systemd/bareos-dir.service %{buildroot}%{_unitdir}
install -m 644 core/platforms/systemd/bareos-fd.service %{buildroot}%{_unitdir}
install -m 644 core/platforms/systemd/bareos-sd.service %{buildroot}%{_unitdir}
install -m 644 %{CMAKE_BUILDDIR}/core/platforms/systemd/bareos-dir.service %{buildroot}%{_unitdir}
install -m 644 %{CMAKE_BUILDDIR}/core/platforms/systemd/bareos-fd.service %{buildroot}%{_unitdir}
install -m 644 %{CMAKE_BUILDDIR}/core/platforms/systemd/bareos-sd.service %{buildroot}%{_unitdir}
%if 0%{?suse_version}
ln -sf service %{buildroot}%{_sbindir}/rcbareos-dir
ln -sf service %{buildroot}%{_sbindir}/rcbareos-fd
Expand Down
11 changes: 7 additions & 4 deletions core/platforms/redhat/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2020 Bareos GmbH & Co. KG
# Copyright (C) 2017-2024 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand All @@ -18,29 +18,32 @@
# 02110-1301, USA.
message("Entering ${CMAKE_CURRENT_SOURCE_DIR}")

include(BareosConfigureFile)
bareos_configure_file(FILES bareos-fd.in bareos-sd.in bareos-dir.in)

set(DESTSTARTDIR "${sysconfdir}/rc.d/init.d/")

message(STATUS "installing startfiles to ${DESTSTARTDIR}")

# Install autostart fd
install(
FILES "${CMAKE_CURRENT_LIST_DIR}/bareos-fd"
FILES "${CMAKE_CURRENT_BINARY_DIR}/bareos-fd"
DESTINATION "${DESTSTARTDIR}/"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)

# Install autostart sd
install(
FILES "${CMAKE_CURRENT_LIST_DIR}/bareos-sd"
FILES "${CMAKE_CURRENT_BINARY_DIR}/bareos-sd"
DESTINATION "${DESTSTARTDIR}/"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)

# Install autostart dir
install(
FILES "${CMAKE_CURRENT_LIST_DIR}/bareos-dir"
FILES "${CMAKE_CURRENT_BINARY_DIR}/bareos-dir"
DESTINATION "${DESTSTARTDIR}/"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
Expand Down
11 changes: 7 additions & 4 deletions core/platforms/suse/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2020 Bareos GmbH & Co. KG
# Copyright (C) 2017-2024 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand All @@ -18,6 +18,9 @@
# 02110-1301, USA.
message("Entering ${CMAKE_CURRENT_SOURCE_DIR}")

include(BareosConfigureFile)
bareos_configure_file(FILES bareos-fd.in bareos-sd.in bareos-dir.in)

set(FIREWALL_DIR ${sysconfdir}/sysconfig/SuSEfirewall2.d/services/)
set(DESTSTARTDIR ${sysconfdir}/init.d/)

Expand All @@ -27,21 +30,21 @@ install(DIRECTORY DESTINATION ${DESTSTARTDIR})

# Install autostart fd
install(
FILES "${CMAKE_CURRENT_LIST_DIR}/bareos-fd"
FILES "${CMAKE_CURRENT_BINARY_DIR}/bareos-fd"
DESTINATION "${DESTSTARTDIR}"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)
# Install autostart sd
install(
FILES "${CMAKE_CURRENT_LIST_DIR}/bareos-sd"
FILES "${CMAKE_CURRENT_BINARY_DIR}/bareos-sd"
DESTINATION "${DESTSTARTDIR}"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)
# Install autostart dir
install(
FILES "${CMAKE_CURRENT_LIST_DIR}/bareos-dir"
FILES "${CMAKE_CURRENT_BINARY_DIR}/bareos-dir"
DESTINATION "${DESTSTARTDIR}"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
Expand Down
19 changes: 15 additions & 4 deletions core/platforms/systemd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2017-2020 Bareos GmbH & Co. KG
# Copyright (C) 2017-2024 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand All @@ -18,9 +18,20 @@
# 02110-1301, USA.
message("Entering ${CMAKE_CURRENT_SOURCE_DIR}")

include(BareosConfigureFile)
bareos_configure_file(
FILES bareos-fd.service.in bareos-sd.service.in bareos-dir.service.in
)

message(STATUS "CMAKE_CURRENT_LIST_FILE: " ${CMAKE_CURRENT_LIST_FILE})
message(STATUS "installing systemd files to ${SYSTEMD_UNITDIR}")

install(FILES "bareos-sd.service" DESTINATION ${SYSTEMD_UNITDIR})
install(FILES "bareos-fd.service" DESTINATION ${SYSTEMD_UNITDIR})
install(FILES "bareos-dir.service" DESTINATION ${SYSTEMD_UNITDIR})
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/bareos-sd.service"
DESTINATION ${SYSTEMD_UNITDIR}
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/bareos-fd.service"
DESTINATION ${SYSTEMD_UNITDIR}
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/bareos-dir.service"
DESTINATION ${SYSTEMD_UNITDIR}
)

0 comments on commit d3f4e9c

Please sign in to comment.