Commit graph

252 commits

Author SHA1 Message Date
Robert Knight
761a4c5d3b Move cmake code to generate a C++ source file from a binary data file into a helper module 2011-08-29 17:40:25 +01:00
Robert Knight
3c836c2d0c Minor formatting fix 2011-08-29 17:23:44 +01:00
Robert Knight
52fdee5a75 Remove duplicated code for getting the ID of the current process in Log.cpp.
Re-use the existing function from ProcessUtils
2011-08-29 17:22:06 +01:00
Robert Knight
7b29c29d85 Avoid trying to wait for the main app process to exit if no process ID for it is specified 2011-08-29 15:17:31 +01:00
Robert Knight
f9238f479b Log update installation details to update-log.txt in the correct Mendeley data directory under Linux 2011-08-29 14:44:08 +01:00
Robert Knight
0d22024b49 Add additional API documentation 2011-08-27 18:31:03 +01:00
Robert Knight
ffbd2553ff Add some more notes on usage of the update installer 2011-08-27 17:15:20 +01:00
Robert Knight
ddb52aa244 Change the package-map JSON file into a general config file which also specifies the name of the updater and path to the main binary.
The generated file_list.xml needs to specify the path
 of the main binary and the name of the updater binary
 to download.  Change the format of the JSON config file to
 allow these paths to be specified there.

 * Update create-packages.rb to add the <is-main-binary> attribute
   to the appropriate entry in file_list.xml

 * Modify the sample config file

 * Improve documentation in create-packages.rb
2011-08-27 16:09:11 +01:00
Robert Knight
d414423c35 Create the output directory if it does not already exist. 2011-08-26 19:02:01 +01:00
Robert Knight
0a684be50f Enable code to create zip packages that was unintentionally commented out 2011-08-26 18:55:06 +01:00
Robert Knight
dc741814c9 Move the function used to obtain the log file path into AppInfo::logFilePath() since it will be application-specific. 2011-08-26 18:40:23 +01:00
Robert Knight
4391ea7a60 Fix Mac compilation
Use correct return type for ProcessUtils::runElevatedMac()
2011-08-26 18:35:25 +01:00
Robert Knight
8b757692b1 Replace "Mendeley Updater" string in UpdateDialogCocoa.mm with AppInfo::name() 2011-08-26 18:27:04 +01:00
Robert Knight
be2e0520ad Centralize the name of the application being updated in AppInfo.h
Also add AppInfo.h missing from previous commit.
2011-08-26 18:22:25 +01:00
Robert Knight
7597dee64a Centralize the name of the updater application in AppInfo.h 2011-08-26 18:20:38 +01:00
Robert Knight
38c9cd9b41 Only try to link libdl on Unix platforms 2011-08-26 18:08:56 +01:00
Robert Knight
4459c96595 Update the dependencies for the updater binary mentioned in the README file. 2011-08-26 17:40:34 +01:00
Robert Knight
9391fb6b5e Add an old-school ASCII-art version of the update dialog as a fallback under Linux when GTK is not available.
If the GTK UI cannot be loaded, this will pop up a terminal displaying
progress information.  Hopefully users will find this mildly amusing.
2011-08-26 17:36:22 +01:00
Robert Knight
630d64e859 Make the GTK dependency optional at runtime on Linux
Build the GTK dialog as a separate shared library which
is embedded into the main updater binary.

At runtime the updater extracts the shared library and attempts to load it.
If this succeeds, the GTK UI is used, otherwise the updater will fall
back to something else - currently a silent install.
2011-08-26 16:59:03 +01:00
Robert Knight
93f58e77da Remove un-implemented updateRetryCancel() method from UpdateObserver
The current update dialogs do not support retry/cancel - if a file
cannot be installed the update will just fail with an error and
any partial install will be reverted.
2011-08-26 15:17:59 +01:00
Robert Knight
63f2480b90 Remove unused UpdateDialogGtk::restartApp() accessor 2011-08-26 15:06:02 +01:00
Robert Knight
af41002e2e Update the TODO file
The ability to prompt the user to Retry/Cancel file writes during installation is less
necessary now that we can move files that are in use.  Without retry/cancel support
the update installation will just be canceled if it fails.
2011-08-26 14:22:12 +01:00
Robert Knight
04f8d7ec0b Fix unsigned/signed int comparison in FileOps::toUnixPathSeparators() 2011-08-26 14:15:22 +01:00
Robert Knight
bf56d5a2fe Add a note about possibly using the transactional features of NTFS in Windows >= Vista for more robust update installation in future. 2011-08-26 13:15:06 +01:00
Robert Knight
adba463f61 Simplify cleanup of the updater's temporary directory
Following the change to FileOps::removeFile() to support 'removal'
of files that are in use in Windows, the cleanup of the updater's
temporary directory can be performed from the non-elevated updater
setup process once the main install process has returned.

This removes the --mode cleanup run mode in the updater.
2011-08-26 13:13:11 +01:00
Robert Knight
ef6809e0fe Fix updater cleanup of temporary directory on Windows
* On Windows FileOps::removeFile() fails for updater.exe
   since that file is in use by the current process.

   Whilst it is not possible to remove the file whilst it
   is in use, it can be moved or scheduled for deletion on reboot.

   This commit changes FilesOps::removeFile() to simulate the
   behavior of unlink() on Linux by moving in-use files to
   a temporary directory and then scheduling for them to
   be removed on restart.
