]> git.lyx.org Git - features.git/blob - development/Win32/packaging/installer/setup/uninstall.nsh
installer: merge LyXWinInstaller with the new one, see my mail
[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     DeleteRegKey SHCTX "Software\Classes\${APP_EXT}"
65     DeleteRegKey SHCTX "Software\Classes\${APP_REGNAME_DOC}"
66    ${endif}
67   ${endif}
68
69   # Uninstaller itself
70   Delete "$INSTDIR\${SETUP_UNINSTALLER}"
71   
72   # Application folder
73   SetOutPath "$TEMP"
74   RMDir "$INSTDIR"
75   
76   # Registry keys
77   DeleteRegKey SHCTX "${APP_REGKEY_SETUP}"
78   DeleteRegKey SHCTX "${APP_REGKEY}"
79   DeleteRegKey SHCTX "${APP_UNINST_KEY}"
80   DeleteRegKey HKCR "Applications\lyx.exe"
81   
82   # File associations
83   
84   ReadRegStr $FileAssociation SHELL_CONTEXT "Software\Classes\${APP_EXT}" ""
85   
86   ${If} $FileAssociation == "${APP_REGNAME_DOC}"
87      DeleteRegKey SHELL_CONTEXT "Software\Classes\${APP_EXT}"
88   ${EndIf}
89   
90   ${If} $MultiUser.Privileges != "Admin"
91     ${OrIf} $MultiUser.Privileges != "Power"
92
93     # Delete Postscript printer for metafile to EPS conversion
94     ExecWait '$PrinterConf /q /dl /n "Metafile to EPS Converter"'
95
96   ${EndIf}
97
98 SectionEnd
99
100 #---------------------------------
101 # user preferences
102 Section "un.$(UnLyXPreferencesTitle)" un.SecUnPreferences
103
104  # remove LyX's config files
105  StrCpy $AppSubfolder ${APP_DIR_USERDATA}
106  Call un.DelAppPathSub # function from LyXUtils.nsh
107   
108 SectionEnd
109
110 #---------------------------------
111 # MiKTeX
112 Section "un.MiKTeX" un.SecUnMiKTeX
113
114  ${if} $LaTeXInstalled == "MiKTeX" # only uninstall MiKTeX when it was installed together with LyX 
115   ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MiKTeX ${MiKTeXDeliveredVersion}" "UninstallString"
116   ExecWait $1 # run MiKTeX's uninstaller
117  ${endif}
118
119 SectionEnd
120
121 #---------------------------------
122 # JabRef
123 Section "un.JabRef" un.SecUnJabRef
124
125  ${if} $JabRefInstalled == "Yes" # only uninstall JabRef when it was installed together with LyX 
126   ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef ${JabRefVersion}" "UninstallString"
127   ExecWait "$1" # run JabRef's uninstaller
128  ${endif}
129
130 SectionEnd
131
132 #---------------------------------
133 # Section descriptions
134 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
135 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnMiKTeX} "$(SecUnMiKTeXDescription)"
136 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnJabRef} "$(SecUnJabRefDescription)"
137 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnPreferences} "$(SecUnPreferencesDescription)"
138 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnProgramFiles} "$(SecUnProgramFilesDescription)"
139 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
140
141 #Section "un.User Preferences and Custom Files" un.SecUserFiles
142 #
143 #  SetShellVarContext current
144 #  RMDir /r "$APPDATA\${APP_DIR_USERDATA}"
145 #  
146 #SectionEnd