Skip to content

Commit 2259ede

Browse files
committed
Add uninstaller that can optionally remove all package files
Includes files in the new permanent storage (/var) and home folder
1 parent d55d182 commit 2259ede

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

mk/spksrc.service.installer.dsm7

+12-2
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,18 @@ postuninst ()
172172
call_func "service_postuninst"
173173
call_func "service_remove_links"
174174

175-
if [ "${SYNOPKG_PKG_STATUS}" == "UNINSTALL" ]; then
176-
$RM "${INST_VARIABLES}"
175+
if [ "$wizard_delete_data" ]; then
176+
if [ "$(ls -A ${SYNOPKG_PKGHOME})" ]; then
177+
rm -rf ${SYNOPKG_PKGHOME}/.
178+
fi
179+
180+
if [ "$(ls -A ${SYNOPKG_PKGVAR})" ]; then
181+
rm -rf ${SYNOPKG_PKGVAR}/.
182+
fi
183+
184+
if [ "$(ls -A ${SYNOPKG_PKGTMP})" ]; then
185+
rm -rf ${SYNOPKG_PKGTMP}/.
186+
fi
177187
fi
178188
exit 0
179189
}

mk/spksrc.spk.mk

+5-2
Original file line numberDiff line numberDiff line change
@@ -296,14 +296,17 @@ info-checksum:
296296

297297
.PHONY: wizards
298298
wizards:
299-
ifneq ($(strip $(WIZARDS_DIR)),)
300299
@$(MSG) "Preparing DSM Wizards"
301300
@mkdir -p $(DSM_WIZARDS_DIR)
301+
ifneq ($(strip $(WIZARDS_DIR)),)
302302
@find $${SPKSRC_WIZARDS_DIR} -maxdepth 1 -type f -and \( -name "install_uifile" -or -name "install_uifile_???" -or -name "install_uifile.sh" -or -name "install_uifile_???.sh" -or -name "upgrade_uifile" -or -name "upgrade_uifile_???" -or -name "upgrade_uifile.sh" -or -name "upgrade_uifile_???.sh" -or -name "uninstall_uifile" -or -name "uninstall_uifile_???" -or -name "uninstall_uifile.sh" -or -name "uninstall_uifile_???.sh" \) -print -exec cp -f {} $(DSM_WIZARDS_DIR) \;
303+
endif
304+
ifeq ($(shell expr "$(TCVERSION)" \>= 7.0),1)
305+
@find $(SPKSRC_MK)wizard -maxdepth 1 -type f -and \( -name "uninstall_uifile" -or -name "uninstall_uifile_???" \) -print -exec cp -f {} $(DSM_WIZARDS_DIR) \;
306+
endif
303307
@find $(DSM_WIZARDS_DIR) -maxdepth 1 -type f -not -name "*.sh" -print -exec chmod 0644 {} \;
304308
@find $(DSM_WIZARDS_DIR) -maxdepth 1 -type f -name "*.sh" -print -exec chmod 0755 {} \;
305309
$(eval SPK_CONTENT += WIZARD_UIFILES)
306-
endif
307310

308311
.PHONY: conf
309312
conf:

mk/wizard/uninstall_uifile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[{
2+
"step_title": "Uninstall package",
3+
"items": [{
4+
"type": "singleselect",
5+
"desc": "Keep or delete package settings.",
6+
"subitems": [{
7+
"key": "wizard_keep_data",
8+
"desc": "<b>Uninstall only.</b> Keep existing files for future re-installation.",
9+
"defaultValue": true
10+
}, {
11+
"key": "wizard_delete_data",
12+
"desc": "<b style=\"color: red\">Erase all of the package data files. (Not Recoverable)</b>",
13+
"defaultValue": false
14+
}]
15+
}]
16+
}]

0 commit comments

Comments
 (0)