Difference between revisions of "Vlc"
(→Simple method) |
m (various small tidyups) |
||
Line 1: | Line 1: | ||
− | [http://www.videolan.org/vlc/ VLC] ( | + | [http://www.videolan.org/vlc/ VLC] (VideoLAN Client) is a multimedia (audio and video) player. |
− | == Simple | + | == Simple Method == |
− | + | This install method removes the desktop shortcut (the path may have to be changed to your localized name). | |
<source lang="xml"> | <source lang="xml"> | ||
Line 12: | Line 12: | ||
<package | <package | ||
id="vlc" | id="vlc" | ||
− | name=" | + | name="VideoLAN Client" |
revision="1" | revision="1" | ||
reboot="false" | reboot="false" | ||
Line 30: | Line 30: | ||
VLC is a bit tricky because upgrading (installation if an installed version is already installed) is not fully unattended. It interactively asks the user if the existing version should be uninstalled first. As already mentioned above a solution would be to remove the previous version first before installing the VLC update. However also this fails since uninstall.exe forks a new process while the parent exits immediately. So if this happens too quickly then the install program still asks for confirmation. | VLC is a bit tricky because upgrading (installation if an installed version is already installed) is not fully unattended. It interactively asks the user if the existing version should be uninstalled first. As already mentioned above a solution would be to remove the previous version first before installing the VLC update. However also this fails since uninstall.exe forks a new process while the parent exits immediately. So if this happens too quickly then the install program still asks for confirmation. | ||
− | So I did a | + | So I did a workaround for that: |
<source lang="xml"> | <source lang="xml"> | ||
<?xml version="1.0" encoding="utf-8" ?> | <?xml version="1.0" encoding="utf-8" ?> | ||
<packages> | <packages> | ||
− | <package id='VLC' name=' | + | <package id='VLC' name='VideoLAN Client' revision='1' priority='50' reboot='false' > |
<!-- VLC media player --> | <!-- VLC media player --> | ||
− | <check type='uninstall' condition='exists' path='VLC media player 0.9. | + | <check type='uninstall' condition='exists' path='VLC media player 0.9.6' /> |
<install cmd='"%SOFTWARE%\VLC\unattended.cmd"' /> | <install cmd='"%SOFTWARE%\VLC\unattended.cmd"' /> | ||
<remove cmd='"%SOFTWARE%\VLC\unattended-uninstall.cmd"' /> | <remove cmd='"%SOFTWARE%\VLC\unattended-uninstall.cmd"' /> | ||
Line 46: | Line 46: | ||
</source> | </source> | ||
− | + | This method requires the following scripts to perform some more actions: | |
+ | |||
+ | ===unattended.cmd=== | ||
− | |||
<source lang="dos"> | <source lang="dos"> | ||
@echo off | @echo off | ||
− | set BINARY=vlc-0.9. | + | set BINARY=vlc-0.9.6-win32.exe |
echo Installing VLC media plyer | echo Installing VLC media plyer | ||
Line 73: | Line 74: | ||
</source> | </source> | ||
− | As you can see it calls unattended-uninstall.cmd prior to installation (any time!). The evaluation of PROG_FILES assures that it installs the 32-bit VLC | + | As you can see it calls unattended-uninstall.cmd prior to installation (any time!). The evaluation of PROG_FILES assures that it installs the 32-bit VLC always to the correct program files directory also on 64-bit systems. |
+ | |||
+ | ===unattended-uninstall.cmd=== | ||
− | |||
<source lang="dos"> | <source lang="dos"> | ||
@echo off | @echo off | ||
Line 106: | Line 108: | ||
As this script is called by unattended.cmd also when VLC is probably not installed it first checks if there is an uninstallation to be done. If not it just skips the uninstall, but still checks to see if the uninstaller totally cleaned up after itself. | As this script is called by unattended.cmd also when VLC is probably not installed it first checks if there is an uninstallation to be done. If not it just skips the uninstall, but still checks to see if the uninstaller totally cleaned up after itself. | ||
− | As | + | As described above the uninstaller forks a child process and exits immediately. So there is a need to wait for the uninstaller to complete. I am simply checking if the uninstaller still exists. If yes I wait for another second. |
In order to prevent an endless-loop the uninstallation will stop after a maximum of 30 seconds. | In order to prevent an endless-loop the uninstallation will stop after a maximum of 30 seconds. | ||
− | + | ===cleanup.cmd=== | |
+ | |||
<source lang="dos"> | <source lang="dos"> | ||
@echo off | @echo off |
Revision as of 08:09, 6 December 2008
VLC (VideoLAN Client) is a multimedia (audio and video) player.
Contents
Simple Method
This install method removes the desktop shortcut (the path may have to be changed to your localized name).
<?xml version="1.0" encoding="UTF-8"?>
<packages>
<package
id="vlc"
name="VideoLAN Client"
revision="1"
reboot="false"
priority="0">
<check type="uninstall" condition="exists" path="VLC media player" />
<install cmd='"%SOFTWARE%\vlc\vlc-0.9.6-win32.exe" /S' />
<!--<install cmd='%CMD% /c del "%ALLUSERSPROFILE%\Desktop\VLC media player.lnk"' />-->
<remove cmd='"%PROGRAMFILES%\VideoLAN\VLC\uninstall.exe" /S' />
</package>
</packages>
Upgrade is also possible, but there are issues. See the advanced method for how to achieve this.
Advanced method by SkyBeam
VLC is a bit tricky because upgrading (installation if an installed version is already installed) is not fully unattended. It interactively asks the user if the existing version should be uninstalled first. As already mentioned above a solution would be to remove the previous version first before installing the VLC update. However also this fails since uninstall.exe forks a new process while the parent exits immediately. So if this happens too quickly then the install program still asks for confirmation.
So I did a workaround for that:
<?xml version="1.0" encoding="utf-8" ?>
<packages>
<package id='VLC' name='VideoLAN Client' revision='1' priority='50' reboot='false' >
<!-- VLC media player -->
<check type='uninstall' condition='exists' path='VLC media player 0.9.6' />
<install cmd='"%SOFTWARE%\VLC\unattended.cmd"' />
<remove cmd='"%SOFTWARE%\VLC\unattended-uninstall.cmd"' />
<upgrade cmd='"%SOFTWARE%\VLC\unattended.cmd"' />
</package>
</packages>
This method requires the following scripts to perform some more actions:
unattended.cmd
@echo off
set BINARY=vlc-0.9.6-win32.exe
echo Installing VLC media plyer
set INSTALLER_LOC=%~dp0
set EXIT_CODE=0
set PROG_FILES=%ProgramFiles%
if not "%ProgramFiles(x86)%" == "" set PROG_FILES=%ProgramFiles(x86)%
echo - Removing previous version "%INSTALLER_LOC%unattended-uninstall.cmd"
call "%INSTALLER_LOC%unattended-uninstall.cmd"
echo - Installing player
start /wait "VLC" "%INSTALLER_LOC%%BINARY%" /S /NCRC /D="%PROG_FILES%"
set EXIT_CODE=%ERRORLEVEL%
call "%INSTALLER_LOC%cleanup.cmd"
exit /B %EXIT_CODE%
As you can see it calls unattended-uninstall.cmd prior to installation (any time!). The evaluation of PROG_FILES assures that it installs the 32-bit VLC always to the correct program files directory also on 64-bit systems.
unattended-uninstall.cmd
@echo off
echo Removing VLC media plyer
if not "%ProgramFiles(x86)%" == "" set PROG_FILES=%ProgramFiles(x86)%
set INSTALLER_LOC=%~dp0
set VLANDIR=%PROG_FILES%\VideoLAN
set UNINSTALLER=%VLANDIR%\VLC\uninstall.exe
set OPTIONS=/S
if not exist "%UNINSTALLER%" goto good_end
start /wait "VLC uninstall" "%UNINSTALLER%" %OPTIONS%
REM Unfortunately the uninstaller seems to fork a child process and the parent
REM process exits immediately. So give it some time to uninstall
for /L %%C IN (1,1,30) DO (
if not exist "%UNINSTALLER%" goto good_end
ping -n 2 127.0.0.1 > NUL
)
:bad_end
exit /B 1
:good_end
if exist "%VLANDIR%" rmdir /s /q "%VLANDIR%"
exit /B 0
As this script is called by unattended.cmd also when VLC is probably not installed it first checks if there is an uninstallation to be done. If not it just skips the uninstall, but still checks to see if the uninstaller totally cleaned up after itself.
As described above the uninstaller forks a child process and exits immediately. So there is a need to wait for the uninstaller to complete. I am simply checking if the uninstaller still exists. If yes I wait for another second.
In order to prevent an endless-loop the uninstallation will stop after a maximum of 30 seconds.
cleanup.cmd
@echo off
echo Removing unnecessary shortcuts
del /F /Q "%ALLUSERSPROFILE%\Desktop\VLC media player**"
del /F /Q "%PUBLIC%\Desktop\VLC media player**"
exit /B 0
This has been tested on Windows Vista x64.