Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Install one or more Clients (http://forums.winamp.com/showthread.php?t=254487)

Amun 31st August 2006 08:55

Install one or more Clients
 
Hi!

I'm trying to generate an installation routine which should have the following functionality:
With a installation-routine it should be possible to distribute and install a defined software program to one or more computers automatically.
The selection, which computers should be updated, is realised with a custompage and the result (selection) is stored in a predefined file. The next step is to read this selection-file line by line and to distribute the software accordingly.

As an attachment I send you my version of the installation-routine.
The question is: How do I have to include the components for their proper installation?

Thx

edit:
can't upload files so here a link to ZIP:
multiclients.zip

kichik 1st September 2006 09:02

Can you upload it somewhere else? I keep getting an error message I can't read when trying to download.

Amun 1st September 2006 09:54

sorry here the code from NSI
PHP Code:

!insertmacro MUI_PAGE_WELCOME
Page custom select_pc

!insertmacro MUI_PAGE_COMPONENTS
Instfiles page
!insertmacro MUI_PAGE_INSTFILES
Finish page
!insertmacro MUI_PAGE_FINISH


Language files
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "English"

MUI end ------


    
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "test.exe"
InstallDir "C:\test"
ShowInstDetails show
ShowUnInstDetails show
AllowRootDirInstall true



Section 
-var
Var /GLOBAL 
TMP
var /GLOBAL pc
var /GLOBAL done
StrCpy $TMP 
"c:\temp"
strcpy $done "N"
SectionEnd

Function .onInit
         
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "select_pc.ini"
FunctionEnd

Function select_pc
         
!insertmacro MUI_HEADER_TEXT "Clients" \
         
"Select the Client (multiselect possible)"
         
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "select_pc.ini"
FunctionEnd

Section 
-get_pcnames
        Delete 
"$TMP\pc.txt"
        
StrCpy $"3"
        
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "select_pc.ini" "Settings" "NumFields"
        
IntOp $R0 $R0 1
        FileOpen $R1 
"$TMP\pc.txt" "a"

        
Next_pc:

        
IntOp $$1
        StrCmp 
$"$R0endloop_pc
        
!insertmacro MUI_INSTALLOPTIONS_READ $R3 "select_pc.ini" "Field $0" "State"
        
StrCmp $R3 "0" Next_pc
        
!insertmacro MUI_INSTALLOPTIONS_READ $R4 "select_pc.ini" "Field $0" "Text"

        
FileSeek $R1 0 END
        FileWrite $R1 
"$R4$\r$\n"
        
goto Next_pc
        Endloop_pc
:
        
FileClose $R1
SectionEnd

Section 
-Readfile
        FileOpen 
$"$TMP\pc.txt" r
        IfErrors done_read

        FileSeek 
$0 0
        loop_read
:

        
FileRead $0 $pc
        StrCmp $pc 
"" done_read
        Call Allgemein
        
goto loop_read

        done_read
:
        
FileClose $0

        call end_install
;        return
SectionEnd

Function Allgemein
        MessageBox MB_OK 
"start install $pc"
        
call :.sectioninstall
FunctionEnd


Section 
-Install

        
.sectioninstall:
        
StrCmp $done "J" end
        MessageBox MB_OK 
"Install for $pccomlete"
        
return
        
        
end:
SectionEnd

Section 1 SEC01
MessageBox MB_OK 
"Section 1"
SectionEnd

Section 2 SEC02
MessageBox MB_OK 
"Section 2"
SectionEnd

Section 3 SEC03
MessageBox MB_OK 
"Section 3"
SectionEnd

Function end_install

         Messagebox mb_ok 
"All installs complete"
         
strcpy $done "J"

FunctionEnd 


Amun 1st September 2006 09:56

and here is a sampe INI

PHP Code:

[Settings]
NumFields=10

[Field 1]
Type=Label
Text
=SERVER
Flags
=NOTABSTOP
Left
=0
Right
=-1
Top
=0
Bottom
=10

[Field 2]
Type=Label
Text
=E Clients
Flags
=NOTABSTOP
Left
=0
Right
=-1
Top
=30
Bottom
=40

[Field 3]
Type=Label
Text
=i Clients
Flags
=NOTABSTOP
Left
=0
Right
=-1
Top
=75
Bottom
=85

;********************
;       
SERVER      *
;********************
[
Field 4]
Type=Checkbox
Text
=SERVER1
State
=0
Left
=20
Right
=100
Top
=15
Bottom
=25

[Field 5]
Type=Checkbox
Text
=SERVER2
State
=0
Left
=100
Right
=180
Top
=15
Bottom
=25

;********************
;     
E Clients     *
;********************
[
Field 6]
Type=Checkbox
Text
=E1
State
=0
Left
=20
Right
=100
Top
=45
Bottom
=55

[Field 7]
Type=Checkbox
Text
=E2
State
=0
Left
=100
Right
=180
Top
=45
Bottom
=55

[Field 8]
Type=Checkbox
Text
=E3
State
=0
Left
=20
Right
=100
Top
=60
Bottom
=70

[Field 9]
Type=Checkbox
Text
=E4
Left
=100
Right
=180
Top
=60
Bottom
=70
;********************
;     
I Clients     *
;********************
[
Field 10]
Type=Checkbox
Text
=I1
Left
=20
Right
=100
Top
=90
Bottom
=100 


kichik 1st September 2006 10:23

I don't understand the question. What are those components you wish to install? What do you mean by including them? Do you want to include files with the installer? If so, use File.

If you're asking about installing files to a remote computer, that depends on the protocol you wish to use and the access method. If you wish to use Windows shares, simply write the files to \\server\share, it works just like any other directory.

Amun 1st September 2006 11:26

The problem: you select one ore more Clients in Custom Page.
The Sections (1,2,3), there selectet in Components Page must include in the loop.

Sample:
Select on Customepage "select_pc" 2 Clients
This 2 Clients where Written in a temp File pc.txt
Start MUI_PAGE_COMPONENTS
Select Section 1 and 3
start MUI_PAGE_INSTFILES
Read fist line from pc.txt
Result = Client1
Install selected Sections on Clint1
Read next line from pc.txt
Result = Client2
Install selected Sections on Client2
Read next line from pc.txt
Result = empty
Start MUI_PAGE_FINISH


The Components in the Sample are only you see the Sections are Starts.

kichik 1st September 2006 11:42

So you're asking how to select section from the script? For that you have the macros in Sections.nsh named SelectSection and UnselectSection.


All times are GMT. The time now is 04:17.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.