]> git.lyx.org Git - features.git/blob - development/Win32/packaging/installer/setup/uninstall.nsh
installer: bugfixes, code simplification and documentation
[features.git] / development / Win32 / packaging / installer / setup / uninstall.nsh
1 /*
2
3 uninstall.nsh
4
5 Uninstall 
6
7 */
8
9 Var FileAssociation
10
11 # ----------------------------------
12
13 Section "un.LyX" un.SecUnProgramFiles
14
15   # LaTeX class files that were installed together with LyX
16   # will not be uninstalled because other LyX versions will
17   # need them and these few files don't harm to stay in LaTeX 
18     
19   # Binaries
20   #!insertmacro FileListLyXBin Delete "$INSTDIR\bin\"
21   #!insertmacro FileListQtBin Delete "$INSTDIR\bin\"
22   #!insertmacro FileListDll Delete "$INSTDIR\bin\"
23   #!insertmacro FileListMSVC Delete "$INSTDIR\bin\"
24   #!insertmacro FileListNetpbmBin Delete "$INSTDIR\bin\"
25   #!insertmacro FileListDTLBin Delete "$INSTDIR\bin\"
26   #!insertmacro FileListDvipostBin Delete "$INSTDIR\bin\"
27   #!insertmacro FileListPDFToolsBin Delete "$INSTDIR\bin\"
28   #!insertmacro FileListPDFViewBin Delete "$INSTDIR\bin\"
29   #!insertmacro FileListMetaFile2EPS Delete "$INSTDIR\bin\"
30   RMDir /r "$INSTDIR\bin"
31
32   # Resources
33   RMDir /r "$INSTDIR\Resources"
34   
35   # Python
36   RMDir /r "$INSTDIR\python"
37   
38   # Components of ImageMagick
39   #!insertmacro FileListImageMagick Delete "$INSTDIR\imagemagick\"
40   #!insertmacro FileListMSVC Delete "$INSTDIR\imagemagick\"
41   RMDir /r "$INSTDIR\imagemagick"
42   
43   # Components of Ghostscript
44   #!insertmacro FileListGhostscript Delete "$INSTDIR\ghostscript\"
45   #!insertmacro FileListMSVC Delete "$INSTDIR\ghostscript\"
46   RMDir /r "$INSTDIR\ghostscript"
47   
48   # delete start menu folder
49   ReadRegStr $0 SHCTX "${APP_UNINST_KEY}" "StartMenu"
50   RMDir /r "$0"
51   #Delete "$SMPROGRAMS\${APP_NAME} ${APP_SERIES_NAME}.lnk"
52   # delete desktop icon
53   Delete "$DESKTOP\${APP_NAME} ${APP_SERIES_NAME}.lnk"
54   
55   # remove file extension .lyx
56   ReadRegStr $0 SHCTX "${APP_DIR_REGKEY}" "OnlyWithLyX" # special entry to test if they were registered by this LyX version
57   ${if} $0 == "Yes${APP_SERIES_KEY}"
58    ReadRegStr $R0 SHCTX "Software\Classes\${APP_EXT}" ""
59    ${if} $R0 == "${APP_REGNAME_DOC}"
60     DeleteRegKey SHCTX "Software\Classes\${APP_EXT}13"
61     DeleteRegKey SHCTX "Software\Classes\${APP_EXT}14"
62     DeleteRegKey SHCTX "Software\Classes\${APP_EXT}15"
63     DeleteRegKey SHCTX "Software\Classes\${APP_EXT}16"
64    # enable this for LyX 2.1!
65    # DeleteRegKey SHCTX "Software\Classes\${APP_EXT}20"
66     DeleteRegKey SHCTX "Software\Classes\${APP_EXT}"
67     DeleteRegKey SHCTX "Software\Classes\${APP_REGNAME_DOC}"
68    ${endif}
69   ${endif}
70   ${if} $MultiUser.Privileges == "Admin"
71    DeleteRegKey HKCR "LyX.Document"
72   ${endif}
73
74   # Uninstaller itself
75   Delete "$INSTDIR\${SETUP_UNINSTALLER}"
76   
77   # Application folder
78   SetOutPath "$TEMP"
79   RMDir /r "$INSTDIR"
80   
81   # Registry keys
82   DeleteRegKey SHCTX "${APP_REGKEY_SETUP}"
83   DeleteRegKey SHCTX "${APP_REGKEY}"
84   DeleteRegKey SHCTX "${APP_UNINST_KEY}"
85   DeleteRegKey HKCR "Applications\lyx.exe"
86   
87   # File associations
88   ReadRegStr $FileAssociation SHELL_CONTEXT "Software\Classes\${APP_EXT}" ""
89   
90   ${If} $FileAssociation == "${APP_REGNAME_DOC}"
91      DeleteRegKey SHELL_CONTEXT "Software\Classes\${APP_EXT}"
92   ${EndIf}
93   
94   ${If} $MultiUser.Privileges != "Admin"
95     ${OrIf} $MultiUser.Privileges != "Power"
96     # Delete Postscript printer for metafile to EPS conversion
97     ExecWait '$PrinterConf /q /dl /n "Metafile to EPS Converter"'
98   ${EndIf}
99   
100   # clean other registry entries
101   DeleteRegKey SHCTX "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\${APP_NAME}.exe"
102   DeleteRegKey SHCTX "SOFTWARE\${APP_REGKEY}"
103   
104   # delete info that programs were installed together with LyX
105   DeleteRegValue SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef ${JabRefVersion}" "OnlyWithLyX"
106   DeleteRegValue SHCTX "SOFTWARE\MiKTeX.org\MiKTeX" "OnlyWithLyX"  
107
108 SectionEnd
109
110 #---------------------------------
111 # user preferences
112 Section /o "un.$(UnLyXPreferencesTitle)" un.SecUnPreferences
113
114  # remove LyX's config files
115  StrCpy $AppSubfolder ${APP_DIR_USERDATA}
116  Call un.DelAppPathSub # function from LyXUtils.nsh
117   
118 SectionEnd
119
120 #---------------------------------
121 # MiKTeX
122 Section /o "un.MiKTeX" un.SecUnMiKTeX
123
124  ${if} $LaTeXInstalled == "MiKTeX" # only uninstall MiKTeX when it was installed together with LyX 
125   ReadRegStr $1 SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\MiKTeX ${MiKTeXDeliveredVersion}" "UninstallString"
126   ExecWait $1 # run MiKTeX's uninstaller
127  ${endif}
128
129 SectionEnd
130
131 #---------------------------------
132 # JabRef
133 Section "un.JabRef" un.SecUnJabRef
134
135  ${if} $JabRefInstalled == "Yes" # only uninstall JabRef when it was installed together with LyX 
136   ReadRegStr $1 SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef ${JabRefVersion}" "UninstallString"
137   ExecWait "$1" # run JabRef's uninstaller
138  ${endif}
139
140 SectionEnd
141
142 #---------------------------------
143 # Section descriptions
144 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
145 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnMiKTeX} "$(SecUnMiKTeXDescription)"
146 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnJabRef} "$(SecUnJabRefDescription)"
147 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnPreferences} "$(SecUnPreferencesDescription)"
148 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnProgramFiles} "$(SecUnProgramFilesDescription)"
149 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
150
151 #Section "un.User Preferences and Custom Files" un.SecUserFiles
152 #
153 #  SetShellVarContext current
154 #  RMDir /r "$APPDATA\${APP_DIR_USERDATA}"
155 #  
156 #SectionEnd