Commit graph

62 commits

Author SHA1 Message Date
Robert Knight
57e13d941b Fix dir iteration on Windows
Instead of passing the directory to FindFirstFile(), a wildcard
of the form C:\Path\To\Dir\* needs to be passed.
2011-08-22 18:28:42 +01:00
Robert Knight
66dc8d4720 Catch any file I/O exceptions reported whilst cleaning up the updater directory in UpdateInstaller::cleanup() 2011-08-22 18:04:52 +01:00
Robert Knight
7893fe500a On Windows, look for the zip tool as part of the Cygwin installation instead of relying on it being in the current path.
This is specific to the configuration of build-windows.
2011-08-22 18:03:53 +01:00
Robert Knight
c0d1807252 Implement several FileOps functions under Win32 2011-08-22 18:03:27 +01:00
Robert Knight
2b772611ff Print details of any exceptions that escape UpdateInstaller::run() 2011-08-22 18:02:51 +01:00
Robert Knight
d7ecf3722a Implement ProcessUtils::runAsync() and ProcessUtils::currentProcessPath() on Win32 2011-08-22 18:02:18 +01:00
Robert Knight
b57696aa18 Use the correct binary names in the updater test on Win32.
Binary names on Windows end with '.exe'
2011-08-22 17:02:09 +01:00
Robert Knight
cf606b0cfe Catch IO exceptions when trying to remove the existing write-access test file. 2011-08-22 17:00:15 +01:00
Robert Knight
f8d7cb3b4a Implement FileOps::touch() and FileOps::removeFile() for Win32 2011-08-22 16:59:23 +01:00
Robert Knight
6418b44924 Use zlib from external/zlib to build the minizip library on Win32 2011-08-22 16:37:53 +01:00
Robert Knight
e11cc9193a Fix MSVC++ compile error due to non-const array dimension values. 2011-08-22 16:36:39 +01:00
Robert Knight
6a264f80b7 Add missing object file to zlib Makefile 2011-08-22 16:34:35 +01:00
Robert Knight
584ff64b49 Add ZLib 1.2.5 to external/zlib from http://www.winimage.com/zLibDll/minizip.html 2011-08-22 16:03:42 +01:00
Robert Knight
b5adf1eb37 Skip compiling the FileOps::toUnixPermissions() helper method on Win32 2011-08-22 15:52:06 +01:00
Robert Knight
48c6a7d5d1 Avoid trying to link against the pthreads library when building on Win32 2011-08-22 15:51:50 +01:00
Robert Knight
fc6101a9ec Add ProcessUtils::runSync() stub for Windows and fix compilation of waitForProcess() 2011-08-22 15:51:15 +01:00
Robert Knight
9530256732 Get Log and UpdaterOptions classes compiling under Win32 2011-08-22 15:50:39 +01:00
Robert Knight
f4c6f1c1d7 Dir iterator implementation for Win32 - Untested 2011-08-22 15:50:15 +01:00
Robert Knight
28b9d50f0a Update the TODO file after Mac testing and make a note that elevation on Mac only works when running the app directly on the Mac (as opposed to over an SSH session). 2011-08-22 14:55:31 +01:00
Robert Knight
8149afd091 Implement ProcessUtils::currentProcessPath() on Mac
This allows the basic updater unit test to pass.
2011-08-22 14:44:16 +01:00
Robert Knight
4d7ddc91d9 Merge branch 'master' of ssh://gitweb/git/desktop/standalone-updater 2011-08-22 14:39:17 +01:00
Robert Knight
07ed391080 Fix incorrect buffer size calculation in ProcessUtils::runAsyncUnix()
The buffer needs one entry for the executable path, args.size()
  args for the supplied arguments and one further entry for the null
  terminator.
2011-08-22 14:37:39 +01:00
Robert Knight
9516887d48 Fix ProcessUtils compilation on Mac
* Enable the Security framework
 * Fix variable names in ProcessUtils::runElevatedMac()
2011-08-22 14:20:26 +01:00
Robert Knight
4bcf379839 Fix minizip library compilation under OS X
Set the USE_FILE32API flag on Mac since fopen64()
and several related calls do not exist on that platform which
uses 64bit I/O in the standard file methods.

See http://stackoverflow.com/questions/4003479/how-to-enable-large-file-support-under-darwin
for details.
2011-08-22 14:19:07 +01:00
Robert Knight
ced6b097b4 Remove unnecessary <malloc.h> include which is not found on Mac 2011-08-22 14:02:28 +01:00
Robert Knight
5360d05867 Remove dependency on Boost::Thread and use the TinyThread library instead.
This saves the need to install Boost::Thread on each of the build systems.
2011-08-22 14:00:00 +01:00
Robert Knight
d295b0323c Add support for the old-format updater command-line syntax.
The old syntax uses a series of Key=Value pairs, instead of
the more standard "--key value" syntax.

