Code

source: microsoft.securityessentials/CLIENT_DATA/delsub3264.ins @ 8f4557

Revision 8f4557, 4.9 KB checked in by geos_one, 5 years ago (diff)

Initial Commit

  • Property mode set to 100644
Line 
1; Copyright (c) uib gmbh (www.uib.de)
2; This sourcecode is owned by uib gmbh
3; and published under the Terms of the General Public License.
4; credits: http://www.opsi.org/en/credits/
5
6
7Set $UninstallProgram32$ = $InstallDir32$ + "\" + $UninstallProg32$
8Set $IniFile32$ = $InstallDir32$ + "\opsi-" + $ProductId$ + ".ini"
9
10Set $UninstallProgram64$ = $InstallDir64$ + "\" + $UninstallProg64$
11Set $IniFile64$ = $InstallDir64$ + "\opsi-" + $ProductId$ + ".ini"
12
13if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
14        if FileExists($IniFile32$)
15                Set $OLD_VERSION$ = GetValueFromInifile($IniFile32$,"COMMON","VERSION","")
16                Set $OLD_CREATOR_TAG$ = GetValueFromInifile($IniFile32$,"COMMON","CREATOR_TAG","")
17                Set $OLD_RELEASE$ = GetValueFromInifile($IniFile32$,"COMMON","RELEASE","")
18        endif
19        Message "Uninstalling " + $ProductId$ + " "+ $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " 32 Bit..."
20
21        if FileExists($IniFile32$)
22                Set $UninstallProg32$ = GetValueFromInifile($IniFile32$,"X86","UninstallProg32","XXXXXXXX.exe")
23                Set $UninstallProgramOld32$ = $InstallDir32$ + "\" + $UninstallProg32$
24                if FileExists($UninstallProgramOld32$)
25                        comment "Uninstall program found, starting uninstall"
26                        Winbatch_uninstall_old_32
27                        sub_check_exitcode
28                endif
29        endif
30        if FileExists($UninstallProgram32$)
31                comment "Uninstall program found, starting uninstall"
32                Winbatch_uninstall_32
33                sub_check_exitcode
34        endif
35
36        comment "Delete files"
37        Files_uninstall_32 /32Bit
38        comment "Cleanup registry"
39        Registry_uninstall /32Bit
40endif
41
42if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
43        if FileExists($IniFile64$)
44                Set $OLD_VERSION$ = GetValueFromInifile($IniFile64$,"COMMON","VERSION","")
45                Set $OLD_CREATOR_TAG$ = GetValueFromInifile($IniFile64$,"COMMON","CREATOR_TAG","")
46                Set $OLD_RELEASE$ = GetValueFromInifile($IniFile64$,"COMMON","RELEASE","")
47        endif
48        Message "Uninstalling " + $ProductId$ + " "+ $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " 64 Bit..."
49
50        if FileExists($IniFile64$)
51                Set $UninstallProg64$ = GetValueFromInifile($IniFile64$,"X86_64","UninstallProg64","XXXXXXXX.exe")
52                Set $UninstallProgramOld64$ = $InstallDir64$ + "\" + $UninstallProg64$
53                if FileExists($UninstallProgramOld64$)
54                        comment "Uninstall program found, starting uninstall"
55                        Winbatch_uninstall_old_64
56                        sub_check_exitcode
57                endif
58        endif
59        if FileExists($UninstallProgram64$)
60                comment "Uninstall program found, starting uninstall"
61                Winbatch_uninstall_64
62                sub_check_exitcode
63        endif
64
65        comment "Delete files"
66        Files_uninstall_64 /64Bit
67        comment "Cleanup registry"
68        Registry_uninstall /64Bit
69endif
70
71comment "Delete program shortcuts"
72LinkFolder_uninstall
73
74[Winbatch_uninstall_old_32]
75"$UninstallProgramOld32$" /s /u
76
77[Winbatch_uninstall_32]
78"$UninstallProgram32$" /s /u
79
80[Files_uninstall_32]
81; Example for recursively deleting the installation directory (don't forget the trailing backslash):
82;
83delete -sf "$InstallDir32$\"
84
85[Winbatch_uninstall_old_64]
86"$UninstallProgramOld64$" /s /u
87
88[Winbatch_uninstall_64]
89"$UninstallProgram64$" /s /u
90
91[Files_uninstall_64]
92; Example for recursively deleting the installation directory:
93;
94del -sf "$InstallDir64$\"
95
96[Registry_uninstall]
97; Example of deleting a registry key:
98;
99; deletekey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
100
101[LinkFolder_uninstall]
102; Example of deleting a folder from AllUsers startmenu:
103;
104; set_basefolder common_programs
105; delete_subfolder $ProductId$
106;
107; Example of deleting a shortcut from AllUsers desktop:
108;
109; set_basefolder common_desktopdirectory
110; set_subfolder ""
111; delete_element $ProductId$
112
113[Sub_check_exitcode]
114comment "Test for installation success via exit code"
115set $ExitCode$ = getLastExitCode
116; informations to exit codes see
117; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
118; http://msdn.microsoft.com/en-us/library/aa368542.aspx
119if ($ExitCode$ = "0")
120        comment "Looks good: setup program gives exitcode zero"
121else
122        comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
123        if ($ExitCode$ = "1605")
124                comment "ERROR_UNKNOWN_PRODUCT  1605    This action is only valid for products that are currently installed."
125                comment "Uninstall of a not installed product failed - no problem"
126        else
127                if ($ExitCode$ = "1641")
128                        comment "looks good: setup program gives exitcode 1641"
129                        comment "ERROR_SUCCESS_REBOOT_INITIATED 1641    The installer has initiated a restart. This message is indicative of a success."
130                else
131                        if ($ExitCode$ = "3010")
132                                comment "looks good: setup program gives exitcode 3010"
133                                comment "ERROR_SUCCESS_REBOOT_REQUIRED  3010    A restart is required to complete the install. This message is indicative of a success."
134                        else
135                                logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
136                                isFatalError
137                        endif
138                endif
139        endif
140endif
141
Note: See TracBrowser for help on using the repository browser.