- NSIS Discussion
- Can NSIS install a separate file from the install CD?
Archive: Can NSIS install a separate file from the install CD?
noleander
11th March 2005 22:31 UTC
Can NSIS install a separate file from the install CD?
I've gotten my simple NSIS install script working. Now for the next step: for various reasons, we need to have a data file on the CD _separate_ from the installer file. In other words, the CD would hold the installer.exe file and a second file containing our data. The install process will copy the data file from the CD onto the hard drive. I understand that this is not the normal way to use NSIS, but that's the way it has to be.
I've searched the archives for an example of how to do this with NSIS, but cannot find an example. Can anyone point me to an example?
Thanks in advance,
neal
Afrow UK
11th March 2005 22:56 UTC
Well, more information on what type of file it is would help.
For example, if your seperate file is a .Zip then you'd just include unzip.exe in your installer, extract it on run-time into the $PLUGINSDIR and execute it on your .Zip.
However, if you use something better like LZMA (.7z) then use 7-Zip's command-line program - 7za from http://www.7-zip.org/
-Stu
Afrow UK
11th March 2005 22:57 UTC
Here's the source of a little NSIS program I made to download and install another NSIS program...
Name "MapUpdater Installer"
Caption "MapUpdater Installer"
OutFile "install_mu.exe"
Icon "mapupdater.ico"
XPStyle on
!define URL1 "http://myweb.tiscali.co.uk/imker/Updater/mapupdater.zip"
!define URL2 "http://myweb.tiscali.co.uk/imker/Updater/Games/hostile.gdf"
Function .onInit
MessageBox MB_OKCANCEL|MB_ICONINFORMATION "MapUpdater will now be downloaded and installed for Hostile Intent.$\r$\nIt shall be installed to C:\MapUpdater (it can be moved later if you wish).$\r$\n$\r$\nClick OK to continue." IDCANCEL Done
InitPluginsDir
Banner::show /NOUNLOAD "Please wait while files are downloaded..."
TryURL1:
InetLoad::load "${URL1}" "$PLUGINSDIR\mapupdater.zip" /END
Pop $R0
StrCmp $R0 "OK" TryURL2
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "A required file could not be downloaded.$\r$\nPlease check your internet connection and click Retry to try again." IDRETRY TryURL1 IDCANCEL Done
TryURL2:
InetLoad::load "${URL2}" "$PLUGINSDIR\hostile.gdf" /END
Pop $R0
StrCmp $R0 "OK" DoneURLs
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "A required file could not be downloaded.$\r$\nPlease check your internet connection and click Retry to try again." IDRETRY TryURL2 IDCANCEL Done
DoneURLs:
Banner::destroy
Banner::show /NOUNLOAD "Installing MapUpdater..."
CreateDirectory "C:\MapUpdater"
File "/oname=$PLUGINSDIR\unzip.exe" "Temp\unzip.exe"
nsExec::Exec '"$PLUGINSDIR\unzip.exe" -o "$PLUGINSDIR\mapupdater.zip" -d "C:\MapUpdater"'
Rename "$PLUGINSDIR\hostile.gdf" "C:\MapUpdater\Games\hostile.gdf"
Exec "C:\MapUpdater\mapupdater.exe"
Done:
Banner::destroy
Quit
FunctionEnd
Section
SectionEnd
You can download the actual program from
http://myweb.tiscali.co.uk/imker/Updater/install_mu.exe
-Stu
noleander
11th March 2005 23:11 UTC
Thanks for the quick replies.
The additional file we will put on the CD (actually, it will be a DVD) is a data file containing audio tracks. The data file is already packed and compressed in our own format (special for music synthesizers) and we don't anticipate compressing it further with zip or tar.
So, from NSIS's point of view, the second file is just a plain data file that the installer needs to copy from the CD/DVD to the hard drive.
If NSIS will work better or easier if we run our file thru zip/tar compression, let me know, but we'd rather avoid that.
I'm just trying to find a sample NSIS script that shows how to copy a plain data file from the CD to the hard drive.
Thanks!
neal
Yathosho
11th March 2005 23:29 UTC
@afrow: what speaks against using zipdll?
arfinator853
11th March 2005 23:32 UTC
couldn't you just use something easy like
File
"$EXEDIR\yourdatafile.somthing"
I don't know if this is whast your looking for. But just felt It might work. :)
Shea
12th March 2005 03:57 UTC
I think you need to use the CopyFiles command.
CopyFiles "Location" "Destination"
Afrow UK
12th March 2005 15:39 UTC
I've had problems with ZipDLL in the past. I wrote a NSIS app to update a computer game, and it would fail to decompress atleast 5 of the 60+ Zips that I tested with a run-time error.
What kind of compression format are you using? You'd need some kind of command-line program to decompress it.
-Stu