This is required so that the old Mendeley Desktop versions can
launch the new updater.
2011-08-22 12:59:08 +01:00
Robert Knight
a280b5d3d1 Support parsing update scripts structured for backwards compatibility with Mendeley Desktop clients <= 1.0
* Support XML scripts where the V3 script is wrapped in an <update-v3> element.
 * Add some basic unit testing facilities - if we find that something more sophisticated is needed,
   we can look at using cppunit, googletest or similar.
 * Add a test that parsing the same script with both the old and the new structure
   yields equivalent UpdateScript instances.
2011-08-22 12:06:48 +01:00
Robert Knight
c1a5cce3da Convert Qt permission flags (from QFile::Permissions) to Unix mode_t flags.
This fixes the permissions set on files by the updater.
2011-08-22 10:01:25 +01:00
Robert Knight
2f7a131cb4 Add task to start the installed application once the update install is complete to the TODO list 2011-08-22 00:41:58 +01:00
Robert Knight
f7f6eddbbe Add note about need to implement setting of file permissions under Unix and Windows 2011-08-22 00:36:08 +01:00
Robert Knight
9a0bee0358 Implement elevation under Linux using one of kdesudo, gksudo or gksu
* Add FileOps::fileName() to get the base name for a file
 * Add ProcessUtils::runSync() to run a process, wait for it to exit and then
   return the status code from that process.
 * Change ProcessUtils::runAsyncUnix() to use execvp() in order to search PATH
   for the specified binary if the filename is not absolute.
2011-08-22 00:32:33 +01:00
Robert Knight
012813fa13 Add TODO file listing remaining tasks to do before the standalone updater can be used to replace the existing system. 2011-08-21 23:54:34 +01:00
Robert Knight
8773a7a622 Fix file uninstallation and add a test
Prepend the install directory to the file path specified in the
<uninstall> section of the XML file to get the path of the file
to remove.

If the file cannot be uninstalled because it does not exist,
log a warning and continue.
2011-08-21 23:41:57 +01:00
Robert Knight
dc303201fa Avoid checking for existence of package when installing symlinks
Only check for the existence of the package for regular files
2011-08-21 23:31:54 +01:00
Robert Knight
be8d6cbc87 Remove temporary updater files after update installation completes.
The cleanup is currently run in another process - on Windows for this to
work the updater will need to be run from outside the temporary installation
directory.  Running the cleanup from the updater binary in the temporary
directory will fail since the binary to be removed will then be in use.

On Linux, Mac the cleanup could just be run from the main update installation
process.
2011-08-21 23:05:25 +01:00
Robert Knight
7c7428a4af Log process ID of child processes launched by ProcessUtils::runAsync() 2011-08-21 23:03:49 +01:00
Robert Knight
1ce064a686 Fix update installer being run twice in each process. 2011-08-21 23:02:59 +01:00
Robert Knight
93274ed348 Use fstream to open and write to log file and include process ID in log entries. 2011-08-21 22:56:33 +01:00
Robert Knight
e4a427b9e2 Improve the description of the tool in the README file 2011-08-21 22:27:10 +01:00
Robert Knight
214814dbbc Add a basic test of the updater for the non-elevated case under Linux
This test compiles two 'versions' of an application,
then runs a script which creates an install directory containing
the 'old' app and a directory containing a file_list.xml update script,
a copy of the updater and a zip file containing the 'new' app.
The script then runs the updater, then runs the installed app
and checks that it is the new version.
2011-08-21 22:07:46 +01:00
Robert Knight
1fdec35cdd Log details of the arguments to each updater process invocation in main() 2011-08-21 21:54:35 +01:00
Robert Knight
5f3745351f Get launching of the main update installer process working in the case where elevation is not required.
* Add ProcessUtils::currentProcessPath() to get the path to the current application
   and add a Linux implementation.
 * Implement ProcessUtils::runAsync() on Unix using fork/execve.
 * Setup updater to run the main installation phase with the correct arguments.
 * Add '.zip' to the package name to get the path of the package file.
2011-08-21 21:51:29 +01:00
Robert Knight
55ebb233cb Add FileOps method to get the canonical path for a file and the Unix implementation. 2011-08-21 21:50:20 +01:00
Robert Knight
b49332eaab Add a log entry if an unrecognized updater mode string is encountered. 2011-08-21 21:49:51 +01:00
Robert Knight
2e285f11a8 Add methods to UpdateScript to retrieve the path which the script was parsed from 2011-08-21 21:48:13 +01:00
Robert Knight
3548f36e8c Add entry type information at the start of each log file entry. 2011-08-21 21:47:33 +01:00
Robert Knight
2efb4fcaf3 Use boost threads to run the update installation on a background thread. 2011-08-20 12:52:47 +01:00
Robert Knight
8e47110231 Add code to launch applications with elevated priviledges on Mac from the old updater. 2011-08-20 12:52:22 +01:00
Robert Knight
44c1937d96 Implement temp package directory removal on Unix. Untested. 2011-08-20 12:11:05 +01:00