Archive: Question about a Impossible Task using NSIS !!!


Question about a Impossible Task using NSIS !!!
Hello,

This question is probably by far the most difficult for NSIS installer to do, perhaps its not available at all.

Here goes:

Let say that i have this huge file that i need to get across the net, about 1 gig, maybe more.

Can i write an installer to chop this huge file down to many small size pieces, and write another installer to piece these files back together?

Are there anything close to that?

Also, are there any limits on how much MB i can put into the self install installer that i make using the 'File' function to suck in these huge files?

i give thanks to all those people, who helped me for the past two weeks.

Asch


http://myweb.tiscali.co.uk/afrowuk/d...ds/HJSplit.zip

This allows you to split it into seperate files.
My only suggestion is that you include the first part of it in 1 installer, and that installer will use the download plugin to retreave the other parts from the web.

Edit:
Looking at the HJSplit site (http://www.freebyte.com/hjsplit) I found a command line version of it for use in DOS. (http://www.freebyte.com/download/hjsplit/hjspldos.zip)
You may be able to use the dos version to join the files back together again after downloading the seperate parts.
This would be done using the nsExec plugin e.g.

nsExec::Exec cmd /c hjsplit.exe -j $TEMP\splitedfiles\splitted

So, all files would have been downloaded to $TEMP\splittedfiles and using that command will join them back together again into splitted.zip

HJSplit will split the parts into sizes specified and will name them e.g. splitted.001, splitted.002, splitted.003 and so on.
Joining them back again, you just speficy the name (just splitted, not splitted.00x) and it will do it all for you.

Hope this helps.

-Stuart


Afrow, you don't need to call cmd in that line. You can send parameters without it. You only need cmd if you want pipes or output/input directions such as "echo bla > bla.txt". When you do need cmd you should use ReadEnvStr $0 COMSPEC because cmd is not always the right name, and might not always be in the path.


nsExec::Exec "hjsplit.exe -j $TEMP\splitedfiles\splitted"

That's right...

(was thinking of the logging cmd line!)


-Stuart


RE: big problem
Hello,

thanks, i will give that a try (splitting installer up).
i solved the part where calling mysql commands to execute:
mysql -u root Db < dbfile.sql

i solved that problem by using a batch file instead calling the exec command in NSIS.

This might be a bug in NSIS:

WHen i used ExecWait for tons of things in my codes, this command won't Stop and wait for another installer to finish its work before going to execute another line of code.

Is there another way to stop/wait for process using execwait.

code:
section "installmysql"
execwait '"d:\mysql\setup.exe" $1'
sectionend

section "active_winmysqladmin"
execwait 'c:\mysql\bin\winmysqladmin.exe"
$1'
sectionend

My problem is that it won't stop/wait while the installiion of mysql is going on.

It will continue to execute the next section and since mysql has not been install yet, it doesn't find the "winmysqladmin.exe" file.
i don't know what to do.

Need to use execwait to wait for the installations of other installers.

Sincerely,

Asch


Probably the installer is a self extactor that executes a temporary file. ExecWait doesn't work in such a situation.


The only way around it right now would be to use MessageBoxes! Seems a bit silly to use them, but it could be temporary.

I have an idea though...
In your installers that it extracts, add...


WriteINIStr "$TEMP\mysql.tmp" " " " " " "

...to the .onInit functions.

And...

Delete "$TEMP\mysql.tmp"

..in the .onUserAbort and .onInstSuccess functions of your installers.


Then in this main installer, add this...

exec "d:\mysql\setup.exe" #Executes installer
loop:
Sleep 2000
IfFileExists "$TEMP\mysql.tmp" loop



So.
When the installer is extracted and runs, then it will write a mysql.tmp file to the Windows Temp dir. After executing, it will check for the existance of the tmp file, and while it is still there, it will not go to the next secteion, but will keep looping until the tmp file is deleted. As soon as the extracted installer finishes, or is canceled, then the tmp file is deleted. Therefore the main installer will go onto the next section.

Hope that helps.

-Stuart

Have a look at this page for information about ExecWait and other installers:

http://forums.winamp.com/showthread....+installshield

And read the PM I have sent you about that MySQL input redirection that redirected you to:
http://forums.winamp.com/showthread....ighlight=mysql


RE: Big problem
Hello,

Thank you for your help, i will give them a try. Lets assume i don't need to cut my installer into pieces yet (many exe files), My biggest problem is with execwait not being able to wait until mysql installer finish its work before going to another section, i will have problems throughout my entire installer, b/c i am installing zope and apache too, in one giant package.

my ideas over this past weekend were:
--use messageBoxes all over the place to temporary stop my codes from going any further until the user click on "OK".

-- Use the Sleep command in my code.

I have a question about that before i go any further.

Do you think Sleep would work if i use it right under my 'ExecWait d:\mysql\setup.exe'.

Theoretically, it should wait for so many milliseconds until it continues, RIGHT?

No more ideas after that!


Asch


Read my post.


RE: problem
Hello,

I read it, i actually solved executing mysql db part myself last week. I am putting the chopping my installer apart until later.

Thank you for helping me, the links help.
I like this installer NSIS, if it could be more powerful than this, then i will like it even more. It seems that i am running into all kinds of problems but luckily, i find my way out for a few things . For me its rush time, i don't think i can learn to use other installer and use them for this project in little time i have.

I will post my overall codes onto this post soon. It has gotten Huge!!!

Thank you,

Asch


Way to execute mysql.exe to load in DB!
hello,

My installer is 90% finished and tested, Found alternative way to do things, unfortunately am still stuck with inserting db sql files into mysql during run time.

i am using either Exec or nsExec::Exec.

Code:
StrCpy $R1 "c:\mysql\bin\mysql Db < dump.sql"

Exec "$R1"
Will not work so does
nsExec::Exec "c:\mysql\bin\mysql Db < dump.sql"

Even if i tried to seperate it:
Code :
StrCpy $R1 "C:\mysql\bin\mysql"
StrCpy $R2 "db < dump.sql"

Exec or nsExec::Exec "$R1 $R2"

Can someone please give me a working code for this minor problem, i have tried many combinations.
it just will not run during runtime.


Sincerely,

Asch


Read my post.


RE: problem not yet solved
Dear NSIS Forum Users,

As promised again, here is the latest code for installing Apache, Zope, Mysql and a few error catching and using write,open fle construct and whatever else is there.
Copyfiles too.

Fell free to copy and paste my codes to your codes.

Sincerely,

Asch


Last time I am saying this, read my post.

Here, I quoted it for you again... This one contains the answers for both of your questions. The first link tells you how to make the installer wait and the second tells you how to use IO redirections (mysql < bla.sql).

Read it.

Originally posted by kichik
Have a look at this page for information about ExecWait and other installers:

http://forums.winamp.com/showthread....+installshield

And read the PM I have sent you about that MySQL input redirection that redirected you to:
http://forums.winamp.com/showthread....ighlight=mysql

Hello
Hello Kichik,

thank you for the Links,

Believe me, i read them and tried them all out as far as the DB->Mysql goes. They still will not work. I am not kidding. Inside the installer at runtime, the Db-> mysql part gets Skip even it said that it executed that section.

i even tried:
mysql -u root -e "\. file.sql" dbname
inside my batch file and directly execting it inside the istaller, it will not work.

Once i seperate just the DB->mysql part
any user can click on it and it will work, but it won't budge inside the entire installer during runtime.

I like this installer NSIS, i won't have time to learn to use another one, or learn how to call other installers at runtime.

i got the wait to work using 'Sleep'.

Sincerely,

Asch


ExpandEnvStrings $0 %COMSPEC%
Exec `"$0" /C "$INSTDIR\mysql\bin\mysql" < "$INSTDIR\mysql\bin\myfile.sql"`


This code works. Nothing skips. Have you tried it?

If you want help you'll have to give some more details, example sciprts of what you've read in the links and doesn't work and the errors you get because currently all I am getting from you is nothing works everytime and the amount of information in there is zero.