Do not create uninstaller shortcut
[gpg4win.git] / src / installer-finish.nsi
1 # installer-finish.nsi - Installer for GPG4Win.      -*- coding: latin-1; -*-
2 # Copyright (C) 2005, 2008 g10 Code GmbH
3
4 # This file is part of GPG4Win.
5
6 # GPG4Win is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10
11 # GPG4Win is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19
20 Var MYTMP
21
22 # Last section is a hidden one.
23 Section
24   WriteUninstaller "$INSTDIR\${PACKAGE}-uninstall.exe"
25
26   # Windows Add/Remove Programs support
27   # Note that the version is appended to the DisplayName, despite that
28   # this is not necessary as a click on "support information" gives
29   # the version number.  Some tools do that, other don't.  I don't
30   # like it but others want me to do that.  -wk
31   StrCpy $MYTMP "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRETTY_PACKAGE_SHORT}"
32   WriteRegExpandStr HKLM $MYTMP "UninstallString" '"$INSTDIR\${PACKAGE}-uninstall.exe"'
33   WriteRegExpandStr HKLM $MYTMP "InstallLocation" "$INSTDIR"
34   WriteRegStr       HKLM $MYTMP "DisplayName"     "${PRETTY_PACKAGE} (${VERSION})"
35   WriteRegStr       HKLM $MYTMP "DisplayIcon"     "$INSTDIR\bin\kleopatra.exe,0"
36   WriteRegStr       HKLM $MYTMP "DisplayVersion"  "${VERSION}"
37   WriteRegStr       HKLM $MYTMP "Publisher"       "The Gpg4win Project"
38   WriteRegStr       HKLM $MYTMP "URLInfoAbout"    "http://www.gpg4win.org/"
39   WriteRegDWORD     HKLM $MYTMP "NoModify"        "1"
40   WriteRegDWORD     HKLM $MYTMP "NoRepair"        "1"
41 SectionEnd
42
43
44 Section Uninstall
45
46 !ifdef HAVE_STARTMENU
47   # Make sure that the context of the automatic variables has been set to
48   # the "all users" shell folder.  This guarantees that the menu gets written
49   # for all users.  We have already checked that we are running as Admin; or
50   # we printed a warning that installation will not succeed.
51   SetShellVarContext all
52
53   #---------------------------------------------------
54   # Delete the menu entries and any empty parent menus
55   #---------------------------------------------------
56   !insertmacro MUI_STARTMENU_GETFOLDER Application $MYTMP
57   g4wihelp::config_fetch "inst_start_menu_folder"
58   StrCmp $R0 "" +2
59   StrCpy $MYTMP $R0
60   Delete "$SMPROGRAMS\$MYTMP\*.lnk"
61   Delete "$SMPROGRAMS\$MYTMP\$(DESC_Menu_manuals)\*"
62   RMDir "$SMPROGRAMS\$MYTMP\$(DESC_Menu_manuals)"
63
64   RMDir "$SMPROGRAMS\$MYTMP\$(DESC_Desktop_manuals)"
65   StrCpy $MYTMP "$SMPROGRAMS\$MYTMP"
66   startMenuDeleteLoop:
67     ClearErrors
68     RMDir $MYTMP
69     GetFullPathName $MYTMP "$MYTMP\.."
70     IfErrors startMenuDeleteLoopDone
71     StrCmp $MYTMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
72   startMenuDeleteLoopDone:
73
74   DeleteRegValue HKLM "Software\GNU\${PRETTY_PACKAGE_SHORT}" \
75         "Start Menu Folder"
76
77
78   # Delete Desktop links.
79 !ifdef HAVE_PKG_WINPT
80   Delete "$DESKTOP\WinPT.lnk"
81 !endif
82 !ifdef HAVE_PKG_GPA
83   Delete "$DESKTOP\GPA.lnk"
84 !endif
85 !ifdef HAVE_PKG_KLEOPATRA
86   Delete "$DESKTOP\Kleopatra.lnk"
87 !endif
88 !ifdef HAVE_PKG_SYLPHEED_CLAWS
89   Delete "$DESKTOP\Sylpheed-Claws.lnk"
90   Delete "$DESKTOP\Sylpheed-Claws Manual.lnk" \
91   # We better delete also the name we used prior to 1.0.3
92   Delete "$DESKTOP\Sylpheed.lnk"
93 !endif
94 !ifdef HAVE_PKG_CLAWS_MAIL
95   Delete "$DESKTOP\Claws-Mail.lnk"
96   Delete "$DESKTOP\$(DESC_Desktop_manuals)\Claws-Mail Manual.lnk"
97 !endif
98 !ifdef HAVE_PKG_COMPENDIUM
99   Delete "$DESKTOP\$(DESC_Desktop_manuals)\$(DESC_Name_compendium_de_html).lnk"
100   Delete "$DESKTOP\$(DESC_Desktop_manuals)\$(DESC_Name_compendium_de_html).url"
101   Delete "$DESKTOP\$(DESC_Desktop_manuals)\$(DESC_Name_compendium_de_pdf).lnk"
102   Delete "$DESKTOP\$(DESC_Desktop_manuals)\$(DESC_Name_compendium_en_html).lnk"
103   Delete "$DESKTOP\$(DESC_Desktop_manuals)\$(DESC_Name_compendium_en_html).url"
104   Delete "$DESKTOP\$(DESC_Desktop_manuals)\$(DESC_Name_compendium_en_pdf).lnk"
105 !endif
106 !ifdef HAVE_PKG_MAN_NOVICE_DE
107   Delete "$DESKTOP\$(DESC_Desktop_manuals)\$(DESC_Name_man_novice_de).lnk"
108 !endif
109 !ifdef HAVE_PKG_MAN_NOVICE_EN
110   Delete "$DESKTOP\$(DESC_Desktop_manuals)\$(DESC_Name_man_novice_en).lnk"
111 !endif
112 !ifdef HAVE_PKG_MAN_ADVANCED_DE
113   Delete "$DESKTOP\$(DESC_Desktop_manuals)\$(DESC_Name_man_advanced_de).lnk"
114 !endif
115 !ifdef HAVE_PKG_GPGEE
116   Delete "$DESKTOP\$(DESC_Desktop_manuals)\GPGee Manual.lnk"
117 !endif
118   Delete "$DESKTOP\$(DESC_Desktop_manuals)\GnuPG FAQ.lnk"
119   Delete "$DESKTOP\$(DESC_Desktop_manuals)\Gpg4Win README.lnk"
120   Delete "$DESKTOP\$(DESC_Desktop_manuals)\Gpg4win README.lnk"
121   Delete "$DESKTOP\$(DESC_Desktop_manuals)\Gpg4win HOWTO SMIME.lnk"
122   RMDir "$DESKTOP\$(DESC_Desktop_manuals)"
123
124   # Delete Quick Launch Bar links.
125   StrCmp $QUICKLAUNCH $TEMP no_quick_launch_uninstall
126 !ifdef HAVE_PKG_WINPT
127   Delete "$QUICKLAUNCH\WinPT.lnk"
128 !endif
129 !ifdef HAVE_PKG_GPA
130   Delete "$QUICKLAUNCH\GPA.lnk"
131 !endif
132 !ifdef HAVE_PKG_KLEOPATRA
133   Delete "$QUICKLAUNCH\Kleopatra.lnk"
134 !endif
135 !ifdef HAVE_PKG_SYLPHEED_CLAWS
136   Delete "$QUICKLAUNCH\Sylpheed-Claws.lnk"
137   # We better delete also the name we used prior to 1.0.3
138   Delete "$QUICKLAUNCH\Sylpheed.lnk"
139 !endif
140 !ifdef HAVE_PKG_CLAWS_MAIL
141   Delete "$QUICKLAUNCH\Claws-Mail.lnk"
142 !endif
143 !ifdef HAVE_PKG_COMPENDIUM
144   Delete "$QUICKLAUNCH\$(DESC_Name_compendium_de).lnk"
145   Delete "$QUICKLAUNCH\$(DESC_Name_compendium_en).lnk"
146 !endif
147 !ifdef HAVE_PKG_MAN_NOVICE_DE
148   Delete "$QUICKLAUNCH\$(DESC_Name_man_novice_de).lnk"
149 !endif
150 !ifdef HAVE_PKG_MAN_ADVANCED_DE
151   Delete "$QUICKLAUNCH\$(DESC_Name_man_advanced_de).lnk"
152 !endif
153 !ifdef HAVE_PKG_GPGEE
154   Delete "$QUICKLAUNCH\GPGee Manual.lnk"
155 !endif
156   Delete "$QUICKLAUNCH\GnuPG FAQ.lnk"
157   Delete "$QUICKLAUNCH\Gpg4Win README.lnk"
158 no_quick_launch_uninstall:
159
160 !endif
161
162   Delete "$INSTDIR\${PACKAGE}-uninstall.exe"
163   RMDir "$INSTDIR"
164
165   # If we installed in the default location, try to be really, really
166   # nice with sugar on it to clean up behind us.  In any case, try very
167   # hard to get rid of directories which could have REBOOTOK files.
168   RMDir /REBOOTOK "$INSTDIR\bin"
169   RMDir /REBOOTOK "$INSTDIR"
170
171   # Clean the registry.
172   DeleteRegValue HKLM "Software\${PRETTY_PACKAGE_SHORT}" \
173         "Install Directory"
174   DeleteRegKey /ifempty HKLM "Software\${PRETTY_PACKAGE_SHORT}"
175
176   # Remove Windows Add/Remove Programs support.
177   DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRETTY_PACKAGE_SHORT}"
178 SectionEnd