46 Commits
Author SHA1 Message Date
Zorg dfaed624ae Merge branch 'master' into ui-separation-and-xpc 2017-01-17 15:58:02 -05:00
Zorg 2bb5ce4318 Make SUBundleIcon & SUApplicationInfo take SUHost, not NSBundle
When we retrieve the "CFBundleIconFile" key from the Info dictionary, we should rely on SUHost's method of obtaining that value now.
2017-01-07 22:55:13 -05:00
Zorg e1a4ad9371 Add level parameter to SULog()
Current levels are: default and error
2017-01-05 22:51:36 -05:00
Zorg 853a0ecd82 Use SU prefix for ApplicationInfo and BundleIcon classes
This is to hopefully make merging recent changes from master easier.
2016-12-24 21:19:20 -05:00
Michel Fortin 5f255c4865 Fixing memory leak where transferring of property dictionary to ARC. 2016-08-27 11:20:34 -04:00
Zorg 47f08be1a0 Don't check or download updates if updater isn't allowed interaction
This only affects updater delegates that return NO from -updaterShouldAllowInstallerInteraction:

This improves the user experience in sparkle-cli where now the checking can be aborted before even downloading the update feed, if it knows ahead of time that installation will fail.
2016-08-20 18:56:01 -04:00
Zorg 766dd50aeb More SU -> SPU prefix changing 2016-08-06 21:00:14 -04:00
Zorg c9f673cda8 Use SPU prefix in many places 2016-08-05 19:10:21 -04:00
Zorg 8c564fef1f Remove +[SUFileManager defaultManager] and use alloc/init 2016-07-30 10:39:17 -04:00
Zorg ea1b04391f Improve cache storage handling of files
We first create a directory with respect to the app's bundle ID being updated, sparkle's bundle ID, and a directory inside for a specific purpose. Then we remove all old directories inside there, and create a new unique temporary directory.

This is to avoid conflicts with eg: multiple updaters running against each other around the same time, or files for one function interfering with files from another purpose, while still having a way to clean up old files.
2016-07-30 01:00:14 -04:00
Zorg 5852ecf0e7 Improve handling of disallowing update interaction
When resuming updates, if interaction is disallowed, we can't continue on with interactive package installation
2016-07-29 20:21:53 -04:00
Zorg e2da47b7c7 Improve handling of storing files in cache
Create distinct subdirectories in our cache directory so files for different purposes won't conflict.

For the installer, move the download archive to the installer's cache location. If the installer is running as root, this moves it to a place only root can access I believe. This is also to prevent other functionality from touching these files.
2016-07-28 22:54:28 -04:00
Zorg 32bf570b4c Add some comments to installation process 2016-07-28 20:27:12 -04:00
Zorg 3be36d8f22 Don't pass installer/agent path to launcher XPC service
The InstallerLauncher code now tries to locate these tools inside Contents/MacOS/ or inside the Resources directory. The installer launcher XPC service now has a copy of the tools included in its bundle.

