Qt Installer Framework and Administrator privileges [SOLVED]
-
Hi,
You should check the "bug report system":http://bugreports.qt-project.org to see if someone already reported this missing documentation, if not you could consider opening a new report
-
Not in "bug report system":http://bugreports.qt-project.org/ but someone has mentioned it "here":https://qt.gitorious.org/installer-framework/installer-framework/commit/aa9d0b6cbe8c215ab4610aa6349250c08b4d09b3
I think I'll go ahead and create a report for this. -
Sorry, my mistake, "this link":https://qt.gitorious.org/installer-framework/installer-framework/commit/aa9d0b6cbe8c215ab4610aa6349250c08b4d09b3 is a commit. So I assume it means in the next version this'll be solved (in other words it is solved already. No need for any reports) :)
-
Exactly what I was about to say :)
Happy coding !
-
Hi, I am currently trying to run part of my install with admin rights. Adding the fix you have suggested does prompt the user to allow the install but when it executes the batch file which installs a driver onto the user’s machine the batch file is not run as admin. Any clues why that's the case? Thanks in advance ;)
-
To be precise, this is how I solved my problem because I was working on Windows and if you are also on Windows, I suggest you also do this and skip all the complications:
@
Component.prototype.createOperations = function()
{
try
{
// call the base create operations function
component.createOperations();
if (installer.value("os") === "win")
{
component.addOperation("Execute", "cmd /C "@TargetDir@\SomeFolder\SomeFile.exe"");
}
} catch (e)
{
print(e);
}
}
@
You don't need to add admin rights for this to work.
Just let the command prompt do the job for you :) -
Hi again, Thanks for your reply. I have added the operation call below as you have in your script but it causes a syntax error in the command window when trying to build the installer.
@Component.prototype.createOperations = function()
{
try
{
// call the base create operations function
component.createOperations();
if (installer.value("os") === "win")
{
component.addOperation("CreateShortcut",
"@TargetDir@/%1.exe", "@StartMenuDir@/%1.lnk");component.addOperation("Execute", "cmd /C", "@TargetDir@\\USB_Install.bat"); } } catch (e) {
print(e);
}
}@perhaps you can see where I'm going wrong?
-
Yes it's obvious where you're going wrong. If you look at my code above I've sent it all inside a single command without separating the parameters. AND WITH DOUBLE QUOTES FOR THE PATH PARAMETER!
Like this:
@
component.addOperation("Execute", "cmd /C "@TargetDir@\USB_Install.bat"");
@
Please pay attention to every single character in this code.Or, you can do it the way you were going to do, but again, don't forget the double quotes.
Like this:
@
component.addOperation("Execute", "cmd", "/C", ""@TargetDir@\USB_Install.bat"");
@ -
My apologies, I did actually write it using the syntax above at first but 'tinkered' with it a little when it was not working. I must have then copy pasted the wrong(changed) code into this post window.
I still cannot get the drivers to install using either of the script calls. Using the first syntax the software does install but the drivers do not, there are no error messages and the install log states-
backup com.exi.root operation: Execute
- arguments: cmd /C "C:\Users\Bobby\SFC4000\USB_Install.bat"
Done
perform com.exi.root operation: Execute - arguments: cmd /C "C:\Users\Bobby\SFC4000\USB_Install.bat"
ElevatedExecuteOperation setNativeArguments to start: "cmd /C "C:\Users\Bobby\SFC4000\USB_Install.bat""
cmd /C "C:\Users\Bobby\SFC4000\USB_Install.bat"" started, arguments: "
Done
so it is calling the command correctly from the script yes?
The second script call gives an error message-
"Error during installation process(com.exi.root):
Execution faild(Unexpected exit code: 1): "cmd /C "C:
\Users\Bobby\SFC4000\USB_Install.bat""I'm sure I'm just doing something stupid but i just can't see it. Thanks for your help.
- arguments: cmd /C "C:\Users\Bobby\SFC4000\USB_Install.bat"
-
Oh, I see. I also noticed it now, you are trying to run a bat file. Did you set workingDirectory parameter to the folder in which your bat file exists?
My only suggestion would be to go for all of the solutions above at once. :)
Add this to your package
@
<RequiresAdminRights>true</RequiresAdminRights>
@And call elevated version of the function like this (Also set working directory)
@
component.addElevatedOperation("Execute", "cmd /C "@TargetDir@\USB_Install.bat"", "workingDirectory=@TargetDir@");
@If this also doesn't work then you can share the contents of your bat file.
Maybe that way I can understand a little bit more about the issue you're facing. -
Thank you very much for your help. It's much appreciated. Unfortunately it is still not working. However it does not produce a different error-
"Execute" as admin: true
backup com.exi.root operation: Execute- arguments: cmd /C "C:\Users\Bobby\SFC4000\USB_Install.bat", workingDirectory=C:\Users\Bobby\SFC4000
Done
perform com.exi.root operation: Execute - arguments: cmd /C "C:\Users\Bobby\SFC4000\USB_Install.bat", workingDirectory=C:\Users\Bobby\SFC4000
ElevatedExecuteOperation setWorkingDirectory: "C:\Users\Bobby\SFC4000"
ElevatedExecuteOperation setNativeArguments to start: "cmd /C "C:\Users\Bobby\SFC4000\USB_Install.bat""
cmd /C "C:\Users\Bobby\SFC4000\USB_Install.bat"" started, arguments: "
Done
Operation 'Execute' with arguments: 'cmd /C "C:\Users\Bobby\SFC4000\USB_Install.bat"; workingDirectory=C:\Users\Bobby\SFC4000' failed: Execution failed: Could not start: "cmd /C "C:\Users\Bobby\SFC4000\USB_Install.bat""(Process failed to start: The parameter is incorrect.)
created warning message box installationErrorWithRetry: 'Installer Error', Error during installation process (com.exi.root):
Execution failed: Could not start: "cmd /C "C:\Users\Bobby\SFC4000\USB_Install.bat""(Process failed to start: The parameter is incorrect.)
I don't think it is the actual batch file that's the problem as it runs fine when called directly from the administrator command prompt but it is show below anyway.
@
@echo offrundll32.exe libusb0.dll,usb_install_driver_np_rundll sfc3000.inf
@ - arguments: cmd /C "C:\Users\Bobby\SFC4000\USB_Install.bat", workingDirectory=C:\Users\Bobby\SFC4000
-
I can see a very familiar error message there:
"Process failed to start: The parameter is incorrect"Try this and share the results if you can.
Press WIN + R to open "Run" program
Enter the following line as a command and see what happens:
cmd /C “C:\Users\Bobby\SFC4000\USB_Install.bat”As far as I know, if it runs using Run application then it will surely run using your installer too.
If it doesn't run using Run application then you shouldn't mess around with installer much and try to correct your batch script.What about this, don't turn off echo and insert a pause at the of your batch script. Like this:
@
rundll32.exe libusb0.dll,usb_install_driver_np_rundll sfc3000.inf
pause
@ -
ECHO is on.
It was originally calling the batch file from the system32 directory so I added a call to cd and now change it to the .bat's current dir and slightly modified the folder layout and updated the batch file accordingly. This is was cmd window prints out
C:\Windows\system32>cd C:\Users\Bobby\SFC4000\
C:\Users\Bobby\SFC4000>cd ".\Driver\exi"
C:\Users\Bobby\SFC4000\Driver\exi>rundll32.exe libusb0.dll,usb_install_driver_np
_rundll sfc3000.infC:\Users\Bobby\SFC4000\Driver\exi>pause
Press any key to continue . . . -
Sorry I didn't get it. Is this the output for Installer running your batch or is this the result for Run application???
There are no errors here, if you're saying that it ran just fine when you tried it with Run then it seems we're stuck at this point!
My advice would be to check the scripts again one more time and if you are 100% sure that it just isn't working for you then try another installer creator (like inno setup) for the time being. Until new release for QTIFW comes out. -
That was the output in the command window when using your win+r instructions.
Its OK now though I finally have it working!! I applied all of the changes that you suggested and also changed the installer compatibility settings in it's properties so that it's run as administrator. I probably would have got it working much sooner if i hadn't spent an hour or so trying to install the 32bit drivers on my 64bit machine DUHHHH! But hey, we live and learn.
Thanks for your help really appreciate it :)
-
Hi, sorry to bring this post back to life, but I'm having problems executing a bundled installer from the installscript.qs in my QtInstaller application.
What I do is install the .msi to the @TargetDir@ and then try to launch it with
@component.addOperation("Execute", "msiexec.exe /i", ""@TargetDir@\MyUsbDriver.msi"");@
(I used the double quotes for the target dir because my installer application can accept paths with spaces, I'm installing on wnidows)
I keep on getting error messages stating:
bq. Execution Failed: Could not start: "C:\Program Files\MyApp\MyUsbDriver.msi" (Process failed to start: The parameter is incorrect)
(I used the double quotes for the target dir because my installer application can accept paths with spaces, I'm installing on wnidows)Any ideas on how to correctly launch the .msi file?
-
[quote author="amahta" date="1390477421"]To be precise, this is how I solved my problem because I was working on Windows and if you are also on Windows, I suggest you also do this and skip all the complications:
@
Component.prototype.createOperations = function()
{
try
{
// call the base create operations function
component.createOperations();
if (installer.value("os") === "win")
{
component.addOperation("Execute", "cmd /C "@TargetDir@\SomeFolder\SomeFile.exe"");
}
} catch (e)
{
print(e);
}
}
@
You don't need to add admin rights for this to work.
Just let the command prompt do the job for you :)[/quote]This should work for you. Pass your msi file using "msiexec" command to "cmd"
-
Using
@component.addOperation("Execute", "cmd /C", "msiexec.exe /i", ""@TargetDir@\MyUsbDriver.msi"");
@gives me the same execution error stated above.
Running the command from cmd starts the driver installation though. So it's got to be something in the installscript.qs.
Any ideas?