]> git.lyx.org Git - lyx.git/blob - development/Win32/packaging/installer/LyXWinInstaller/Uninstall.nsh
new Update installer: now hopefully close to be released
[lyx.git] / development / Win32 / packaging / installer / LyXWinInstaller / Uninstall.nsh
1 ; Uninstall sections
2
3 Section "un.LyX" un.SecUnProgramFiles
4
5   SectionIn RO
6
7   ; delete LaTeX class files that were installed together with LyX
8   FileOpen $R5 "$INSTDIR\Resources\uninstallPaths.dat" r
9   FileRead $R5 $LatexPath
10   FileClose $R5
11   StrCpy $String $LatexPath
12   StrCpy $Search "miktex\bin"
13   StrLen $3 $String
14   Call un.StrPoint ; search the LaTeXPath for the phrase "miktex\bin" (function from LyXUtils.nsh)
15   ${if} $Pointer != "-1" ; if something was found
16    IntOp $Pointer $Pointer - 1 ; jump before the first "\" of "\miktex\bin"
17    StrCpy $String $String "$Pointer" ; $String is now the part before "\miktex\bin"
18    Delete "$String\tex\latex\cv.cls"
19    RMDir /r "$String\tex\latex\lyx"
20    RMDir /r "$String\tex\latex\revtex"
21    RMDir /r "$String\tex\latex\hollywood"
22    RMDir /r "$String\tex\latex\broadway"
23    ExecWait "$LatexPath\initexmf --update-fndb"
24   ${endif}
25
26   ; delete LyX's installation folder
27   RMDir /r $INSTDIR
28   ; delete start menu folder
29   ReadRegStr $0 ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "StartMenu"
30   RMDir /r "$0"
31   ; delete desktop icon
32   Delete "$DESKTOP\LyX ${PRODUCT_VERSION}.lnk"
33   ; delete registry entries
34   DeleteRegKey HKCU "${PRODUCT_UNINST_KEY}"
35   DeleteRegKey ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
36   DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
37   DeleteRegKey HKCR "Applications\lyx.exe"
38   DeleteRegKey HKCR "Applications\lyx.bat"
39
40   ; Aiksaurus
41   !insertmacro FileCheck $5 "meanings.dat" "${AiksaurusDir}" ; macro from LyXUtils.nsh
42   ${if} $5 == "True"
43    RMDir /r "${AiksaurusDir}"
44   ${endif}
45 ;  StrCpy $0 ""
46 ;  ReadRegStr $0 HKLM "Software\Aiksaurus" "OnlyWithLyX" ; special entry to test if it was installed with LyX
47 ;  ${if} $0 == "Yes${PRODUCT_VERSION_SHORT}" 
48 ;   ; unregister Aiksaurus
49 ;   ReadRegStr $1 HKLM "Software\Aiksaurus" "Data Path"
50 ;   RMDir /r "$1"
51 ;   DeleteRegKey HKLM "SOFTWARE\Aiksaurus"
52 ;  ${endif}
53
54   ; ImageMagick
55   StrCpy $0 ""
56   ReadRegStr $0 HKLM "Software\ImageMagick" "OnlyWithLyX" ; special entry to test if it was installed with LyX
57   ${if} $0 == "Yes${PRODUCT_VERSION_SHORT}" 
58    ; unregister ImageMagick
59    DeleteRegValue HKLM "SOFTWARE\Classes\Applications" "AutoRun"
60    DeleteRegKey HKLM "SOFTWARE\ImageMagick"
61   ${endif}
62   
63   ; Ghostscript and GSview
64   StrCpy $0 ""
65   StrCpy $5 ""
66   ReadRegStr $0 HKLM "SOFTWARE\GPL Ghostscript" "OnlyWithLyX" ; special entry to test if it was installed with LyX
67   ${if} $0 == "Yes${PRODUCT_VERSION_SHORT}"
68    ; unregister Ghostscript
69    DeleteRegKey HKLM "SOFTWARE\GPL Ghostscript"
70    ; test if GSview is installed
71    EnumRegValue $5 HKLM "Software\Ghostgum\GSview" 0
72    ${if} $5 != ""
73     ; unregister GSview
74     MessageBox MB_ICONINFORMATION|MB_OK "$(UnGSview)"
75     ReadRegStr $3 HKLM "Software\Ghostgum\GSview" "$5"
76     ReadRegStr $4 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\GSview $5" "UninstallString"
77     ExecWait "$4"
78    ${endif}
79   ${endif}
80   
81   ; MiKTeX specific LyX setting 
82   DeleteRegValue HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "MIKTEX_AUTOINSTALL"
83   DeleteRegValue HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "MIKTEX_REPOSITORY"
84   
85   ; remove extension .lyx
86   ${RemoveFileAssociation} "${PRODUCT_EXT}" "${PRODUCT_NAME}"
87   DeleteRegKey HKCR "${PRODUCT_NAME}"
88   
89   SetAutoClose true
90
91 SectionEnd
92
93 ;---------------------------------
94 ; user preferences
95 Section "un.$(UnLyXPreferencesTitle)" un.SecUnPreferences
96
97  ; remove LyX's config files
98  Call un.DelAppPathSub ; function from LyXUtils.nsh
99   
100 SectionEnd
101
102 ;---------------------------------
103 ; Aspell
104 Section "un.Aspell" un.SecUnAspell
105
106  ${if} $AspellInstallYes == "Aspell" ; only uninstall Aspell when it was installed together with LyX 
107   Call un.UninstAspell ; Function from Aspell.nsh
108  ${endif}
109
110 SectionEnd
111
112 ;---------------------------------
113 ; MiKTeX
114 Section "un.MiKTeX" un.SecUnMiKTeX
115
116  ${if} $MiKTeXInstalled == "MiKTeX" ; only uninstall MiKTeX when it was installed together with LyX 
117   ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MiKTeXDeliveredVersion}" "UninstallString"
118   ExecWait "$1" ; run MiKTeX's uninstaller
119  ${endif}
120
121 SectionEnd
122
123 ;---------------------------------
124 ; JabRef
125 Section "un.JabRef" un.SecUnJabRef
126
127  ${if} $JabRefInstalled == "JabRef" ; only uninstall JabRef when it was installed together with LyX 
128   ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${JabRefVersion}" "UninstallString"
129   ExecWait "$1" ; run JabRef's uninstaller
130  ${endif}
131
132 SectionEnd
133
134 ;---------------------------------
135 ; Section descriptions
136 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
137 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnAspell} "$(SecUnAspellDescription)"
138 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnMiKTeX} "$(SecUnMiKTeXDescription)"
139 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnJabRef} "$(SecUnJabRefDescription)"
140 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnPreferences} "$(SecUnPreferencesDescription)"
141 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnProgramFiles} "$(SecUnProgramFilesDescription)"
142 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
143