2011-08-26 12:55:09 +01:00
Robert Knight
0134e7d53e Implement ProcessUtils::runSync() under Windows
This follows the existing async launching path and then uses
WaitForSingleObject / GetExitCodeProcess to wait for the process
and get its status.
2011-08-26 11:56:28 +01:00
Robert Knight
e5e163e6d5 Open log in append mode so that new entries are written at the end.
There is no locking on the Log file so conflicting updater processes
may corrupt each others' entries - although in practice this has not
been a problem yet.
2011-08-26 11:54:14 +01:00
Robert Knight
098c9cb194 When re-launching the application after an update is installed, do it from a non-elevated process.
Previously the application was restarted from the main install process, which may have
  been elevated.  The main application must be started from a non-elevated updater/updater.exe
  process otherwise the main app will inherit the elevated status from its parent.

  * Modify ProcessUtils::runElevated() to return the status code of the process
  * Change UpdateInstaller to run the main installation synchronously from the initial
    updater process in the case where elevation is not required.
  * Remove calls in main.cpp to relaunch the main application after the UI is closed.
2011-08-26 11:17:09 +01:00
Robert Knight
d705095fe9 Update the TODO file with new tasks 2011-08-26 11:16:26 +01:00
Robert Knight
1189720a58 Add a script which creates the file_list.xml file and compressed packages for autoupdates from an installation directory and a package -> file map.
* create-packages.rb takes an input directory containing all files as they are laid out in
    the installation directory of an application, a JSON file mapping files to packages and
    generates the file_list.xml file listing all files in the release along with the
    .zip packages containing those files.

  * Add single-package-map.json which is the simplest possible package map - putting
    all files in a single package.

    Per-project/build package maps can be written that separate files into different packages
	based on the component they belong to.

This script replaces the autoupdate-setup tool written in C++ in the utilities/autoupdate-setup
directory in the desktop source tree.
2011-08-25 18:55:23 +01:00
Robert Knight
3a747ad557 Add note about looking for better solution to overwriting files in use during Windows updates 2011-08-25 14:34:29 +01:00
Robert Knight
da2614d427 Change the syntax of the backwards-compatible update scripts.
Instead of moving the whole <update> section to an embedded <update-v3>
node, just use a different name for the <install> section since older
clients will ignore the new <packages> section.

For older clients:

 * The <install> section lists the packages to download.  This will exist
   in addition to the <packages> section.
 * The real <install> section listing the files to install is renamed to
   <install-v3>
2011-08-25 12:23:04 +01:00
Robert Knight
78b3c14260 Print a more useful message when an std::exception is thrown whilst running a test. 2011-08-25 11:52:02 +01:00
Robert Knight
62bf142f06 Fix ProcessUtils compilation on Linux/Mac
* Only compile the Windows command-line conversion function on Windows
2011-08-25 11:38:12 +01:00
Robert Knight
d1848ff35a Update TODO file 2011-08-24 16:53:18 +01:00
Robert Knight
9fa311ebaf Use the embedded application icon for the Update Dialog window 2011-08-24 16:49:47 +01:00
Robert Knight
13b280a4fd Use the correct path to the application icon in updater.rc 2011-08-24 16:38:43 +01:00
Robert Knight
2a1db3927d Add icon to updater executable. Currently this is just the Mendeley Desktop icon. Untested. 2011-08-24 16:34:46 +01:00
Robert Knight
04c9c7204b Make updater.exe a WIN32 GUI application instead of a console application on Windows
* Add WIN32 flag to add_executable() so that cmake generates a GUI application
 * Add WinMain() entry point which converts the unicode command line arguments to ANSI and then calls the standard main() entry point.

 The unit test continues to pass although I am not sure whether
 converting command-line args from Unicode to ANSI will cause problems
 with filenames passed on the command-line that contain non-ANSI
 characters.
2011-08-24 16:11:53 +01:00
Robert Knight
bae300a6a7 Report an error on update installation if the update script cannot be read. 2011-08-24 12:59:51 +01:00
Robert Knight
82de2a91f8 Update TODO file 2011-08-24 12:29:43 +01:00
Robert Knight
b1216d73b8 Update TODO file 2011-08-24 12:17:08 +01:00
Robert Knight
557dc1273e Update the GTK UI for install errors to match the Mac and Windows UIs
* Display the error details in a message box
 * Set the progress label text appropriately in the event of an error
2011-08-24 12:15:02 +01:00
Robert Knight
ddff071b8c Fix progress percentage calculation broken in recent commit
Multiply the fractional value by 100 instead of multiplying the denominator
of the division operation by 100.
2011-08-24 11:53:13 +01:00
Robert Knight
b4311d79a9 Rename Dir to DirIterator 2011-08-24 11:53:02 +01:00
Robert Knight
887619f239 Add missing variable initialization in Dir class 2011-08-24 11:48:36 +01:00
Robert Knight
a2ea1841b3 Merge branch 'master' of ssh://gitweb/git/desktop/standalone-updater 2011-08-24 11:45:05 +01:00
Robert Knight
3b1452cefe Build the updater with -Wconversion and fix several issues encountered in the process 2011-08-24 11:44:29 +01:00
Robert Knight
b0b3fc4eaa Fix compile errors reported by -Wall -Werror on Mac
Correct argument types and return a value from UpdateDialogCocoa::updateRetryCancel()
2011-08-24 11:30:06 +01:00