2008-11-04 Colin Leroy <colin@colino.net>
[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   StrCpy $MYTMP "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRETTY_PACKAGE_SHORT}"
28   WriteRegExpandStr HKLM $MYTMP "UninstallString" '"$INSTDIR\${PACKAGE}-uninstall.exe"'
29   WriteRegExpandStr HKLM $MYTMP "InstallLocation" "$INSTDIR"
30   WriteRegStr       HKLM $MYTMP "DisplayName"     "${PRETTY_PACKAGE}"
31   WriteRegStr       HKLM $MYTMP "DisplayIcon"     "$INSTDIR\gpg.exe,0"
32   WriteRegStr       HKLM $MYTMP "DisplayVersion"  "${VERSION}"
33   WriteRegStr       HKLM $MYTMP "Publisher"       "The Gpg4win Project"
34   WriteRegStr       HKLM $MYTMP "URLInfoAbout"    "http://www.gpg4win.org/"
35   WriteRegDWORD     HKLM $MYTMP "NoModify"        "1"
36   WriteRegDWORD     HKLM $MYTMP "NoRepair"        "1"
37 SectionEnd
38
39
40 Section Uninstall
41
42 !ifdef HAVE_STARTMENU
43   # Make sure that the context of the automatic variables has been set to
44   # the "all users" shell folder.  This guarantees that the menu gets written
45   # for all users.  We have already checked that we are running as Admin; or
46   # we printed a warning that installation will not succeed.
47   SetShellVarContext all
48
49   #---------------------------------------------------
50   # Delete the menu entries and any empty parent menus
51   #---------------------------------------------------
52   !insertmacro MUI_STARTMENU_GETFOLDER Application $MYTMP
53   g4wihelp::config_fetch "inst_start_menu_folder"
54   StrCmp $R0 "" +2
55   StrCpy $MYTMP $R0
56   Delete "$SMPROGRAMS\$MYTMP\*.lnk"
57   Delete "$SMPROGRAMS\$MYTMP\$(DESC_Menu_manuals)\*.lnk"
58   RMDir "$SMPROGRAMS\$MYTMP\$(DESC_Menu_manuals)"
59
60   RMDir "$SMPROGRAMS\$MYTMP\$(DESC_Desktop_manuals)"
61   StrCpy $MYTMP "$SMPROGRAMS\$MYTMP"
62   startMenuDeleteLoop:
63     ClearErrors
64     RMDir $MYTMP
65     GetFullPathName $MYTMP "$MYTMP\.."
66     IfErrors startMenuDeleteLoopDone
67     StrCmp $MYTMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
68   startMenuDeleteLoopDone:
69
70   DeleteRegValue HKLM "Software\GNU\${PRETTY_PACKAGE_SHORT}" \
71         "Start Menu Folder"
72
73
74   # Delete Desktop links.
75 !ifdef HAVE_PKG_WINPT
76   Delete "$DESKTOP\WinPT.lnk"
77 !endif
78 !ifdef HAVE_PKG_GPA
79   Delete "$DESKTOP\GPA.lnk"
80 !endif
81 !ifdef HAVE_PKG_KLEOPATRA
82   Delete "$DESKTOP\Kleopatra.lnk"
83 !endif
84 !ifdef HAVE_PKG_SYLPHEED_CLAWS
85   Delete "$DESKTOP\Sylpheed-Claws.lnk"
86   Delete "$DESKTOP\Sylpheed-Claws Manual.lnk" \
87   # We better delete also the name we used prior to 1.0.3
88   Delete "$DESKTOP\Sylpheed.lnk"
89 !endif
90 !ifdef HAVE_PKG_CLAWS_MAIL
91   Delete "$DESKTOP\Claws-Mail.lnk"
92   Delete "$DESKTOP\$(DESC_Desktop_manuals)\Claws-Mail Manual.lnk"
93 !endif
94 !ifdef HAVE_PKG_COMPENDIUM_DE
95   Delete "$DESKTOP\$(DESC_Desktop_manuals)\$(DESC_Name_compendium_de).lnk"
96 !endif
97 !ifdef HAVE_PKG_MAN_NOVICE_DE
98   Delete "$DESKTOP\$(DESC_Desktop_manuals)\$(DESC_Name_man_novice_de).lnk"
99 !endif
100 !ifdef HAVE_PKG_MAN_NOVICE_EN
101   Delete "$DESKTOP\$(DESC_Desktop_manuals)\$(DESC_Name_man_novice_en).lnk"
102 !endif
103 !ifdef HAVE_PKG_MAN_ADVANCED_DE
104   Delete "$DESKTOP\$(DESC_Desktop_manuals)\$(DESC_Name_man_advanced_de).lnk"
105 !endif
106 !ifdef HAVE_PKG_GPGEE
107   Delete "$DESKTOP\$(DESC_Desktop_manuals)\GPGee Manual.lnk"
108 !endif
109   Delete "$DESKTOP\$(DESC_Desktop_manuals)\GnuPG FAQ.lnk"
110   Delete "$DESKTOP\$(DESC_Desktop_manuals)\Gpg4Win README.lnk"
111   RMDir "$DESKTOP\$(DESC_Desktop_manuals)"
112
113   # Delete Quick Launch Bar links.
114   StrCmp $QUICKLAUNCH $TEMP no_quick_launch_uninstall
115 !ifdef HAVE_PKG_WINPT
116   Delete "$QUICKLAUNCH\WinPT.lnk"
117 !endif
118 !ifdef HAVE_PKG_GPA
119   Delete "$QUICKLAUNCH\GPA.lnk"
120 !endif
121 !ifdef HAVE_PKG_KLEOPATRA
122   Delete "$QUICKLAUNCH\Kleopatra.lnk"
123 !endif
124 !ifdef HAVE_PKG_SYLPHEED_CLAWS
125   Delete "$QUICKLAUNCH\Sylpheed-Claws.lnk"
126   # We better delete also the name we used prior to 1.0.3
127   Delete "$QUICKLAUNCH\Sylpheed.lnk"
128 !endif
129 !ifdef HAVE_PKG_CLAWS_MAIL
130   Delete "$QUICKLAUNCH\Claws-Mail.lnk"
131 !endif
132 !ifdef HAVE_PKG_COMPENDIUM_DE
133   Delete "$QUICKLAUNCH\$(DESC_Name_compendium_de).lnk"
134 !endif
135 !ifdef HAVE_PKG_MAN_NOVICE_DE
136   Delete "$QUICKLAUNCH\$(DESC_Name_man_novice_de).lnk"
137 !endif
138 !ifdef HAVE_PKG_MAN_ADVANCED_DE
139   Delete "$QUICKLAUNCH\$(DESC_Name_man_advanced_de).lnk"
140 !endif
141 !ifdef HAVE_PKG_GPGEE
142   Delete "$QUICKLAUNCH\GPGee Manual.lnk"
143 !endif
144   Delete "$QUICKLAUNCH\GnuPG FAQ.lnk"
145   Delete "$QUICKLAUNCH\Gpg4Win README.lnk"
146 no_quick_launch_uninstall:
147
148 !endif
149
150   Delete "$INSTDIR\${PACKAGE}-uninstall.exe"
151   RMDir "$INSTDIR"
152
153   # Clean the registry.
154   DeleteRegValue HKLM "Software\GNU\${PRETTY_PACKAGE_SHORT}" \
155         "Install Directory"
156   DeleteRegKey /ifempty HKLM "Software\GNU\${PRETTY_PACKAGE_SHORT}"
157   DeleteRegKey /ifempty HKLM "Software\GNU\GnuPG"
158   DeleteRegKey /ifempty HKLM "Software\GNU"
159
160   # Remove Windows Add/Remove Programs support.
161   DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRETTY_PACKAGE_SHORT}"
162 SectionEnd