1 | ; Copyright (c) uib gmbh (www.uib.de) |
---|
2 | ; This sourcecode is owned by uib |
---|
3 | ; and published under the Terms of the General Public License. |
---|
4 | ; credits: http://www.opsi.org/en/credits/ |
---|
5 | |
---|
6 | [Actions] |
---|
7 | requiredWinstVersion >= "4.11.2.6" |
---|
8 | |
---|
9 | DefVar $UninstallProgram$ |
---|
10 | DefVar $UninstallProgramOld$ |
---|
11 | DefVar $IniFile$ |
---|
12 | DefVar $IniCfgFile$ |
---|
13 | DefVar $LogDir$ |
---|
14 | DefVar $ProductId$ |
---|
15 | DefVar $MinimumSpace$ |
---|
16 | DefVar $InstallDir$ |
---|
17 | DefVar $ExitCode$ |
---|
18 | DefVar $OLD_VERSION$ |
---|
19 | DefVar $OLD_CREATOR_TAG$ |
---|
20 | DefVar $OLD_RELEASE$ |
---|
21 | |
---|
22 | Set $LogDir$ = "%SystemDrive%\tmp" |
---|
23 | |
---|
24 | ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh |
---|
25 | ; and adds the following variables: |
---|
26 | ; from builder-product.cfg : all variables definded by attribute WINST[index] |
---|
27 | ; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE |
---|
28 | ; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL |
---|
29 | ; auto generated winst-variables |
---|
30 | ; $IconFile$: path to product picture |
---|
31 | ; |
---|
32 | @@BUILDER_VARIABLES@@ |
---|
33 | |
---|
34 | ; ---------------------------------------------------------------- |
---|
35 | ; - Please edit the following values - |
---|
36 | ; ---------------------------------------------------------------- |
---|
37 | ;$ProductId$ should be the name of the product in opsi |
---|
38 | ; therefore please: only lower letters, no umlauts, |
---|
39 | ; no white space use '-' as a seperator |
---|
40 | Set $MinimumSpace$ = "30 MB" |
---|
41 | ; the path were we find the product after the installation |
---|
42 | Set $InstallDir$ = "%ProgramFiles32Dir%\Opera" |
---|
43 | ; ---------------------------------------------------------------- |
---|
44 | |
---|
45 | Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini" |
---|
46 | |
---|
47 | if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$)) |
---|
48 | LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$ |
---|
49 | isFatalError "No Space" |
---|
50 | ; Stop process and set installation status to failed |
---|
51 | else |
---|
52 | comment "Show product picture" |
---|
53 | ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $NAME$ |
---|
54 | |
---|
55 | if FileExists("%ScriptPath%\delsub32.ins") |
---|
56 | comment "Start uninstall sub section" |
---|
57 | Sub "%ScriptPath%\delsub32.ins" |
---|
58 | endif |
---|
59 | |
---|
60 | Message "Installing " + $ProductId$ + " "+ $VERSION$ + "-" + $CREATOR_TAG$ + $RELEASE$ + " ..." |
---|
61 | |
---|
62 | comment "Start setup program" |
---|
63 | ChangeDirectory "%SCRIPTPATH%" |
---|
64 | Winbatch_install |
---|
65 | Sub_check_exitcode |
---|
66 | |
---|
67 | comment "Copy files" |
---|
68 | Files_install /32Bit |
---|
69 | |
---|
70 | comment "Patch Registry" |
---|
71 | Registry_install /32Bit |
---|
72 | |
---|
73 | comment "Create shortcuts" |
---|
74 | LinkFolder_install |
---|
75 | |
---|
76 | endif |
---|
77 | |
---|
78 | [Winbatch_install] |
---|
79 | "$InstallExe$" /install /silent /launchopera 0 /desktopshortcut 0 /setdefaultbrowser 0 /quicklaunchshortcut 0 /allusers |
---|
80 | |
---|
81 | [Files_install] |
---|
82 | ; copy the ini file to the InstallDir |
---|
83 | copy "$IniCfgFile$" "$InstallDir$" |
---|
84 | |
---|
85 | ; Example of recursively copying some files into the installation directory: |
---|
86 | ; |
---|
87 | ; copy -s "%ScriptPath%\files\*.*" "$InstallDir$" |
---|
88 | |
---|
89 | [Registry_install] |
---|
90 | ; Example of setting some values of an registry key: |
---|
91 | ; |
---|
92 | ; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$] |
---|
93 | ; set "name1" = "some string value" |
---|
94 | ; set "name2" = REG_DWORD:0001 |
---|
95 | ; set "name3" = REG_BINARY:00 af 99 cd |
---|
96 | |
---|
97 | [LinkFolder_install] |
---|
98 | set_basefolder common_desktopdirectory |
---|
99 | set_subfolder "" |
---|
100 | delete_element "Opera" |
---|
101 | |
---|
102 | ; Example of deleting a folder from AllUsers startmenu: |
---|
103 | ; |
---|
104 | ; set_basefolder common_programs |
---|
105 | ; delete_subfolder $ProductId$ |
---|
106 | ; |
---|
107 | ; Example of creating an shortcut to the installed exe in AllUsers startmenu: |
---|
108 | ; |
---|
109 | ; set_basefolder common_programs |
---|
110 | ; set_subfolder $ProductId$ |
---|
111 | ; |
---|
112 | ; set_link |
---|
113 | ; name: $ProductId$ |
---|
114 | ; target: <path to the program> |
---|
115 | ; parameters: |
---|
116 | ; working_dir: $InstallDir$ |
---|
117 | ; icon_file: |
---|
118 | ; icon_index: |
---|
119 | ; end_link |
---|
120 | ; |
---|
121 | ; Example of creating an shortcut to the installed exe on AllUsers desktop: |
---|
122 | ; |
---|
123 | ; set_basefolder common_desktopdirectory |
---|
124 | ; set_subfolder "" |
---|
125 | ; |
---|
126 | ; set_link |
---|
127 | ; name: $ProductId$ |
---|
128 | ; target: <path to the program> |
---|
129 | ; parameters: <some_param> |
---|
130 | ; working_dir: $InstallDir$ |
---|
131 | ; icon_file: <path to icon file> |
---|
132 | ; icon_index: 2 |
---|
133 | ; end_link |
---|
134 | |
---|
135 | [Sub_check_exitcode] |
---|
136 | comment "Test for installation success via exit code" |
---|
137 | set $ExitCode$ = getLastExitCode |
---|
138 | ; informations to exit codes see |
---|
139 | ; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx |
---|
140 | ; http://msdn.microsoft.com/en-us/library/aa368542.aspx |
---|
141 | if ($ExitCode$ = "0") |
---|
142 | comment "Looks good: setup program gives exitcode zero" |
---|
143 | else |
---|
144 | comment "Setup program gives a exitcode unequal zero: " + $ExitCode$ |
---|
145 | if ($ExitCode$ = "1605") |
---|
146 | comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed." |
---|
147 | comment "Uninstall of a not installed product failed - no problem" |
---|
148 | else |
---|
149 | if ($ExitCode$ = "1641") |
---|
150 | comment "looks good: setup program gives exitcode 1641" |
---|
151 | comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success." |
---|
152 | else |
---|
153 | if ($ExitCode$ = "3010") |
---|
154 | comment "looks good: setup program gives exitcode 3010" |
---|
155 | comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success." |
---|
156 | else |
---|
157 | logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$ |
---|
158 | isFatalError |
---|
159 | endif |
---|
160 | endif |
---|
161 | endif |
---|
162 | endif |
---|
163 | |
---|