]> git.lyx.org Git - features.git/blob - development/Win32/packaging/installer/setup/uninstall.nsh
a398fae712e14959e0d88825215db5edef8aba77
[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   SectionIn RO
16   # LaTeX class files that were installed together with LyX
17   # will not be uninstalled because other LyX versions will
18   # need them and these few files don't harm to stay in LaTeX 
19     
20   # Binaries
21   RMDir /r "$INSTDIR\bin"
22
23   # Resources
24   RMDir /r "$INSTDIR\Resources"
25   
26   # Python
27   RMDir /r "$INSTDIR\python"
28   
29   # ImageMagick
30   RMDir /r "$INSTDIR\imagemagick"
31   ReadRegStr $0 SHCTX "SOFTWARE\ImageMagick" "OnlyWithLyX" # test if it was installed together with this LyX version
32   ${if} $0 == "Yes${APP_SERIES_KEY}"
33    WriteRegStr SHCTX "SOFTWARE\Classes\Applications" "AutoRun" ""
34    DeleteRegKey SHCTX "Software\ImageMagick"
35   ${endif}
36   
37   # Components of Ghostscript
38   RMDir /r "$INSTDIR\ghostscript"
39   
40   # delete start menu folder
41   ReadRegStr $0 SHCTX "${APP_UNINST_KEY}" "StartMenu"
42   RMDir /r "$0"
43   # delete desktop icon
44   Delete "$DESKTOP\${APP_NAME} ${APP_SERIES_NAME}.lnk"
45   
46   # remove file extension .lyx
47   ReadRegStr $0 SHCTX "${APP_DIR_REGKEY}" "OnlyWithLyX" # test if they were registered by this LyX version
48   ${if} $0 == "Yes${APP_SERIES_KEY}"
49    ReadRegStr $R0 SHCTX "Software\Classes\${APP_EXT}" ""
50    ${if} $R0 == "${APP_REGNAME_DOC}"
51     DeleteRegKey SHCTX "Software\Classes\${APP_EXT}13"
52     DeleteRegKey SHCTX "Software\Classes\${APP_EXT}14"
53     DeleteRegKey SHCTX "Software\Classes\${APP_EXT}15"
54     DeleteRegKey SHCTX "Software\Classes\${APP_EXT}16"
55     DeleteRegKey SHCTX "Software\Classes\${APP_EXT}20"
56     DeleteRegKey SHCTX "Software\Classes\${APP_EXT}"
57     DeleteRegKey SHCTX "Software\Classes\${APP_REGNAME_DOC}"
58    ${endif}
59   ${endif}
60   ${if} $MultiUser.Privileges == "Admin"
61    DeleteRegKey HKCR "LyX.Document"
62   ${endif}
63
64   # Uninstaller itself
65   Delete "$INSTDIR\${SETUP_UNINSTALLER}"
66   
67   # Application folder
68   SetOutPath "$TEMP"
69   RMDir /r "$INSTDIR"
70   
71   # Registry keys
72   DeleteRegKey SHCTX "${APP_REGKEY_SETUP}"
73   DeleteRegKey SHCTX "${APP_REGKEY}"
74   DeleteRegKey SHCTX "${APP_UNINST_KEY}"
75   DeleteRegKey HKCR "Applications\lyx.exe"
76   
77   # File associations
78   ReadRegStr $FileAssociation SHELL_CONTEXT "Software\Classes\${APP_EXT}" ""
79   
80   ${If} $FileAssociation == "${APP_REGNAME_DOC}"
81      DeleteRegKey SHELL_CONTEXT "Software\Classes\${APP_EXT}"
82   ${EndIf}
83   
84   ${If} $MultiUser.Privileges == "Admin"
85   ${OrIf} $MultiUser.Privileges == "Power"
86    # Delete Postscript printer for metafile to EPS conversion
87    ExecWait '$PrinterConf /q /dl /n "Metafile to EPS Converter"'
88   ${EndIf}
89   
90   # clean other registry entries
91   DeleteRegKey SHCTX "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\${APP_NAME}.exe"
92   DeleteRegKey SHCTX "SOFTWARE\${APP_REGKEY}"
93   
94   # delete info that programs were installed together with LyX
95   DeleteRegValue SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef ${JabRefVersion}" "OnlyWithLyX"
96   DeleteRegValue SHCTX "SOFTWARE\MiKTeX.org\MiKTeX" "OnlyWithLyX"  
97
98 SectionEnd
99
100 #---------------------------------
101 # user preferences
102 Section /o "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 /o "un.MiKTeX" un.SecUnMiKTeX
113
114  ${if} $LaTeXInstalled == "MiKTeX" # only uninstall MiKTeX when it was installed together with LyX 
115   ReadRegStr $1 SHCTX "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   ${If} $MultiUser.Privileges == "Admin"
127   ${OrIf} $MultiUser.Privileges == "Power"
128    ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef ${JabRefVersion}" "UninstallString"
129    ExecWait "$1" # run JabRef's uninstaller
130   ${else}
131    # in this case we can only read the start menu location and then start the linked uninstaller
132    ReadRegStr $1 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef ${JabRefVersion}" "StartMenu"
133    StrCpy $1 "$1\Uninstall JabRef 2.8.lnk"
134    ExecShell "" "$1" # run JabRef's uninstaller
135   ${endif}
136  ${endif}
137
138 SectionEnd
139
140 #---------------------------------
141 # Section descriptions
142 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
143 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnMiKTeX} "$(SecUnMiKTeXDescription)"
144 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnJabRef} "$(SecUnJabRefDescription)"
145 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnPreferences} "$(SecUnPreferencesDescription)"
146 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnProgramFiles} "$(SecUnProgramFilesDescription)"
147 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
148
149 #Section "un.User Preferences and Custom Files" un.SecUserFiles
150 #
151 #  SetShellVarContext current
152 #  RMDir /r "$APPDATA\${APP_DIR_USERDATA}"
153 #  
154 #SectionEnd