Archive: .onInstSuccess question


.onInstSuccess question
What's going on...I have an nsi file that has a .onInstSuccess function. In it, I attempt to change the permissions on some of the files installed. The install part is fine, but the changing of permissions on the installed files is not.

I'm attempting this on XP, using MakeNSISW version 2.1 to do the compiles.

In doing some debugging I notice the following things:

1). It only works when the files are already there(i.e. I run the installer twice).

2). more perplexing, when I run that second time, if I do it running the install 'exe' produced by the compiler, it does not work, but if that second time I use the GUI tool and click the recompile and test button, then it works.

3). I am changing perms via !system calls

4). below is the a snippet of the log when I compiled, as it shows there are no issues.

Function: ".onInit"
InitPluginsDir
File: "WFXForm.ini"->"$PLUGINSDIR\WFXForm.ini" [compress] 432/977 bytes
FunctionEnd
Function: ".onInstSuccess"
!system: "CACLS C:\CSGSystems /t /e /r Users"
processed dir: C:\CSGSystems
processed file: C:\CSGSystems\launch.bat
processed file: C:\CSGSystems\launcher.ico
processed dir: C:\CSGSystems\vcmc
processed dir: C:\CSGSystems\vcmc\20040607
processed file: C:\CSGSystems\vcmc\20040607\CMD.EXE
processed file: C:\CSGSystems\vcmc\20040607\half3.gif
processed file: C:\CSGSystems\vcmc\20040607\launch.bat
processed file: C:\CSGSystems\vcmc\20040607\launch.lnk
processed file: C:\CSGSystems\vcmc\20040607\launcher.ico
processed file: C:\CSGSystems\vcmc\20040607\msvcr71.dll
processed file: C:\CSGSystems\vcmc\20040607\tci.ini
processed file: C:\CSGSystems\vcmc\20040607\vcmc.exe
processed file: C:\CSGSystems\vcmc\20040607\vcmcins.bat
processed file: C:\CSGSystems\vcmc\20040607\vcmcins2k.bat
!system: returned 0
!system: "CACLS C:\CSGSystems /t /e /g Users:f"
processed dir: C:\CSGSystems
processed file: C:\CSGSystems\launch.bat
processed file: C:\CSGSystems\launcher.ico
processed dir: C:\CSGSystems\vcmc
processed dir: C:\CSGSystems\vcmc\20040607
processed file: C:\CSGSystems\vcmc\20040607\CMD.EXE
processed file: C:\CSGSystems\vcmc\20040607\half3.gif
processed file: C:\CSGSystems\vcmc\20040607\launch.bat
processed file: C:\CSGSystems\vcmc\20040607\launch.lnk
processed file: C:\CSGSystems\vcmc\20040607\launcher.ico
processed file: C:\CSGSystems\vcmc\20040607\msvcr71.dll
processed file: C:\CSGSystems\vcmc\20040607\tci.ini
processed file: C:\CSGSystems\vcmc\20040607\vcmc.exe
processed file: C:\CSGSystems\vcmc\20040607\vcmcins.bat
processed file: C:\CSGSystems\vcmc\20040607\vcmcins2k.bat
!system: returned 0

MessageBox: 0: "Install completed successfully."
FunctionEnd


SO my questions are:
1). Is it wrong to expect that by the time .onInstSuccess is executed the files to be installed are not there yet?

2). Given the same nsi file, isn't the 'recompile and test' in the GUI the same as executing the install 'exe' produced by the compile??? Because as stated above I am getting different behaviour when the files already exist.



Sorry about the lengthy post, any help would be appreciated


I think you're confused. !system is a compile time instruction. It will be executed when you build the installer, not when you run it.

-Stu


Thank You...yes, I am confused...so how would you approach doing any kind of 'post install' file manipulation?? Executing a script on the back end??


One of the Exec functions/plugins should do what you want e.g. NsExec or Exec (nsExec will hide the console window that is normally displayed when running a command line program.)