Skip to content

Commit

Permalink
Installation/deinstallation scripts for RPM packages. (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjandras committed Jun 22, 2023
1 parent 4f2b415 commit 5d61267
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 0 deletions.
12 changes: 12 additions & 0 deletions dist/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ set(CPACK_RPM_REDUCER_USER_FILELIST
"%config(noreplace) ${CONFIG_DIR}/reducer.yaml"
)

set(CPACK_RPM_REDUCER_POST_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/reducer/rpm/post.sh")
set(CPACK_RPM_REDUCER_PRE_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/reducer/rpm/preun.sh")
set(CPACK_RPM_REDUCER_POST_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/reducer/rpm/postun.sh")

install(
FILES
reducer/reducer.service
Expand Down Expand Up @@ -55,6 +59,10 @@ set(CPACK_RPM_KERNEL-COLLECTOR_USER_FILELIST
"%config(noreplace) ${CONFIG_DIR}/kernel-collector.args"
)

set(CPACK_RPM_KERNEL-COLLECTOR_POST_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/kernel-collector/rpm/post.sh")
set(CPACK_RPM_KERNEL-COLLECTOR_PRE_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/kernel-collector/rpm/preun.sh")
set(CPACK_RPM_KERNEL-COLLECTOR_POST_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/kernel-collector/rpm/postun.sh")

install(
FILES
kernel-collector/kernel-collector.service
Expand Down Expand Up @@ -87,6 +95,10 @@ set(CPACK_RPM_CLOUD-COLLECTOR_USER_FILELIST
"%config(noreplace) ${CONFIG_DIR}/cloud-collector.args"
)

set(CPACK_RPM_CLOUD-COLLECTOR_POST_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cloud-collector/rpm/post.sh")
set(CPACK_RPM_CLOUD-COLLECTOR_PRE_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cloud-collector/rpm/preun.sh")
set(CPACK_RPM_CLOUD-COLLECTOR_POST_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cloud-collector/rpm/postun.sh")

install(
FILES
cloud-collector/cloud-collector.service
Expand Down
5 changes: 5 additions & 0 deletions dist/cloud-collector/rpm/post.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
service=cloud-collector.service
if [ $1 -eq 1 ]; then
# install
systemctl preset $service >/dev/null 2>&1 || :
fi
6 changes: 6 additions & 0 deletions dist/cloud-collector/rpm/postun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
service=cloud-collector.service
systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ]; then
# upgrade
systemctl try-restart $service >/dev/null 2>&1 || :
fi
6 changes: 6 additions & 0 deletions dist/cloud-collector/rpm/preun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
service=cloud-collector.service
if [ $1 -eq 0 ]; then
# uninstall
systemctl --no-reload disable $service > /dev/null 2>&1 || :
systemctl stop $service > /dev/null 2>&1 || :
fi
5 changes: 5 additions & 0 deletions dist/kernel-collector/rpm/post.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
service=kernel-collector.service
if [ $1 -eq 1 ]; then
# install
systemctl preset $service >/dev/null 2>&1 || :
fi
6 changes: 6 additions & 0 deletions dist/kernel-collector/rpm/postun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
service=kernel-collector.service
systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ]; then
# upgrade
systemctl try-restart $service >/dev/null 2>&1 || :
fi
6 changes: 6 additions & 0 deletions dist/kernel-collector/rpm/preun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
service=kernel-collector.service
if [ $1 -eq 0 ]; then
# uninstall
systemctl --no-reload disable $service > /dev/null 2>&1 || :
systemctl stop $service > /dev/null 2>&1 || :
fi
5 changes: 5 additions & 0 deletions dist/reducer/rpm/post.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
service=reducer.service
if [ $1 -eq 1 ]; then
# install
systemctl preset $service >/dev/null 2>&1 || :
fi
6 changes: 6 additions & 0 deletions dist/reducer/rpm/postun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
service=reducer.service
systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ]; then
# upgrade
systemctl try-restart $service >/dev/null 2>&1 || :
fi
6 changes: 6 additions & 0 deletions dist/reducer/rpm/preun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
service=reducer.service
if [ $1 -eq 0 ]; then
# uninstall
systemctl --no-reload disable $service > /dev/null 2>&1 || :
systemctl stop $service > /dev/null 2>&1 || :
fi

0 comments on commit 5d61267

Please sign in to comment.