I would like to add an option for silently updating a sandboxed OSX app (on Mavericks, but not on MAS).
I use AppWrapper to create an installer, which asks each time for a password in order to install the app.
For silent updates I found the following suggestions on the web, using Shell commands:
sudo installer -pkg your_installer_file.pkg -target /
echo <password> | sudo installer -pkg "your_installer_file.pkg" -target /
Both fail with this error message (tested on different Macs) :
[quote] Shell result : sudo: no tty present and no askpass program specified
I also tried to copy myself the newly downloaded app to the Applications folder, but replacing the old app or deleting the old app fails silently.
What would you suggest in order to enable a silent update of an app on Mavericks?
you will need to have a helper app installed to run as root to have your installer launch.
What if you app follows these steps (although I guess it won’t be “silent”)
- download the installer (pkg/dmg whatever) to downloads directory
- have app launch it (via f.launch)
- have app quit (installer should overwrite existing app)
The problem is you cannot update xxx.app while xxx.app is running
Thanks, David and Christian!
I have a solution, which looks somewhat creepy to me, but it works:
- I download the installer to a folder in SpecialFolder.ApplicationData
- I launch a helper console app and terminate the main application.
- The helper app uses an interactive shell to launch the installer (to provide sudo password):
[code] App.imInstallShell = New Shell
App.imInstallShell.Mode = 2 // Interactive
Dim cmd As String = "sudo installer -pkg " _
+ chr(34) + App.InstallerPath + chr(34) + " -target /"
If Not App.imInstallShell.IsRunning Then
Dim pw As String = App.InstallerPW
// Now start the installer
// Send password
I have a Loop in the console’s Run event, with a App.DoEvents, where I check for install finished condition and then I launch the updated app.
On the very first run (and in user settings) I ask for the password and if the user wishes silent update, then I store the password in the keychain.
I noticed, that our users tend to not update, because they don’t like all that clicking and password entering of the standard installer.
you might be better off putting the installer in the temporary items dir just so it gets removed when / if the user logs out & logs back in or as part of normal maintenance
otherwise you’re going to need to do that for them
[quote=58659:@Norman Palardy]you might be better off putting the installer in the temporary items dir just so it gets removed when / if the user logs out & logs back in or as part of normal maintenance
otherwise you’re going to need to do that for them[/quote]
Yes, I do cleanup from my own code now. But I think your suggestion is a better idea.