From 5e5a5d411f88e4a21dc26c09b4626d9e680e6833 Mon Sep 17 00:00:00 2001 From: mreid-tt <943378+mreid-tt@users.noreply.github.com> Date: Fri, 16 Dec 2022 15:21:20 -0400 Subject: [PATCH] Framework: add "prereplace" / "postreplace" scripts; "checkport" field --- mk/spksrc.service.installer.dsm6 | 16 ++++++++++++++++ mk/spksrc.service.installer.dsm7 | 16 ++++++++++++++++ mk/spksrc.service.privilege-installasroot | 6 ++++++ mk/spksrc.service.privilege-startasroot | 6 ++++++ mk/spksrc.spk.mk | 11 +++++++++++ 5 files changed, 55 insertions(+) diff --git a/mk/spksrc.service.installer.dsm6 b/mk/spksrc.service.installer.dsm6 index 8a7361d6b041..853c49f442d4 100644 --- a/mk/spksrc.service.installer.dsm6 +++ b/mk/spksrc.service.installer.dsm6 @@ -370,3 +370,19 @@ postupgrade () exit 0 } + +prereplace () +{ + log_step "prereplace" + call_func "validate_prereplace" + call_func "service_prereplace" install_log + exit 0 +} + +postreplace () +{ + log_step "postreplace" + call_func "validate_postreplace" + call_func "service_postreplace" install_log + exit 0 +} diff --git a/mk/spksrc.service.installer.dsm7 b/mk/spksrc.service.installer.dsm7 index 8c17435126a9..0f557dedc3f1 100644 --- a/mk/spksrc.service.installer.dsm7 +++ b/mk/spksrc.service.installer.dsm7 @@ -242,3 +242,19 @@ postupgrade () exit 0 } + +prereplace () +{ + log_step "prereplace" + call_func "validate_prereplace" + call_func "service_prereplace" install_log + exit 0 +} + +postreplace () +{ + log_step "postreplace" + call_func "validate_postreplace" + call_func "service_postreplace" install_log + exit 0 +} diff --git a/mk/spksrc.service.privilege-installasroot b/mk/spksrc.service.privilege-installasroot index 02d5d7e927f4..e41bd6b3ec4b 100644 --- a/mk/spksrc.service.privilege-installasroot +++ b/mk/spksrc.service.privilege-installasroot @@ -21,5 +21,11 @@ }, { "action": "postupgrade", "run-as": "root" + }, { + "action": "prereplace", + "run-as": "root" + }, { + "action": "postreplace", + "run-as": "root" }] } diff --git a/mk/spksrc.service.privilege-startasroot b/mk/spksrc.service.privilege-startasroot index ec7285735be1..fed43240ba15 100644 --- a/mk/spksrc.service.privilege-startasroot +++ b/mk/spksrc.service.privilege-startasroot @@ -21,6 +21,12 @@ }, { "action": "postupgrade", "run-as": "root" + }, { + "action": "prereplace", + "run-as": "root" + }, { + "action": "postreplace", + "run-as": "root" }, { "action": "start", "run-as": "root" diff --git a/mk/spksrc.spk.mk b/mk/spksrc.spk.mk index 4044e559a8cd..7d6aa7593c3d 100644 --- a/mk/spksrc.spk.mk +++ b/mk/spksrc.spk.mk @@ -113,6 +113,7 @@ DSM_SCRIPTS_DIR = $(WORK_DIR)/scripts DSM_SCRIPT_FILES = preinst postinst DSM_SCRIPT_FILES += preuninst postuninst DSM_SCRIPT_FILES += preupgrade postupgrade +DSM_SCRIPT_FILES += prereplace postreplace # SPK specific scripts ifneq ($(strip $(SSS_SCRIPT)),) @@ -211,6 +212,12 @@ endif ifneq ($(strip $(INSTUNINST_RESTART_SERVICES)),) @echo instuninst_restart_services=\"$(INSTUNINST_RESTART_SERVICES)\" >> $@ endif +ifneq ($(strip $(INSTALL_REPLACE_PACKAGES)),) + @echo install_replace_packages=\"$(INSTALL_REPLACE_PACKAGES)\" >> $@ +endif +ifneq ($(strip $(CHECKPORT)),) + @echo checkport=\"$(CHECKPORT)\" >> $@ +endif # for non startable (i.e. non service, cli tools only) # as default is 'yes' we only add this value for 'no' @@ -333,6 +340,10 @@ $(DSM_SCRIPTS_DIR)/preupgrade: @$(dsm_script_redirect) $(DSM_SCRIPTS_DIR)/postupgrade: @$(dsm_script_redirect) +$(DSM_SCRIPTS_DIR)/prereplace: + @$(dsm_script_redirect) +$(DSM_SCRIPTS_DIR)/postreplace: + @$(dsm_script_redirect) # Package Icons .PHONY: icons