====== Freestudio 5.7.1 ====== 2012-12-12\\ Script by uib gmbh \\ Comments and improvements welcome \\ Tested with opsi 4.0.2\\ type: localboot\\ id: freestudio\\ name: FreeStudio Version\\ description: All-in-one Paket der kostenlosen Multimedia-Anwendungen von DVDVideoSoft\\ version: 5.7.1.822\\ Requires dotnetfx, so make a dependency.\\ Full package: http://download.uib.de/opsi4.0/products/contribute/full-package/ ==== setup32.ins ==== ; Copyright (c) uib gmbh (www.uib.de) ; This sourcecode is owned by uib ; and published under the Terms of the General Public License. ; credits: http://www.opsi.org/en/credits/ [Actions] requiredWinstVersion >= "4.11.2.6" DefVar $MsiId$ DefVar $UninstallProgram$ DefVar $LogDir$ DefVar $ProductId$ DefVar $MinimumSpace$ DefVar $InstallDir$ DefVar $ExitCode$ DefVar $commonFiles$ DefVar $RebootFlag$ DefVar $WinstRegKey$ DefVar $searchscope$ DefVar $removeConduit$ DefVar $user$ DefVar $SearchProc$ DefVar $ProcStarted$ DefVar $ProcEnded$ DefVar $TimeOut$ DefStringlist $TimeOutList$ Set $LogDir$ = "%SystemDrive%\opsi.org\tmp" comment "handle Rebootflag" Set $WinstRegKey$ = "HKLM\SOFTWARE\opsi.org\winst" Set $RebootFlag$ = GetRegistryStringValue("["+$WinstRegKey$+"] "+"RebootFlag") Set $ProductId$ = "freestudio" Set $MinimumSpace$ = "5 MB" ; the path were we find the product after the installation Set $InstallDir$ = "%ProgramFiles32Dir%\DVDVideoSoft\Free Studio\" ; ---------------------------------------------------------------- if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$)) LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$ isFatalError ; Stop process and set installation status to failed else comment "Show product picture" ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ comment "backup the actual ie default search scope" set $searchscope$ = getregistrystringvalue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\SearchScopes]") comment "check if conduit is installed" if FileExists("%ProgramFiles32Dir%\Conduit") set $removeConduit$ = "false" else comment "conduit do not exist before Installation - so we will remove it later" set $removeConduit$ = "true" endif if FileExists("%ScriptPath%\delsub32.ins") comment "Start uninstall sub section" Sub "%ScriptPath%\delsub32.ins" endif Message "Installing " + $ProductId$ + " ..." if getmsversioninfo < "6.0" if "" = getregistrystringvalue32("[hklm\software\microsoft\windows\currentversion\uninstall\KB932716-v2] DisplayName") comment "needed (KB932716-v2) is not existing" if ($RebootFlag$ = "KB932716-v2-installed") set $RebootFlag$ = "" Registry_SaveRebootFlag LogError "Error: we installed KB932716-v2 before but it is not existing after reboot" isFatalError else comment "install Image Mastering API v2.0 (IMAPIv2.0) für Windows XP (KB932716)" winbatch_install_imapi Sub_check_exitcode set $RebootFlag$ = "KB932716-v2-installed" Registry_SaveRebootFlag ExitWindows /ImmediateReboot endif else comment "seems to be installed: Image Mastering API v2.0 (IMAPIv2.0) für Windows XP (KB932716)" set $RebootFlag$ = "" Registry_SaveRebootFlag endif endif comment "Start setup program" ;if getmsversioninfo >= "6.0" killtask "iexplore.exe" killtask "firefox.exe" ;endif Files_copy_setup_2_temp ChangeDirectory $LogDir$ if getmsversioninfo >= "6.0" Winbatch_install /WaitForProcessEnding "DVSUpdate.exe" /TimeOutSeconds 300 else Winbatch_install if getLastExitcode = "1" sleepseconds 2 Winbatch_install if getLastExitcode = "1" sleepseconds 2 Winbatch_install if getLastExitcode = "1" sleepseconds 2 Winbatch_install if getLastExitcode = "1" ExitWindows /ImmediateReboot endif endif endif endif set $SearchProc$ = "DVSUpdate.exe" sub_wait_until_proc_finished endif if getmsversioninfo >= "6.0" killtask "iexplore.exe" killtask "firefox.exe" endif Sub_check_exitcode Files_del_setup_temp comment "Deinstall Toolbar" if not (FileExists("%ProgramFiles32Dir%\DVDVideoSoftTB_DE\uninstall.exe")) comment "wait for Toolbar install dir" sleepseconds 10 endif if FileExists("%ProgramFiles32Dir%\DVDVideoSoftTB_DE\uninstall.exe") Execwith_autoit_install "%ScriptPath%\autoit3.exe" winst /LetThemGo Winbatch_deinstall_toolbar Sub_check_exitcode sleepseconds 1 killtask "autoit3.exe" Sub_check_exitcode includelog $LogDir$+"\au3.log" "50" else comment "Toolbar install dir not found" endif if getmsversioninfo >= "6.0" killtask "iexplore.exe" killtask "firefox.exe" endif comment "delete tb installer files" set $commonFiles$ = GetRegistryStringValue32("[hklm\software\microsoft\windows\currentversion] CommonFilesDir" ) Files_del_toolbar /32Bit comment "Remove search entry from Registry" Registry_remove_iesearch /32Bit if $removeConduit$ = "true" Files_del_conduit Registry_del_conduit endif Exitwindows /reboot endif [winbatch_install_imapi] "%ScriptPath%\WindowsXP-KB932716-v2-x86-DEU.exe" /quiet /passive /norestart [Files_copy_setup_2_temp] copy "%ScriptPath%\FreeStudio.exe" "$LogDir$" [Files_del_setup_temp] del "$LogDir$\FreeStudio.exe" [Winbatch_install] ; === Inno Setup ======================================================================================== "$LogDir$\FreeStudio.exe" /sp- /silent /norestart /nocancel /SUPPRESSMSGBOXES [Winbatch_deinstall_toolbar] ; no known silent switch "%ProgramFiles32Dir%\DVDVideoSoftTB_DE\uninstall.exe" [Files_del_toolbar] del "$commonFiles$\DVDVideoSoft\bin\SubscriptionOffer.exe" del -f -s "$commonFiles$\DVDVideoSoft\TB\" del -f -s "%ProgramFiles32Dir%\DVDVideoSoftTB_DE\" [Files_del_conduit] del -f -s "$commonFiles$\conduit\" [Registry_del_conduit] deletekey [HKEY_LOCAL_MACHINE\SOFTWARE\Conduit] [Registry_remove_iesearch] deletekey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\SearchScopes\{afdbddaa-5d3f-42ee-b79c-185a7020515b}] openkey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\SearchScopes] set "" = "$searchscope$" [Execwith_autoit_install] #RequireAdmin ;Blockinput(1) ;run("%ProgramFiles32Dir%\DVDVideoSoftTB_DE\uninstall.exe") ; exact title match Opt("WinTitleMatchMode", 3) $mylog = FileOpen("$LogDir$\au3.log", 2) FileWriteLine($mylog,"auto-it started - waiting for the window") ; do not use winwait(), it will fail on other desktops than current $seconds = 0 $exists = 0 While ($seconds <= 300) and ($exists = 0) $exists = WinExists("Toolbar Uninstall","Are you sure") FileWriteLine($mylog,"winexists result (1=exists): " & $exists ) $seconds = $seconds + 1 sleep(1000) WEnd FileWriteLine($mylog,"window detected - sending answer") ; next $result = ControlClick("Toolbar Uninstall","Are you sure", 1) FileWriteLine($mylog,"answer sended: result (1=success) : " & $result) Blockinput(0) FileClose($mylog) ;Sleep(500) ;and good bye Exit @error [Registry_SaveRebootFlag] openKey [$WinstRegKey$] set "RebootFlag" = "$RebootFlag$" [sub_wait_until_proc_finished] set $ProcStarted$="0" set $ProcEnded$="0" set $TimeOut$="0" set $TimeOutList$= createStringList("0","1","2","3","4","5","6","7","8","end") for %t% in $TimeOutList$ do sub_proclook_and_wait [sub_proclook_and_wait] if ("%t%"="end") set $TimeOut$="1" comment "Timeout reached" endif if ($TimeOut$="0") and ($ProcEnded$="0") if not ("" = takefirststringcontaining(getProcessList,$SearchProc$)) comment $SearchProc$+ " is running" if $ProcStarted$="0" set $ProcStarted$="1" set $ProcEnded$="0" comment $SearchProc$+ " has started" sleepseconds 20 else comment "waiting for ending of "+$SearchProc$ sleepseconds 20 endif else comment $SearchProc$+ " is not running" if $ProcStarted$="1" set $ProcEnded$="1" comment $SearchProc$+ " has ended" else comment "waiting for start of "+$SearchProc$ sleepseconds 20 endif endif endif [Sub_check_exitcode] comment "Test for installation success via exit code" set $ExitCode$ = getLastExitCode ; informations to exit codes see ; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx ; http://msdn.microsoft.com/en-us/library/aa368542.aspx if ($ExitCode$ = "0") comment "Looks good: setup program gives exitcode zero" else comment "Setup program gives a exitcode unequal zero: " + $ExitCode$ if ($ExitCode$ = "1605") comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed." comment "Uninstall of a not installed product failed - no problem" else if ($ExitCode$ = "1641") comment "looks good: setup program gives exitcode 1641" comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success." Exitwindows /Reboot else if ($ExitCode$ = "3010") comment "looks good: setup program gives exitcode 3010" comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success." Exitwindows /Reboot else logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$ isFatalError endif endif endif endif ==== uninstall32.ins ==== ; Copyright (c) uib gmbh (www.uib.de) ; This sourcecode is owned by uib gmbh ; and published under the Terms of the General Public License. ; credits: http://www.opsi.org/en/credits/ [Actions] requiredWinstVersion >= "4.11.2.6" DefVar $MsiId$ DefVar $UninstallProgram$ DefVar $LogDir$ DefVar $ExitCode$ DefVar $ProductId$ DefVar $InstallDir$ DefVar $LicenseRequired$ DefVar $LicensePool$ Set $LogDir$ = "%SystemDrive%\opsi.org\tmp" ; ---------------------------------------------------------------- ; - Please edit the following values - ; ---------------------------------------------------------------- Set $ProductId$ = "freestudio" Set $InstallDir$ = "%ProgramFiles32Dir%\\DVDVideoSoft\Free Studio\" ; ---------------------------------------------------------------- comment "Show product picture" ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ Message "Uninstalling " + $ProductId$ + " ..." if FileExists("%ScriptPath%\delsub32.ins") comment "Start uninstall sub section" Sub "%ScriptPath%\delsub32.ins" endif ==== delsub32.ins ==== ; Copyright (c) uib gmbh (www.uib.de) ; This sourcecode is owned by uib gmbh ; and published under the Terms of the General Public License. ; credits: http://www.opsi.org/en/credits/ Set $UninstallProgram$ = $InstallDir$ + "unins000.exe" Message "Uninstalling " + $ProductId$ + " ..." if FileExists($UninstallProgram$) comment "Uninstall program found, starting uninstall" ;Winbatch_uninstall /WaitForProcessEnding "DVSVideoToolbarHelper.exe" /TimeOutSeconds 40 Winbatch_uninstall sub_check_exitcode comment "Delete files" Files_uninstall /32Bit if getmsversioninfo < "6.0" ExitWindows /ImmediateReboot endif endif sleepseconds 2 if getmsversioninfo >= "6.0" killtask "iexplore.exe" killtask "firefox.exe" endif [Winbatch_uninstall] ; === Inno Setup ======================================================================================== "$UninstallProgram$" /silent /norestart /SUPPRESSMSGBOXES /nocancel [Files_uninstall] del -sf "$InstallDir$\" [Sub_check_exitcode] comment "Test for installation success via exit code" set $ExitCode$ = getLastExitCode ; informations to exit codes see ; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx ; http://msdn.microsoft.com/en-us/library/aa368542.aspx if ($ExitCode$ = "0") comment "Looks good: setup program gives exitcode zero" else comment "Setup program gives a exitcode unequal zero: " + $ExitCode$ if ($ExitCode$ = "1605") comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed." comment "Uninstall of a not installed product failed - no problem" else if ($ExitCode$ = "1641") comment "looks good: setup program gives exitcode 1641" comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success." Exitwindows /Reboot else if ($ExitCode$ = "3010") comment "looks good: setup program gives exitcode 3010" comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success." Exitwindows /Reboot else logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$ isFatalError endif endif endif endif