aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorCorwin Brust2024-12-22 23:08:08 -0600
committerCorwin Brust2024-12-22 23:08:08 -0600
commit0e43e35f96e5c3c10a200ebe8fe77c60e0db7c4a (patch)
tree07dd5fa29858f59dc18bddb4a485ae1d39648ad2 /admin
parentb83cd8a8fb0e24057d6ab66afa53b25699e34bf1 (diff)
downloademacs-0e43e35f96e5c3c10a200ebe8fe77c60e0db7c4a.tar.gz
emacs-0e43e35f96e5c3c10a200ebe8fe77c60e0db7c4a.zip
* admin/nt/dist-build/emacs.nsi: (Uninstall) delete only one Emacs
Previously, the uninstaller would recursively, unconditionally, remove the parent folder in which Emacs was installed (the folder selected by when running the installer), into which the installer places a folder named for the given release (e.g. emacs-30.1). This was a problem during uinstalation when the selected folder contained other versions of Emacs the user did not wish to remove. Additionally, deleting Start Menu short-cuts did not work (bug#68756). Some installer language now better reflects that users are not required to "Accept" the GNU Public License in order to use (etc.) Emacs (bug#67667). Users selections related to where to create (or not create) Start Menu shortcuts are no longer ignored. (bug#75013) Emacs (as installed by the installer) can now be uninstalled via Windows' Add/Remove Progrms Control Panel. The uninstaller will now remove (empty) parent folders, both under Program Files and (when creation of shortcuts is enabled) under the select Start Menu location.
Diffstat (limited to 'admin')
-rw-r--r--admin/nt/dist-build/emacs.nsi95
1 files changed, 78 insertions, 17 deletions
diff --git a/admin/nt/dist-build/emacs.nsi b/admin/nt/dist-build/emacs.nsi
index 557bb106dde..b8226d69423 100644
--- a/admin/nt/dist-build/emacs.nsi
+++ b/admin/nt/dist-build/emacs.nsi
@@ -8,7 +8,10 @@ Outfile "emacs-${OUT_VERSION}-installer.exe"
8SetCompressor /solid lzma 8SetCompressor /solid lzma
9 9
10Var StartMenuFolder 10Var StartMenuFolder
11Var UninstallerPath
11 12
13!define UNINST_KEY \
14 "Software\Microsoft\Windows\CurrentVersion\Uninstall\emacs-${VERSION_BRANCH}"
12 15
13!define MUI_WELCOMEPAGE_TITLE "Emacs" 16!define MUI_WELCOMEPAGE_TITLE "Emacs"
14!define MUI_WELCOMEPAGE_TITLE_3LINES 17!define MUI_WELCOMEPAGE_TITLE_3LINES
@@ -20,16 +23,27 @@ Var StartMenuFolder
20 23
21!insertmacro MUI_PAGE_WELCOME 24!insertmacro MUI_PAGE_WELCOME
22 25
23 26# licensing/about click-though page
24!define MUI_LICENSEPAGE_TEXT_TOP "The GNU General Public License" 27!define MUI_PAGE_HEADER_TEXT "Emacs is Free Software"
28!define MUI_PAGE_HEADER_SUBTEXT "A component of the GNU operating system."
29!define MUI_LICENSEPAGE_TEXT_TOP "This program is free software."
30!define MUI_LICENSEPAGE_TEXT_BOTTOM "You can redistribute this program and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License (as above), or (at your option) any later version."
31!define MUI_LICENSEPAGE_BUTTON "OK"
25!insertmacro MUI_PAGE_LICENSE "emacs-${VERSION_BRANCH}\share\emacs\${EMACS_VERSION}\lisp\COPYING" 32!insertmacro MUI_PAGE_LICENSE "emacs-${VERSION_BRANCH}\share\emacs\${EMACS_VERSION}\lisp\COPYING"
26 33
34# user option page: installation path
27!insertmacro MUI_PAGE_DIRECTORY 35!insertmacro MUI_PAGE_DIRECTORY
28!insertmacro MUI_PAGE_INSTFILES
29 36
37# user option page: start menu shortcut
30!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder 38!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
31 39
40# user option confirm/begin install
41!insertmacro MUI_PAGE_INSTFILES
42
43# uninstaller confirmation/options (no options)
32!insertmacro MUI_UNPAGE_CONFIRM 44!insertmacro MUI_UNPAGE_CONFIRM
45
46# uninstaller begin
33!insertmacro MUI_UNPAGE_INSTFILES 47!insertmacro MUI_UNPAGE_INSTFILES
34 48
35!insertmacro MUI_LANGUAGE "English" 49!insertmacro MUI_LANGUAGE "English"
@@ -39,23 +53,35 @@ function .onInit
39 StrCpy $INSTDIR "$PROGRAMFILES64\Emacs" 53 StrCpy $INSTDIR "$PROGRAMFILES64\Emacs"
40functionend 54functionend
41 55
42 56# main section logic, run after confirming installation
43Section 57Section
44 58
45 SetOutPath $INSTDIR 59 # insisting on installing shortcuts for "all users"
60 # might ensure uninstall can remove shortcuts we created
61 # SetShellVarContext all
46 62
63 # extract program files
64 SetOutPath $INSTDIR
47 File /r emacs-${VERSION_BRANCH} 65 File /r emacs-${VERSION_BRANCH}
48 66
49 # define uninstaller name 67 # define uninstaller name
50 WriteUninstaller $INSTDIR\Uninstall.exe 68 StrCpy $UninstallerPath "$INSTDIR\Uninstall-${VERSION_BRANCH}.exe"
69
70 # create uninstaller
71 WriteUninstaller "$UninstallerPath"
72
73 # add registry key to enable uninstall from control panel
74 WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "GNU Emacs ${VERSION_BRANCH}"
75 WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" "$\"$UninstallerPath$\""
51 76
52 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
53 ;Create shortcuts 77 ;Create shortcuts
78 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
54 CreateDirectory "$SMPROGRAMS\$StartMenuFolder" 79 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
55 CreateShortcut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe" 80 CreateShortcut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" \
56 81 "$UninstallerPath"
82 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Emacs.lnk" \
83 "$INSTDIR\emacs-${VERSION_BRANCH}\bin\runemacs.exe"
57 !insertmacro MUI_STARTMENU_WRITE_END 84 !insertmacro MUI_STARTMENU_WRITE_END
58 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Emacs.lnk" "$INSTDIR\emacs-${VERSION_BRANCH}\bin\runemacs.exe"
59SectionEnd 85SectionEnd
60 86
61 87
@@ -63,15 +89,50 @@ SectionEnd
63# the section will always be named "Uninstall" 89# the section will always be named "Uninstall"
64Section "Uninstall" 90Section "Uninstall"
65 91
66 # Always delete uninstaller first 92 # remove All Users shortcuts only
67 Delete "$INSTDIR\Uninstall.exe" 93 # SetShellVarContext all
94
95 # retreive/recalculate uninstaller location
96 StrCpy $UninstallerPath "$INSTDIR\Uninstall-${VERSION_BRANCH}.exe"
97
98 # remove registry key
99 DeleteRegKey HKLM "${UNINST_KEY}"
68 100
69 # now delete installed directory 101 # delete uninstaller
70 RMDir /r "$INSTDIR" 102 Delete "$INSTDIR\Uninstall-${VERSION_BRANCH}.exe"
71 RMDir "$INSTDIR"
72 103
104 # retreive/reclculate startmenu shortcuts location
73 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder 105 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
106 StrCpy $StartMenuFolder "$SMPROGRAMS\$StartMenuFolder"
107
108 # remove Start Menu Program shortcuts
109 Delete "$StartMenuFolder\Emacs.lnk"
110 Delete "$StartMenuFolder\Uninstall.lnk"
111
112 # remove empty startmenu parents up to $SMPROGRAMS
113 startMenuDeleteLoop:
114 ClearErrors
115 RMDir $StartMenuFolder
116 GetFullPathName $StartMenuFolder "$StartMenuFolder\.."
117 IfErrors startMenuDeleteLoopDone
118 StrCmp $StartMenuFolder $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
119
120 # we're basically using GOTO, above, so we should get here..
121 startMenuDeleteLoopDone:
122
123 # next we remove stuff from program-files/instalation path
124 # start with recursive delete of the Emacs we installed
125 RMDir /r "$INSTDIR\emacs-${VERSION_BRANCH}"
126
127 # now walk parents of installation directory, deleting if empty
128 instDirDeleteLoop:
129 ClearErrors
130 RMDir $INSTDIR
131 GetFullPathName $INSTDIR "$INSTDIR\.."
132 IfErrors instDirDeleteLoopDone
133 StrCmp $INSTDIR $PROGRAMFILES64 instDirDeleteLoopDone instDirDeleteLoop
134
135 # final clean-up (after removing from startmenu and progfiles)
136 instDirDeleteLoopDone:
74 137
75 Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk"
76 RMDir "$SMPROGRAMS\$StartMenuFolder"
77SectionEnd 138SectionEnd