Skip to content

Commit

Permalink
Framework: add "prereplace" / "postreplace" scripts; "checkport" field
Browse files Browse the repository at this point in the history
  • Loading branch information
mreid-tt committed Dec 17, 2022
1 parent f58c6f9 commit 5e5a5d4
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 0 deletions.
16 changes: 16 additions & 0 deletions mk/spksrc.service.installer.dsm6
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
16 changes: 16 additions & 0 deletions mk/spksrc.service.installer.dsm7
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
6 changes: 6 additions & 0 deletions mk/spksrc.service.privilege-installasroot
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,11 @@
}, {
"action": "postupgrade",
"run-as": "root"
}, {
"action": "prereplace",
"run-as": "root"
}, {
"action": "postreplace",
"run-as": "root"
}]
}
6 changes: 6 additions & 0 deletions mk/spksrc.service.privilege-startasroot
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
}, {
"action": "postupgrade",
"run-as": "root"
}, {
"action": "prereplace",
"run-as": "root"
}, {
"action": "postreplace",
"run-as": "root"
}, {
"action": "start",
"run-as": "root"
Expand Down
11 changes: 11 additions & 0 deletions mk/spksrc.spk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)),)
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5e5a5d4

Please sign in to comment.