diff --git a/CLIENT_DATA/defaultassociations.xml b/CLIENT_DATA/defaultassociations.xml new file mode 100644 index 0000000..b0d83cf --- /dev/null +++ b/CLIENT_DATA/defaultassociations.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/CLIENT_DATA/setup32.ins b/CLIENT_DATA/setup32.ins index 2d92c9d..41a10e3 100644 --- a/CLIENT_DATA/setup32.ins +++ b/CLIENT_DATA/setup32.ins @@ -19,6 +19,9 @@ DefVar $OLD_VERSION$ DefVar $OLD_CREATOR_TAG$ DefVar $OLD_RELEASE$ +; DefVar $InstallDir$ +DefVar $ProgExe$ + Set $LogDir$ = "%SystemDrive%\tmp" ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh @@ -64,6 +67,11 @@ else Winbatch_install Sub_check_exitcode + comment create associations +; Set $InstallDir$ = $InstallDir32$ + Set $ProgExe$ = $Prog32$ + DosInAnIcon_install winst /Sysnative + comment "Copy files" Files_install /32Bit @@ -75,6 +83,42 @@ else endif +[DosInAnIcon_install] +@echo off +If exist "%System%\defaultassociations.xml" (copy "%System%\defaultassociations.xml" "$LogDir$") ELSE (copy "%ScriptPath%\defaultassociations.xml" "$LogDir$") + +rem Handling for X86 installation directory since Windows Vista +SET InstallDir=$InstallDir$ +for /f "tokens=1-3 delims=\" %%a in ("$InstallDir$") do ( +set a=%%a +set b=%%b +set c=%%c +) +IF "%b%" == "Program Files (x86)" SET InstallDir=%a%^\Program Files ^^(x86^^)^\%c% + +SET Prog=$ProgExe$ +SET Prog=%Prog:~0,-4% +SET SC=HKLM\Software\Classes +SET Extn=http-1 https-1 ftp-1 + +FOR %%j IN (%Extn%) DO ( + + FOR /F "tokens=1,2 delims=-" %%A IN ("%%j") DO ( + REG ADD %SC%\%%A /VE /D "Firefox-%%A" /F + REG ADD %SC%\Firefox-%%A /VE /D "%%A Firefox" /F + REG ADD %SC%\Firefox-%%A\DefaultIcon /VE /D "$InstallDir$\%Prog%.exe,%%B" /F + REG ADD %SC%\Firefox-%%A\shell\open\command /VE /D "\"%InstallDir%\%Prog%.exe\" -osint -url \"%%1\"" /F + copy "$LogDir$\defaultassociations.xml" "$LogDir$\defaultassociations.xml.old" + xml ed -d /DefaultAssociations/Association[@Identifier='%%A'] "$LogDir$\defaultassociations.xml.old"> "$LogDir$\defaultassociations.xml" + copy "$LogDir$\defaultassociations.xml" "$LogDir$\defaultassociations.xml.old" + 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" + ) +) + +rem Set Default Associations for Windows 8 +move "$LogDir$\defaultassociations.xml" "%System%" +REG ADD HKLM\Software\Policies\Microsoft\Windows\System /V DefaultAssociationsConfiguration /D "%System%\defaultassociations.xml" /F + [Winbatch_install] REG ADD HKLM\SOFTWARE\Mozilla\MaintenanceService /v Attempted /t REG_DWORD /d 1 /f "$InstallExe$" -ms diff --git a/builder-product.cfg b/builder-product.cfg index e82be85..ae386cd 100644 --- a/builder-product.cfg +++ b/builder-product.cfg @@ -29,3 +29,11 @@ ICON_DL_INDEX=0 OPSI_INI_SECTION[0]="X86" OPSI_INI_OPTION[0]="UninstallProg" OPSI_INI_VALUE[0]="uninstall\helper.exe" + +OPSI_INI_SECTION[1]="X86" +OPSI_INI_OPTION[1]="Prog32" +OPSI_INI_VALUE[1]="firefox.exe" + +OPSI_INI_SECTION[2]="X86_64" +OPSI_INI_OPTION[2]="Prog64" +OPSI_INI_VALUE[2]="firefox.exe"