]> git.lyx.org Git - features.git/blob - development/Win32/packaging/installer/setup/uninstall.nsh
ce1d49b02cbfb7e174a5d349175a56a2ae3a8da9
[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    # enable this for LyX 2.1!
56    # DeleteRegKey SHCTX "Software\Classes\${APP_EXT}20"
57     DeleteRegKey SHCTX "Software\Classes\${APP_EXT}"
58     DeleteRegKey SHCTX "Software\Classes\${APP_REGNAME_DOC}"
59    ${endif}
60   ${endif}
61   ${if} $MultiUser.Privileges == "Admin"
62    DeleteRegKey HKCR "LyX.Document"
63   ${endif}
64
65   # Uninstaller itself
66   Delete "$INSTDIR\${SETUP_UNINSTALLER}"
67   
68   # Application folder
69   SetOutPath "$TEMP"
70   RMDir /r "$INSTDIR"
71   
72   # Registry keys
73   DeleteRegKey SHCTX "${APP_REGKEY_SETUP}"
74   DeleteRegKey SHCTX "${APP_REGKEY}"
75   DeleteRegKey SHCTX "${APP_UNINST_KEY}"
76   DeleteRegKey HKCR "Applications\lyx.exe"
77   
78   # File associations
79   ReadRegStr $FileAssociation SHELL_CONTEXT "Software\Classes\${APP_EXT}" ""
80   
81   ${If} $FileAssociation == "${APP_REGNAME_DOC}"
82      DeleteRegKey SHELL_CONTEXT "Software\Classes\${APP_EXT}"
83   ${EndIf}
84   
85   ${If} $MultiUser.Privileges == "Admin"
86   ${OrIf} $MultiUser.Privileges == "Power"
87    # Delete Postscript printer for metafile to EPS conversion
88    ExecWait '$PrinterConf /q /dl /n "Metafile to EPS Converter"'
89   ${EndIf}
90   
91   # clean other registry entries
92   DeleteRegKey SHCTX "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\${APP_NAME}.exe"
93   DeleteRegKey SHCTX "SOFTWARE\${APP_REGKEY}"
94   
95   # delete info that programs were installed together with LyX
96   DeleteRegValue SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef ${JabRefVersion}" "OnlyWithLyX"
97   DeleteRegValue SHCTX "SOFTWARE\MiKTeX.org\MiKTeX" "OnlyWithLyX"  
98
99 SectionEnd
100
101 #---------------------------------
102 # user preferences
103 Section /o "un.$(UnLyXPreferencesTitle)" un.SecUnPreferences
104
105  # remove LyX's config files
106  StrCpy $AppSubfolder ${APP_DIR_USERDATA}
107  Call un.DelAppPathSub # function from LyXUtils.nsh
108   
109 SectionEnd
110
111 #---------------------------------
112 # MiKTeX
113 Section /o "un.MiKTeX" un.SecUnMiKTeX
114
115  ${if} $LaTeXInstalled == "MiKTeX" # only uninstall MiKTeX when it was installed together with LyX 
116   ReadRegStr $1 SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\MiKTeX ${MiKTeXDeliveredVersion}" "UninstallString"
117   ExecWait $1 # run MiKTeX's uninstaller
118  ${endif}
119
120 SectionEnd
121
122 #---------------------------------
123 # JabRef
124 Section "un.JabRef" un.SecUnJabRef
125
126  ${if} $JabRefInstalled == "Yes" # only uninstall JabRef when it was installed together with LyX
127   ${If} $MultiUser.Privileges == "Admin"
128   ${OrIf} $MultiUser.Privileges == "Power"
129    ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef ${JabRefVersion}" "UninstallString"
130    ExecWait "$1" # run JabRef's uninstaller
131   ${else}
132    # in this case we can only read the start menu location and then start the linked uninstaller
133    ReadRegStr $1 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef ${JabRefVersion}" "StartMenu"
134    StrCpy $1 "$1\Uninstall JabRef 2.8.lnk"
135    ExecShell "" "$1" # run JabRef's uninstaller
136   ${endif}
137  ${endif}
138
139 SectionEnd
140
141 #---------------------------------
142 # Section descriptions
143 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
144 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnMiKTeX} "$(SecUnMiKTeXDescription)"
145 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnJabRef} "$(SecUnJabRefDescription)"
146 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnPreferences} "$(SecUnPreferencesDescription)"
147 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnProgramFiles} "$(SecUnProgramFilesDescription)"
148 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
149
150 #Section "un.User Preferences and Custom Files" un.SecUserFiles
151 #
152 #  SetShellVarContext current
153 #  RMDir /r "$APPDATA\${APP_DIR_USERDATA}"
154 #  
155 #SectionEnd