Code

source: mozilla.firefox/CLIENT_DATA/setup32.ins @ 5b2266

Revision 5b2266, 6.9 KB checked in by silc, 7 years ago (diff)

Updated associations for Windows 8 and removed 32/64 bit script difference

  • Property mode set to 100644
Line 
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]
7requiredWinstVersion >= "4.11.2.6"
8
9DefVar $UninstallProgram$
10DefVar $UninstallProgramOld$
11DefVar $IniFile$
12DefVar $IniCfgFile$
13DefVar $LogDir$
14DefVar $ProductId$ 
15DefVar $MinimumSpace$
16DefVar $InstallDir$
17DefVar $ExitCode$
18DefVar $OLD_VERSION$
19DefVar $OLD_CREATOR_TAG$
20DefVar $OLD_RELEASE$
21
22; DefVar        $InstallDir$
23DefVar  $ProgExe$
24
25Set $LogDir$ = "%SystemDrive%\tmp"
26
27; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
28; and adds the following variables:
29;   from builder-product.cfg :  all variables definded by attribute WINST[index]
30;   from builder-product.cfg :  VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE   
31;   from opsi-builder.cfg    :  CREATOR_TAG CREATOR_NAME CREATOR_EMAIL           
32;   auto generated winst-variables
33;         $IconFile$: path to product picture
34;
35@@BUILDER_VARIABLES@@
36
37; ----------------------------------------------------------------
38; - Please edit the following values                             -
39; ----------------------------------------------------------------
40;$ProductId$ should be the name of the product in opsi
41; therefore please: only lower letters, no umlauts,
42; no white space use '-' as a seperator
43Set $MinimumSpace$    = "200 MB"
44; the path were we find the product after the installation
45Set $InstallDir$      = "%ProgramFiles32Dir%\Mozilla Firefox"
46; ----------------------------------------------------------------
47
48Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini"
49
50if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
51        LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
52        isFatalError "No Space"
53        ; Stop process and set installation status to failed
54else
55        comment "Show product picture"
56        ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $NAME$
57       
58        if FileExists("%ScriptPath%\delsub32.ins")
59                comment "Start uninstall sub section"
60                Sub "%ScriptPath%\delsub32.ins"
61        endif
62       
63        Message "Installing " + $ProductId$ + " "+ $VERSION$ + "-" + $CREATOR_TAG$ + $RELEASE$ + " ..."
64       
65        comment "Start setup program"
66        ChangeDirectory "%SCRIPTPATH%"
67        Winbatch_install
68        Sub_check_exitcode
69       
70        comment create associations
71;       Set $InstallDir$ = $InstallDir32$
72        Set $ProgExe$ = $Prog32$
73        DosInAnIcon_install winst /Sysnative
74       
75        comment "Copy files"
76        Files_install /32Bit
77       
78        comment "Patch Registry"
79        Registry_install /32Bit
80       
81        comment "Create shortcuts"
82        LinkFolder_install
83       
84endif
85
86[DosInAnIcon_install]
87@echo off
88If exist "%System%\defaultassociations.xml" (copy "%System%\defaultassociations.xml" "$LogDir$") ELSE (copy "%ScriptPath%\defaultassociations.xml" "$LogDir$")
89
90rem Handling for X86 installation directory since Windows Vista
91SET InstallDir=$InstallDir$
92for /f "tokens=1-3 delims=\" %%a in ("$InstallDir$") do (
93set a=%%a
94set b=%%b
95set c=%%c
96)
97IF "%b%" == "Program Files (x86)" SET InstallDir=%a%^\Program Files ^^(x86^^)^\%c%
98
99SET Prog=$ProgExe$
100SET Prog=%Prog:~0,-4%
101SET SC=HKLM\Software\Classes
102SET Extn=http-1 https-1 ftp-1
103
104FOR %%j IN (%Extn%) DO (
105
106        FOR /F "tokens=1,2 delims=-" %%A IN ("%%j") DO (
107                REG ADD %SC%\%%A /VE /D "Firefox-%%A" /F
108                REG ADD %SC%\Firefox-%%A /VE /D "%%A Firefox" /F
109                REG ADD %SC%\Firefox-%%A\DefaultIcon /VE /D "$InstallDir$\%Prog%.exe,%%B" /F
110                REG ADD %SC%\Firefox-%%A\shell\open\command /VE /D "\"%InstallDir%\%Prog%.exe\" -osint -url \"%%1\"" /F
111                copy "$LogDir$\defaultassociations.xml" "$LogDir$\defaultassociations.xml.old"
112                xml ed -d /DefaultAssociations/Association[@Identifier='%%A'] "$LogDir$\defaultassociations.xml.old"> "$LogDir$\defaultassociations.xml"
113                copy "$LogDir$\defaultassociations.xml" "$LogDir$\defaultassociations.xml.old"
114                xml ed -s /DefaultAssociations -t elem -n Association_new -v "" -i /DefaultAssociations/Association_new -t attr -n Identifier -v %%A -i /DefaultAssociations/Association_new -t attr -n ProgId -v Firefox-%%A -i /DefaultAssociations/Association_new -t attr -n ApplicationName -v "Mozilla Firefox" -r "/DefaultAssociations/Association_new" -v Association "$LogDir$\defaultassociations.xml.old"> "$LogDir$\defaultassociations.xml"
115        )
116)
117
118rem Set Default Associations for Windows 8
119move "$LogDir$\defaultassociations.xml" "%System%"
120REG ADD HKLM\Software\Policies\Microsoft\Windows\System /V DefaultAssociationsConfiguration /D "%System%\defaultassociations.xml" /F
121
122[Winbatch_install]
123REG ADD HKLM\SOFTWARE\Mozilla\MaintenanceService /v Attempted /t REG_DWORD /d 1 /f
124"$InstallExe$" -ms
125"%ProgramFiles32Dir%\Mozilla Maintenance Service\uninstall.exe" /S
126
127[Files_install]
128; copy the ini file to the InstallDir
129copy "$IniCfgFile$" "$InstallDir$"
130copy "%ScriptPath%\*.cfg" "$InstallDir$"
131copy "%ScriptPath%\local-settings.js" "$InstallDir$\defaults\pref"
132
133[Registry_install]
134; Example of setting some values of an registry key:
135;
136; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
137; set "name1" = "some string value"
138; set "name2" = REG_DWORD:0001
139; set "name3" = REG_BINARY:00 af 99 cd
140
141[LinkFolder_install]
142; Example of deleting a folder from AllUsers startmenu:
143;
144; set_basefolder common_programs
145; delete_subfolder $ProductId$
146;
147; Example of creating an shortcut to the installed exe in AllUsers startmenu:
148;
149; set_basefolder common_programs
150; set_subfolder $ProductId$
151;
152; set_link
153;       name: $ProductId$
154;       target: <path to the program>
155;       parameters:
156;       working_dir: $InstallDir$
157;       icon_file:
158;       icon_index:
159; end_link
160;
161; Example of creating an shortcut to the installed exe on AllUsers desktop:
162;
163; set_basefolder common_desktopdirectory
164; set_subfolder ""
165;
166; set_link
167;       name: $ProductId$
168;       target: <path to the program>
169;       parameters: <some_param>
170;       working_dir: $InstallDir$
171;       icon_file: <path to icon file>
172;       icon_index: 2
173; end_link
174
175[Sub_check_exitcode]
176comment "Test for installation success via exit code"
177set $ExitCode$ = getLastExitCode
178; informations to exit codes see
179; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
180; http://msdn.microsoft.com/en-us/library/aa368542.aspx
181if ($ExitCode$ = "0")
182        comment "Looks good: setup program gives exitcode zero"
183else
184        comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
185        if ($ExitCode$ = "1605")
186                comment "ERROR_UNKNOWN_PRODUCT  1605    This action is only valid for products that are currently installed."
187                comment "Uninstall of a not installed product failed - no problem"
188        else
189                if ($ExitCode$ = "1641")
190                        comment "looks good: setup program gives exitcode 1641"
191                        comment "ERROR_SUCCESS_REBOOT_INITIATED 1641    The installer has initiated a restart. This message is indicative of a success."
192                else
193                        if ($ExitCode$ = "3010")
194                                comment "looks good: setup program gives exitcode 3010"
195                                comment "ERROR_SUCCESS_REBOOT_REQUIRED  3010    A restart is required to complete the install. This message is indicative of a success."
196                        else
197                                logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
198                                isFatalError
199                        endif
200                endif
201        endif
202endif
203
Note: See TracBrowser for help on using the repository browser.