This may seem like wasting space but it enables eg, the XPC service not trusting a sandboxed application. A developer could always remove the tools from the Sparkle framework if necessary (we can't because the XPC services are optional..)

Using the XPC service allows the developer to sign the installer executable (Autoupdate.app). The agent app can be moved and signed into the MacOS executables directory as well. We don't do that automatically because Xcode's tooling doesn't play nice with attempting that, although that could be looked at later.
2016-07-27 19:57:46 -04:00
Zorg 646ed6f3c4 Improve logic for allowing installer interaction
We now distinguish between the updater delegate allowing interaction and the update driver allowing interaction. We also remove an interaction allowed flag from the AppInstaller, letting shouldShowUI flag suffice.
2016-07-26 20:00:56 -04:00
Zorg 0ca688073b Disable root support & checking
Assume that the updater will be run as a logged in user.
The command line driver and progress app aren't completely root safe anyway, and running the progress app under a different user could be quite awkward from root
2016-07-26 19:16:38 -04:00
Zorg eac55846a8 Avoid copying the installer to a temporary location 2016-07-25 17:13:18 -04:00
Zorg 1384b5a80f Allow tagging installation type in appcast item enclosure
This is now necessary for package type installations so we can know whether or not we should authenticate ahead of time.

Of course, we also verify that the download contains the type of installation we expect (because the appcast is not very trusted).
2016-07-24 23:35:47 -04:00
Zorg d8196e1c5d s/cancelled/canceled/ 2016-07-24 20:17:09 -04:00
Zorg 1d3776d5c7 Show app icon in the prompt for authorization 2016-07-24 19:23:56 -04:00
Zorg e5643e2990 Improve authorization prompt handling
We now present a better worded dialog (X wants to update. Please type your password to allow this. OK/Cancel)
We still need to set the icon for the dialog window.

I also fixed some issues with canceling the dialog still throwing an error.
2016-07-24 17:05:26 -04:00
Zorg c95b337b09 Don't need SUSubmitInstaller.h/m anymore 2016-07-24 15:37:33 -04:00
Zorg a1d43997d9 With JoinExistingSession, the agent doesn't need to submit the intaller ever 2016-07-24 13:03:39 -04:00
Zorg 21ad358772 Add JoinExistingSession key to InstallerLauncher service
This is necessary for older OS versions (10.8 & 10.9), otherwise authorization interaction will not be allowed
2016-07-24 11:06:37 -04:00
Zorg 41ee168f2c Change try again error to authorize later error 2016-07-23 14:49:19 -04:00
Zorg c2db46f656 Add error codes to log messages 2016-07-23 14:46:35 -04:00
Zorg 345ed3b60e Add resuming downloaded updates without starting the installer automatically
This allows automatically downloading updates, and having them prompt up later, so the user can perform authorization later for starting up the installer
2016-07-23 09:08:29 -04:00
Zorg 3244bf7f14 Move installer status info service to progress agent 2016-07-18 21:14:33 -04:00
Zorg dd02cb2509 Change Autoupdate target from app to command line tool 2016-07-18 18:46:12 -04:00
Zorg 66e3083e0c Initial work on removing AuthorizationExecuteWithPrivileges
I need to at least look at:
* Automatic downloaded / silent updates
* Running updates as root user from beginning
* Status info query service
* Add guided flag in the appcast
2016-07-18 17:40:35 -04:00
Zorg e0109e2fd5 Have executable path be inside arguments array 2016-07-16 13:09:08 -04:00
Zorg da185de61b Rationalize which domain we submit jobs under 2016-07-16 13:04:10 -04:00
Zorg c37fc24389 Rename AutoUpdate to Installer for service name functions 2016-07-16 08:58:34 -04:00
Zorg 64d740a761 Don't log SMJobRemove() job not found error
Also rationalize why we aren't first checking if the job already exists
2016-07-13 22:55:20 -04:00
Zorg 8563a40cd2 Use XPC for IPC to the installer instead of CFMessagePort
We now use XPC for communication between Sparkle.framework and Autoupdate.
Autoupdate is now ran as a launchd agaent/daemon. (Most of the time, it acts as an agent).

Using XPC can only be done from non-sandboxed processes, so a connection and status service had to be created.

Currently, the GUI progress tool doesn't work properly, but everything else should be behaving like before.
2016-07-12 19:59:24 -04:00
Zorg 340633fd79 Comment more on why launching Autoupdate with LaunchServices is necessary 2016-07-03 11:54:28 -04:00
Zorg 87903c0d97 Fix unit tests from not compiling
SUFileManager fileManager method had to be renamed to satisfy Swift
2016-05-27 22:23:04 -04:00
Zorg 64a7624744 Add authorization environment when using file manager
If the file manager is used for authorization, we can now supply an authorization environment.

This allows us to specify a customized prompt message and an icon to use in the authorization dialog window. We no longer need to include an icon for Autoupdate app.

We now also see if we can get authorization rights access right away, rather than lazily when executing a tool.
2016-05-27 12:36:44 -04:00
Zorg 7c06ceb7e4 Set version info for XPC services 2016-05-18 22:28:02 -04:00
Zorg ef134d9245 Allow updater to be ran as root & inherit privileges
The installer can now inherit privileges from the updater, which inherits
privileges from the process that spawns the updater. As such, we can now
run the updater & installer as root, and no authorization dialog can prompt up.

The installer now must abort or install if the target app has terminated.
Zombie processes will no longer stay around.

Because the root user has no trash directory, we ignore logging the error if it was not found.
We also avoid invoking mdimport which fails as root on the installed app.
mdimport may have been used before for updating mdimporter files, however, it should be the developer's
responsibility to ensure their mdimporter files have an updated date stamp, which will work if a user updates an app manually.
Other than that, we already touch the app to register it with LaunchServices, so that should suffice.
2016-04-30 12:26:36 -04:00
Zorg cd108ef47c Allow automatically downloading updates, but alerting the user immediately
Following cases where after an update has been automatically downloaded, Sparkle may alert the user right away:
1) Critical updates
2) Insufficient write access to install without being root
3) Package type installations

In addition to alerting the user right away, if they dismiss the update, the schedule timer will be on regular intervals. We also no longer need to care about writability in the updater, only just in the installer.
2016-04-10 02:32:54 -04:00
Zorg d7cca8a594 Check if runningApplication is nil for errors.. 2016-04-02 12:17:54 -04:00
Zorg 116c8ea8b7 Supply NSWorkspaceLaunchNewInstance when launching AutoUpdate
I don't think it actually matters since we are launching a copy we created, but
sounds like the right thing to do anyway.
2016-04-02 12:12:48 -04:00
Zorg 38a69cee5b Launch AutoUpdate via LaunchServices again.
I was being stupid for trying to launch the executable rather than the app.
2016-04-02 05:34:31 -04:00
Zorg e7f85bb40f Add testing writability as part of SUInstallerLauncher
This is necessary for detecting if automatic updates are possible in a sandboxed environment
2016-04-01 18:56:20 -04:00
Zorg 5c08e0a1d1 Add InstallerLauncher XPC Service
This allows Sparkle to be used as-is in a sandboxed application,
without needing to place Sparkle into its own XPC service.

Currently the main app may need to set a global mach service lookup exception
and a client download exception, however this can be fixed by creating a couple more
services. Testing for disk writability will need be done in a service too.
2016-04-01 17:54:12 -04:00