- NSIS Discussion
- spaning disks
Archive: spaning disks
dougburton0721
25th November 2003 06:48 UTC
spaning disks
I am having a hard time getting this to work right.
Section "Maximum Force CHD Image"
;Installation of MAXFORCE CHD
MessageBox MB_OKCANCEL "Insert M.A.M.E. 0.77 Disk 16 (Maxforce disk 1) and Press 'OK' to install. WARNING!!!: THE AUTOMATIC INSTALLATION OF THIS FILE TEMPORARILY MAY REQUIRE APPROXIMATELY 3 GB's OF FREE DISK SPACE. THE FINAL SIZE WILL BE APPROXIMATELY 1.08 GB's AFTER AUTO-CLEANUP" IDCANCEL FINISH2
MessageBox MB_OKCANCEL "If you do not have enough disk space to install Maximum Force using this installer, you can manually copy the files and extract them with a program such as Winrar. Press OK to continue" IDCANCEL FINISH2
; Set output path to the installation directory.
SetOutPath $INSTDIR\TEMP
; Put file there
CopyFiles "$EXEDIR\MAXFORCE\*.*" "$INSTDIR\TEMP"
MessageBox MB_OKCANCEL "Insert M.A.M.E. 0.77 Disk 17 (Maxforce disk 2, WarGods & Killer Instinct 2) and Press 'OK' " IDCANCEL FINISH2
; Set output path to the installation directory.
SetOutPath $INSTDIR\TEMP
; Put file there
CopyFiles "$EXEDIR\COPYING.EMX" "$INSTDIR\TEMP"
CopyFiles "$EXEDIR\COPYING.RSX" "$INSTDIR\TEMP"
CopyFiles "$EXEDIR\EMX.DLL" "$INSTDIR\TEMP"
CopyFiles "$EXEDIR\EMX.EXE" "$INSTDIR\TEMP"
CopyFiles "$EXEDIR\RAR32.EXE" "$INSTDIR\TEMP"
CopyFiles "$EXEDIR\RARFILES.LST" "$INSTDIR\TEMP"
CopyFiles "$EXEDIR\RSX.EXE" "$INSTDIR\TEMP"
CopyFiles "$EXEDIR\MAXFORCE\*.*" "$INSTDIR\TEMP"
EXECWAIT "$INSTDIR\TEMP\rar32.exe e *.rar"
SetOutPath $INSTDIR\ROMS\MAXFORCE
SetFileAttributes "$INSTDIR\ROMS\MAXFORCE" NORMAL
CopyFiles "$INSTDIR\TEMP\MAXFORCE.CHD" "$INSTDIR\ROMS\MAXFORCE"
*****************errors out******************
SetFileAttributes "$INSTDIR\TEMP\*.*" NORMAL
SetFileAttributes "$INSTDIR\TEMP" NORMAL
RMDir /r "$INSTDIR\TEMP"
FINISH2:
SectionEnd
the setup.exe file is on disk 1, and being run from the cd. After it copies the files over, I get an error message that the wrong volume disk is in the drive then it errors out. Any ideas on how to correct.
kichik
25th November 2003 07:05 UTC
Have you copied setup.exe to a local directory? Keeping a program from a CD-ROM running and getting the CD-ROM out usually brings trouble. You should first copy setup.exe to $TEMP and run it from there.
dougburton0721
25th November 2003 07:13 UTC
I am really new when it comes to programming. Do have the code to do this? Also wouldn't that cause problems with the CopyFiles $exedir as now it would be pointing to where the setup file is now instead of the cd?
kichik
25th November 2003 07:26 UTC
I don't know any full example that does that. But it's not that complicated, you'll live :)
To get the EXE name you can parse $CMDLINE or simply use:
System::Call "Kernel32::GetModuleFileName(i 0, t .r0, i ${NSIS_MAX_STRLEN})"
This line will put the EXE's path in $0.
After you have the path of the setup EXE, you simply copy it to $TEMP and execute it with a special command line parameter that will let it know that it is no longer on the CD. Something like /NOCD should do the trick.
$EXEDIR would indeed be different, so you should send that too in the command line.
dougburton0721
25th November 2003 07:37 UTC
so to copy it over, and execute it you would have something like this:
System::Call "Kernel32::GetModuleFileName(i 0, t .r0, i ${NSIS_MAX_STRLEN})"
CopyFile "$0\setup.exe" "$Instdr\temp1"
Exec "$InstDr\temp1\setup.exe" /NOCD
kichik
25th November 2003 07:41 UTC
GetModuleFileName returns the full path, including the executable name, which you can't trust to be setup.exe. I'd make sure $INSTDIR\temp1 exists first. Also, the Exec line is wrong and doesn't include $EXEDIR. You shold use:
System::Call "Kernel32::GetModuleFileName(i 0, t .r0, i ${NSIS_MAX_STRLEN})"
CreateDirectory $INSTDIR\temp1
CopyFile "$0" "$INSTDIR\temp1"
Exec '"$InstDr\temp1\setup.exe" /NOCD $EXEDIR'
You should also parse the command line ($CMDLINE) for /NOCD and $EXEDIR. If it's there, no need to respawn the installer again.
dougburton0721
25th November 2003 08:10 UTC
Forgive me for being stupid, but how would I parse the $cmdline?
kichik
25th November 2003 08:13 UTC
Search the Archive for $CMDLINE, it contains some examples.
cosmic66
27th November 2003 12:22 UTC
I have written a script that does what you need:
on the first launch the installer copies itself to
the HD, launches the installer file from
the HD and exits.
Example script is attached.
dougburton0721
27th November 2003 17:34 UTC
Thanks Cosmic66
Quick question, does the code make $R2 be the cd-rom drive directory? ie cd-rom is e:\ and so is $R2?
dougburton0721
28th November 2003 06:12 UTC
I've just about got it all figured out now. The only problem I am having, is when I add the new code in, which copies the setup over to the hard drive and runs it from there, it skips my section on having it ask the person where to install the files, along with what files they want to install. It goes directly into copying all the files.
cosmic66
29th November 2003 11:30 UTC
I have downloaded your script and when I compile and run it,
it shows component and directory page (I'm using MakeNSIS v2.0b4).
dougburton0721
30th November 2003 03:42 UTC
I was running MakeNSIS v2.0b3. So I downloaded verion 2.0b4, recompiled the script. Tested it, and all is well. Thanks for all your help, especially your script cosmic66. Works great.