[vlc-devel] Win32 installer: silent installation patch

Jaripekka Juhala jjjuhala at cc.hut.fi
Tue Nov 10 20:51:31 CET 2009


Hi

VLC win32 installer is currently unsuited for silent/unattended 
installation: it pops up a dialog box asking about the removal of previous 
version, if found.

I wrote a patch 1) fixing this issue and 2) adding some command line 
options for configuration.  There is a diff attached for both the current 
released version (1.0.3) and the SVN version (as of yesterday).


As a sidenote, installer's multilinguality is done in an abnormal way (by 
including headers dependent on language, which modify UI strings).  NSIS 
has nowadays built-in support for multilinguality using LangString.  More 
information here:
http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.15.2
http://nsis.sourceforge.net/Examples/languages.nsi

I suggest changing the current system to this one.  I didn't write a patch 
myself, though ;)


I'm not on the mailing list, so please cc me if you discuss on this.


God Bless,

Jape / Jaripekka Juhala
-------------- next part --------------
52a53,63

> ;;;;;;;;;;;;;;;;;

> ; Extra Headers ;

> ;;;;;;;;;;;;;;;;;

> 

> !include "FileFunc.nsh" ;for command line options

> !insertmacro GetParameters

> !insertmacro GetOptions

> !include "WordFunc.nsh" ;for parsing /REMOVE

> !insertmacro WordFind

> !include "sections.nsh" ;for UnselectSection

> 

717a729,765

>   ; Command line parameters for configuring silent install: 

>   ;   /INSTTYPE=[number], /SECTIONLIST, and /REMOVE=[section1,section2,...]

>   ;   I don't push and pop $R0-3, they shouldn't be in use yet

>   ${GetParameters} $R0

>   ClearErrors

>   ${GetOptions} $R0 "/INSTTYPE=" $R1 ;Select installation type

>   IfErrors +3

>   IntOp $R1 $R1 - 1

>   SetCurInstType $R1

>   ClearErrors

>   ${GetOptions} $R0 "/SECTIONLIST" $R1 ;Show all section numbers in MB_OK

>   StrCpy $R1 0

>   StrCpy $R3 ""

>   loop:

>     SectionGetText $R1 $R2

>     IfErrors loopend

>     StrCpy $R3 "$R3$\n$R1:$\t$R2"

>     IntOp $R1 $R1 + 1

>     goto loop

>   loopend:

>   StrCmp $R3 "" +2

>   MessageBox MB_OK $R3 /SD IDOK

>   ClearErrors

>   ${GetOptions} $R0 "/REMOVE=" $R1 ; remove selected section numbers

>   IfErrors loopend2

>   StrCpy $R1 "$R1,"

>   ${WordFind} $R1 "," "#" $R2

>   loop2:

>     IntCmp $R2 0 loopend2

>     ${WordFind} $R1 "," "+$R2" $R3

>     !insertmacro UnselectSection $R3

>     IntOp $R2 $R2 - 1

>     goto loop2

>   loopend2:

>   ClearErrors

> 

> 

722c770

<   MessageBox MB_YESNO|MB_ICONEXCLAMATION $Message_AlreadyInstalled IDNO done

---

>   MessageBox MB_YESNO|MB_ICONEXCLAMATION $Message_AlreadyInstalled /SD IDYES IDNO done

727c775,780

<     ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file

---

>     Push $R1

>     StrCpy $R1 ""

>     IfSilent "" +2

>     StrCpy $R1 " /S"

>     ExecWait '$R0$R1 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file

>     Pop $R1

-------------- next part --------------
50a51,60

> ;;;;;;;;;;;;;;;;;

> ; Extra Headers ;

> ;;;;;;;;;;;;;;;;;

> !include "FileFunc.nsh" ;for command line options

> !insertmacro GetParameters

> !insertmacro GetOptions

> !include "WordFunc.nsh" ;for parsing /REMOVE

> !insertmacro WordFind

> !include "sections.nsh" ;for UnselectSection

> 

702a713,749

>   ; Command line parameters for configuring silent install: 

>   ;   /INSTTYPE=[number], /SECTIONLIST, and /REMOVE=[section1,section2,...]

>   ;   I don't push and pop $R0-3, they shouldn't be in use yet

>   ${GetParameters} $R0

>   ClearErrors

>   ${GetOptions} $R0 "/INSTTYPE=" $R1 ;Select installation type

>   IfErrors +3

>   IntOp $R1 $R1 - 1

>   SetCurInstType $R1

>   ClearErrors

>   ${GetOptions} $R0 "/SECTIONLIST" $R1 ;Show all section numbers in MB_OK

>   StrCpy $R1 0

>   StrCpy $R3 ""

>   loop:

>     SectionGetText $R1 $R2

>     IfErrors loopend

>     StrCpy $R3 "$R3$\n$R1:$\t$R2"

>     IntOp $R1 $R1 + 1

>     goto loop

>   loopend:

>   StrCmp $R3 "" +2

>   MessageBox MB_OK $R3 /SD IDOK

>   ClearErrors

>   ${GetOptions} $R0 "/REMOVE=" $R1 ; remove selected section numbers

>   IfErrors loopend2

>   StrCpy $R1 "$R1,"

>   ${WordFind} $R1 "," "#" $R2

>   loop2:

>     IntCmp $R2 0 loopend2

>     ${WordFind} $R1 "," "+$R2" $R3

>     !insertmacro UnselectSection $R3

>     IntOp $R2 $R2 - 1

>     goto loop2

>   loopend2:

>   ClearErrors

> 

> 

707c754

<   MessageBox MB_YESNO|MB_ICONEXCLAMATION $Message_AlreadyInstalled IDNO done

---

>   MessageBox MB_YESNO|MB_ICONEXCLAMATION $Message_AlreadyInstalled /SD IDYES IDNO done

712c759,764

<     ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file

---

>     Push $R1

>     StrCpy $R1 ""

>     IfSilent "" +2

>     StrCpy $R1 " /S"

>     ExecWait '$R0$R1 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file

>     Pop $R1



More information about the vlc-devel mailing list