vlc 2.0.2

2012-12-12
Script by uib gmbh
Comments and improvements welcome
Tested with opsi 4.0.2

type: localboot
id: vlc
name: VideoLAN - VLC media player
description: VLC media player is a highly portable multimedia player supporting most audio and video formats (H.264, Ogg, DivX, MKV, TS, MPEG-2, mp3, MPEG-4, aac, …) from files, physical media (DVDs, VCD, Audio-CD), TV capture cards and many network streaming protocols.
It can also convert media files, transcode and act as a streaming server over unicast or multicast and IPv4 or IPv6. It doesn't need any external codec, program or codec pack to work.
version: 2.0.2

Full package: http://download.uib.de/opsi4.0/products/contribute/full-package/

setup.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/credits/
 
[actions]
requiredWinstVersion >= "4.11.2.6"
setloglevel = 6
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $NewExe$
DefVar $InstallDir$
DefVar $ExitCode$
DefVar $UserProfileName$
DefStringList $UserProfileNamesList$
DefVar $AppDataDirName$
DefVar $proxy$
 
set $ProductId$ = "vlc"
set $MinimumSpace$ = "200 MB"
Set $InstallDir$      = "%ProgramFiles32Dir%\VideoLAN\VLC"
set $NewExe$ = $InstallDir$ + "\" + $ProductId$ + ".exe"
set $proxy$ = GetProductProperty("proxy","")
 
Message "Installing VLC ..."
 
if not(HasMinimumSpace ("%SYSTEMDRIVE%", $MinimumSpace$))
	LogError "Not enough space on %SYSTEMDRIVE%: . " + $MinimumSpace$ + " on Drive %SYSTEMDRIVE%: needed for " + $ProductId$ + "."
	isFatalError
else
	comment "show product picture"
	ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" "VLC"
 
	if FileExists("%ScriptPath%\delsub.ins")
		comment  "start uninstall sub section"
		sub "%ScriptPath%\delsub.ins"
	endif
 
	Message "Installing VLC ..."
 
	comment "Start setup program"
	Winbatch_install
	sub_check_exitcode
 
	comment "what is the name of the Application Data Dir ?"
	Set $AppDataDirName$ = TakeString(-1, SplitString("%CommonAppdataDir%", "\"))
	if getMsVersionInfo >= "6"
		set $AppDataDirName$ = "AppData\Roaming"
	endif
 
	comment "Patching user profiles"
 
	;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
	Set $UserProfileNamesList$ = getOutStreamFromSection('DosInAnIcon_list_profiledir')
	for %prof% in $UserProfileNamesList$ do Sub_update_user_profile
 
	comment "Delete desktop shortcut"
	LinkFolder_remove_desktop_link
 
	comment "test for installation success"
	if not(FileExists($NewExe$))
		logError "Fatal: After Installation "+$NewExe$+" not found"
		isFatalError
	endif
 
endif
 
[LinkFolder_remove_desktop_link]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element "VLC media player"
 
[DosInAnIcon_list_profiledir]
@echo off
dir "%ProfileDir%" /b /ad
 
[Winbatch_install]
;http://www.videolan.org/vlc/download-windows.html
"%SCRIPTPATH%\vlc-2.0.2-win32.exe"  /L=1031 /S
 
[Sub_update_user_profile]
Set $UserProfileName$ = "%prof%"
if not ($UserProfileName$ = "") and not ($UserProfileName$ = "All Users") and not ($UserProfileName$ = "Public") and not ($UserProfileName$ = "LocalService") and not ($UserProfileName$ = "NetworkService")
	if FileExists("%ProfileDir%\" + $UserProfileName$ +"\"+ $AppDataDirName$ + "\vlc\")
		comment "VLC user profile exist for user " + $UserProfileName$ + ", patching"
		Patches_vlcrc "%ProfileDir%\" + $UserProfileName$ +"\"+ $AppDataDirName$ + "\vlc\vlcrc"
	else
		comment "Creating new VLC profile for user " + $UserProfileName$
		Files_copy_vlc_profile_template
	endif
	if not ($proxy$ = "")
		Patches_vlcrc_proxy "%ProfileDir%\" + $UserProfileName$ +"\"+ $AppDataDirName$ + "\vlc\vlcrc"
	endif
endif
 
[Files_copy_vlc_profile_template]
copy -s "%SCRIPTPATH%\profile-template\*.*" "%ProfileDir%\$UserProfileName$\$AppDataDirName$\vlc\"
 
[Patches_vlcrc]
set [qt4] qt-updates-notif=0
 
[Patches_vlcrc_proxy]
set [access_http] http-proxy=$proxy$
 
[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

delsub.ins

; delsub for vlc
 
Message "Deinstalling VLC ..."
DefVar $UninstallProgram$
Set $UninstallProgram$ = $InstallDir$ + "\uninstall.exe"
 
comment "Start uninstall program if exists"
if FileExists($UninstallProgram$)
	Winbatch_uninstall /WaitForProcessEnding "Au_.exe" /Timeoutseconds 15
	;Winbatch_uninstall
	sub_check_exitcode
endif
 
comment "Delete files"
Files_uninstall
 
[Winbatch_uninstall]
"$UninstallProgram$" /S
 
[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

uninstall.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/credits/
 
[Actions]
requiredWinstVersion >= "4.11.2.6"
setLogLevel = 6
DefVar $ProductId$
DefVar $InstallDir$
DefVar $ExitCode$
 
; This should be edited
set $ProductId$ = "vlc"
Set $InstallDir$      = "%ProgramFiles32Dir%\VideoLAN\VLC"
 
comment "Show product picture"
ShowBitmap "%scriptpath%\" + $ProductId$ + ".png" "VLC"
 
if FileExists("%ScriptPath%\delsub.ins")
	comment  "Start uninstall sub section"
	sub "%ScriptPath%\delsub.ins"
endif

login.ins

Can be used with opsi-Extension “User Profile Management”

; 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/credits/
 
[Actions]
requiredWinstVersion >= "4.11.2.6"
setloglevel = 6
 
DefVar $proxy$
set $proxy$ = GetProductProperty("proxy","")
 
Message "Profile Patch for VLC ...."
comment "Did we run this script before ? - and set version stamp in profile"
if getValue("installationstate", getProductMap) = "installed"
	comment "Product is installed"
	if not (scriptWasExecutedBefore)
		comment "loginscript was not run yet "
		if FileExists("%CurrentAppdataDir%\vlc\")
			comment "VLC user profile exist for user " + $UserProfileName$ + ", patching"
			Patches_vlcrc "%CurrentAppdataDir%\vlc\vlcrc"
		else
			comment "Creating new VLC profile for user %Username%"
			Files_copy_vlc_profile_template
		endif
		if not ($proxy$ = "")
			Patches_vlcrc_proxy "%CurrentAppdataDir%\vlc\vlcrc"
		endif
	endif
endif
 
[Files_copy_vlc_profile_template]
copy -s "%SCRIPTPATH%\profile-template\*.*" "%CurrentAppdataDir%\vlc\"
 
[Patches_vlcrc]
set [qt4] qt-updates-notif=0
 
[Patches_vlcrc_proxy]
set [access_http] http-proxy=$proxy$

QR Code
QR Code userspace:vlc_2.0.2_mediaplayer (generated for current page)