Archive: Need help with a basic installer


Need help with a basic installer
OK, so I have spent the past four hours trying to figure this out, so I thought I'd ask the community.
I am trying to write a simple installer that would:
1) Extract a zip file into the install directory
2) In a number of configuration files, replace variables with values passed by the user. For example, on one of the installer screens, I ask the user what his IP is, and i take that value and update the files config1.conf and properties.prop to replace the value @IPADDRESS@ by the IP given by the user.

I cannot find the answer to this..Help (and especially exemples) would be ever so greatly appreciated.

Cheers


Ad 1) Maybe better idea is to integrate zip file with your installer. It's very simple

....
SetOutPath "YourInstallDir"
File /r "YourSourceDir\*.*"
....
this will compress all all the files in <YourSourceDir> into exe file, and then on target machine unpack to YourInstallDir

Check ..\NSIS\Examples directory for more ...

Ad 2) For creating your own "installer screens" use InstallOptions

Check ..\NSIS\Contrib\InstallOptions directory for more ...

You can find lots of string functions in
http://nsis.sourceforge.net/archive/...instances=0,11

If you need any detailed help please give some more info or attach your script.

Good luck :)
Kobus

I've been looking all over the archive and found some stuff of interest, but it just doesn't seem to work for me. My script is:

; example3.nsi
;--------------------------------
Name "Example3"
OutFile "example3.exe"
InstallDir C:\TestInstall\Example3

;--------------------------------
; Pages

Page components
Page directory
Page instfiles

;--------------------------------
; Sections
Section "Main Install" ;

SetOutPath $INSTDIR
File TestFile.txt

SectionEnd


Section "Replace Name"
ClearErrors
FileOpen $0 "TestFile.txt" "r"
GetTempFileName $R0
FileOpen $1 $R0 "w"
loop:
FileRead $0 $2
IfErrors done
StrCmp $2 "@NAME@" 0 +3
FileWrite $1 "Benjamin"
Goto loop
FileWrite $1 $2
Goto loop

done:
FileClose $0
FileClose $1
Delete "TestFile.txt"
CopyFiles /SILENT $R0 "TestFile.txt"
Delete $R0
SectionEnd

===================
TestFile.txt has one line:
Hi my name is @NAME@ and I am happy


Okay, so i figured out my problem now. Thanks for the help!!!