[vlc-devel] Win32 installer: silent installation patch
Jaripekka Juhala
jjjuhala at cc.hut.fi
Sun Dec 13 23:39:31 CET 2009
Hi
Sorry for a really slow reply; I and my family got a flu.
On Thu, 3 Dec 2009, Christophe Mutricy wrote:
> Hello,
>
> On Tue, Nov 10, 09 at 21:51 +0200, Jaripekka Juhala wrote:
>> 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).
>
> Could you resend (at least of) the patches as unified diff. It's much
> easier to review
>
> --
> Xtophe
Attached, for the released version (1.0.3). (FYI: /SECTIONLIST cmdline
parameter I added shows section names only for the file type sections;
this follows in some way I cannot understand from the abnormal way the
multilinguality is currently implemented (I wrote about this last time).
Otherwise everything works perfectly as far as I know.)
God Bless,
Jape
-------------- next part --------------
--- vlc.win32.nsi 2009-10-30 13:28:55.000000000 +0200
+++ vlc.win32.mun.nsi 2009-12-13 21:46:47.964043200 +0200
@@ -50,6 +50,17 @@
InstType $Name_InstTypeMinimum
InstType $Name_InstTypeFull
+;;;;;;;;;;;;;;;;;
+; 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
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; NSIS Modern User Interface configuration ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -715,16 +726,57 @@
!include "languages\brazilian_portuguese.nsh"
EndLanguageCmp:
+ ; 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
+
+
ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
"UninstallString"
StrCmp $R0 "" done
- MessageBox MB_YESNO|MB_ICONEXCLAMATION $Message_AlreadyInstalled IDNO done
+ MessageBox MB_YESNO|MB_ICONEXCLAMATION $Message_AlreadyInstalled /SD IDYES IDNO done
;Run the uninstaller
+ ; Pass /S if running silently. I don't push and pop $R1, it shouldn't be in use yet.
;uninst:
ClearErrors
- ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
+ StrCpy $R1 ""
+ IfSilent "" +2
+ StrCpy $R1 " /S"
+ ExecWait '$R0$R1 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
done:
FunctionEnd
More information about the vlc-devel
mailing list