First steps towards adding updatez
authorJ. Ali Harlow <ali@juiblex.co.uk>
Thu Jul 07 19:03:54 2016 +0100 (2016-07-07)
changeset 584b52e95a0104
parent 57 e0f448fb54a5
child 59 296eac3183bc
First steps towards adding updatez
configure.ac
update/Makefile.am
update/manifest.xml.in
update/resources.rc.in
update/update-res.rc.in
update/update.manifest.in
update/updatez-res.rc.in
update/updatez.c
update/updatez.manifest.in
     1.1 --- a/configure.ac	Fri Jul 08 07:50:42 2016 +0100
     1.2 +++ b/configure.ac	Thu Jul 07 19:03:54 2016 +0100
     1.3 @@ -15,7 +15,8 @@
     1.4  setup/Makefile
     1.5  setup/resources.rc
     1.6  update/Makefile
     1.7 -update/resources.rc
     1.8 +update/update-res.rc
     1.9 +update/updatez-res.rc
    1.10  pre-inst/Makefile
    1.11  pre-inst/resources.rc
    1.12  app-manager/Makefile
    1.13 @@ -27,7 +28,8 @@
    1.14  tests/plover-gtk/Makefile
    1.15  ])
    1.16  PLOVER_MSWIN_MANIFEST([setup/setup.exe.manifest:setup/manifest.xml.in
    1.17 -update/update.exe.manifest:update/manifest.xml.in
    1.18 +update/update.exe.manifest:update/update.manifest.in
    1.19 +update/updatez.exe.manifest:update/updatez.manifest.in
    1.20  pre-inst/pre-inst.exe.manifest:pre-inst/manifest.xml.in
    1.21  app-manager/app-manager.exe.manifest:app-manager/manifest.xml.in
    1.22  plover-open/plover-open.exe.manifest:plover-open/manifest.xml.in
     2.1 --- a/update/Makefile.am	Fri Jul 08 07:50:42 2016 +0100
     2.2 +++ b/update/Makefile.am	Thu Jul 07 19:03:54 2016 +0100
     2.3 @@ -3,20 +3,28 @@
     2.4  INCLUDES=-I$(top_srcdir)
     2.5  CCLD = $(CXX)
     2.6  
     2.7 -bin_PROGRAMS=update
     2.8 +bin_PROGRAMS=update updatez
     2.9  bin_SCRIPTS=update.js
    2.10  
    2.11  update_SOURCES=update.c
    2.12  update_LDFLAGS=-all-static
    2.13  update_LIBTOOLFLAGS=--tag=CXX
    2.14  if HAVE_WINDRES
    2.15 -update_SOURCES+=resources.rc update.exe.manifest
    2.16 +update_SOURCES+=update-res.rc update.exe.manifest
    2.17 +endif
    2.18 +
    2.19 +updatez_SOURCES=updatez.c
    2.20 +updatez_LDFLAGS=-all-static
    2.21 +updatez_LIBTOOLFLAGS=--tag=CXX
    2.22 +if HAVE_WINDRES
    2.23 +updatez_SOURCES+=updatez-res.rc updatez.exe.manifest
    2.24  endif
    2.25  
    2.26  .rc.$(OBJEXT):
    2.27 -	$(AM_V_GEN)$(WINDRES) resources.rc $@
    2.28 +	$(AM_V_GEN)$(WINDRES) $< $@
    2.29  
    2.30 -resources.$(OBJEXT): resources.rc update.exe.manifest update.ico
    2.31 +update-res.$(OBJEXT): update-res.rc update.exe.manifest update.ico
    2.32 +updatez-res.$(OBJEXT): updatez-res.rc updatez.exe.manifest update.ico
    2.33  
    2.34  %.js: $(srcdir)/%.js.in
    2.35  	$(AM_V_GEN)sed -e 's/$$/\r/' $(srcdir)/$@.in > $@
     3.1 --- a/update/manifest.xml.in	Fri Jul 08 07:50:42 2016 +0100
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,22 +0,0 @@
     3.4 -changequote([,])dnl
     3.5 -<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
     3.6 -<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
     3.7 -  <assemblyIdentity
     3.8 -    version="@PLOVER_MAJOR_VERSION@.@PLOVER_MINOR_VERSION@.@PLOVER_MICRO_VERSION@.0"
     3.9 -    name="The plover development team.plover.update" type="win32"
    3.10 -    processorArchitecture="ifelse([@HOST_CPU@],[x86_64],[ia64],[x86])" />
    3.11 -  <description>Plover update program</description>
    3.12 -  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    3.13 -    <application>
    3.14 -      <!-- Windows 7 functionality -->
    3.15 -      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
    3.16 -    </application>
    3.17 -  </compatibility>
    3.18 -  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    3.19 -    <security>
    3.20 -      <requestedPrivileges>
    3.21 -        <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
    3.22 -      </requestedPrivileges>
    3.23 -    </security>
    3.24 -  </trustInfo>
    3.25 -</assembly>
     4.1 --- a/update/resources.rc.in	Fri Jul 08 07:50:42 2016 +0100
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,37 +0,0 @@
     4.4 -#include <winver.h>
     4.5 -#include <winuser.h>
     4.6 -
     4.7 -#pragma code_page(65001)
     4.8 -
     4.9 -MAINICON ICON "update.ico"
    4.10 -
    4.11 -VS_VERSION_INFO VERSIONINFO
    4.12 -    FILEVERSION @PLOVER_MAJOR_VERSION@,@PLOVER_MINOR_VERSION@,
    4.13 -      @PLOVER_MICRO_VERSION@,0
    4.14 -    PRODUCTVERSION @PLOVER_MAJOR_VERSION@,@PLOVER_MINOR_VERSION@,
    4.15 -      @PLOVER_MICRO_VERSION@,0
    4.16 -    FILEOS VOS__WINDOWS32
    4.17 -    FILETYPE VFT_APP
    4.18 -    {
    4.19 -	BLOCK "StringFileInfo"
    4.20 -	{
    4.21 -	    BLOCK "080904B0"
    4.22 -	    {
    4.23 -		VALUE "CompanyName","The plover development team"
    4.24 -		VALUE "FileDescription","Plover update program"
    4.25 -		VALUE "FileVersion","@PACKAGE_VERSION@"
    4.26 -		VALUE "InternalName","update"
    4.27 -		VALUE "LegalCopyright",
    4.28 -		  "Copyright © 2009,2011,2012 J. Ali Harlow et al"
    4.29 -		VALUE "OriginalFilename","update.exe"
    4.30 -		VALUE "ProductName","plover"
    4.31 -		VALUE "ProductVersion","@PACKAGE_VERSION@"
    4.32 -	    }
    4.33 -	}
    4.34 -	BLOCK "VarFileInfo"
    4.35 -	{
    4.36 -	    VALUE "Translation",0x809,0x4B0
    4.37 -	}
    4.38 -    }
    4.39 -
    4.40 -CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "update.exe.manifest"
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/update/update-res.rc.in	Thu Jul 07 19:03:54 2016 +0100
     5.3 @@ -0,0 +1,37 @@
     5.4 +#include <winver.h>
     5.5 +#include <winuser.h>
     5.6 +
     5.7 +#pragma code_page(65001)
     5.8 +
     5.9 +MAINICON ICON "update.ico"
    5.10 +
    5.11 +VS_VERSION_INFO VERSIONINFO
    5.12 +    FILEVERSION @PLOVER_MAJOR_VERSION@,@PLOVER_MINOR_VERSION@,
    5.13 +      @PLOVER_MICRO_VERSION@,0
    5.14 +    PRODUCTVERSION @PLOVER_MAJOR_VERSION@,@PLOVER_MINOR_VERSION@,
    5.15 +      @PLOVER_MICRO_VERSION@,0
    5.16 +    FILEOS VOS__WINDOWS32
    5.17 +    FILETYPE VFT_APP
    5.18 +    {
    5.19 +	BLOCK "StringFileInfo"
    5.20 +	{
    5.21 +	    BLOCK "080904B0"
    5.22 +	    {
    5.23 +		VALUE "CompanyName","The plover development team"
    5.24 +		VALUE "FileDescription","Plover update program"
    5.25 +		VALUE "FileVersion","@PACKAGE_VERSION@"
    5.26 +		VALUE "InternalName","update"
    5.27 +		VALUE "LegalCopyright",
    5.28 +		  "Copyright © 2009,2011,2012 J. Ali Harlow et al"
    5.29 +		VALUE "OriginalFilename","update.exe"
    5.30 +		VALUE "ProductName","plover"
    5.31 +		VALUE "ProductVersion","@PACKAGE_VERSION@"
    5.32 +	    }
    5.33 +	}
    5.34 +	BLOCK "VarFileInfo"
    5.35 +	{
    5.36 +	    VALUE "Translation",0x809,0x4B0
    5.37 +	}
    5.38 +    }
    5.39 +
    5.40 +CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "update.exe.manifest"
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/update/update.manifest.in	Thu Jul 07 19:03:54 2016 +0100
     6.3 @@ -0,0 +1,22 @@
     6.4 +changequote([,])dnl
     6.5 +<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
     6.6 +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
     6.7 +  <assemblyIdentity
     6.8 +    version="@PLOVER_MAJOR_VERSION@.@PLOVER_MINOR_VERSION@.@PLOVER_MICRO_VERSION@.0"
     6.9 +    name="The plover development team.plover.update" type="win32"
    6.10 +    processorArchitecture="ifelse([@HOST_CPU@],[x86_64],[ia64],[x86])" />
    6.11 +  <description>Plover update program</description>
    6.12 +  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    6.13 +    <application>
    6.14 +      <!-- Windows 7 functionality -->
    6.15 +      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
    6.16 +    </application>
    6.17 +  </compatibility>
    6.18 +  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    6.19 +    <security>
    6.20 +      <requestedPrivileges>
    6.21 +        <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
    6.22 +      </requestedPrivileges>
    6.23 +    </security>
    6.24 +  </trustInfo>
    6.25 +</assembly>
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/update/updatez-res.rc.in	Thu Jul 07 19:03:54 2016 +0100
     7.3 @@ -0,0 +1,37 @@
     7.4 +#include <winver.h>
     7.5 +#include <winuser.h>
     7.6 +
     7.7 +#pragma code_page(65001)
     7.8 +
     7.9 +MAINICON ICON "update.ico"
    7.10 +
    7.11 +VS_VERSION_INFO VERSIONINFO
    7.12 +    FILEVERSION @PLOVER_MAJOR_VERSION@,@PLOVER_MINOR_VERSION@,
    7.13 +      @PLOVER_MICRO_VERSION@,0
    7.14 +    PRODUCTVERSION @PLOVER_MAJOR_VERSION@,@PLOVER_MINOR_VERSION@,
    7.15 +      @PLOVER_MICRO_VERSION@,0
    7.16 +    FILEOS VOS__WINDOWS32
    7.17 +    FILETYPE VFT_APP
    7.18 +    {
    7.19 +	BLOCK "StringFileInfo"
    7.20 +	{
    7.21 +	    BLOCK "080904B0"
    7.22 +	    {
    7.23 +		VALUE "CompanyName","The plover development team"
    7.24 +		VALUE "FileDescription","Plover update program"
    7.25 +		VALUE "FileVersion","@PACKAGE_VERSION@"
    7.26 +		VALUE "InternalName","updatez"
    7.27 +		VALUE "LegalCopyright",
    7.28 +		  "Copyright © 2009,2011,2012 J. Ali Harlow et al"
    7.29 +		VALUE "OriginalFilename","updatez.exe"
    7.30 +		VALUE "ProductName","plover"
    7.31 +		VALUE "ProductVersion","@PACKAGE_VERSION@"
    7.32 +	    }
    7.33 +	}
    7.34 +	BLOCK "VarFileInfo"
    7.35 +	{
    7.36 +	    VALUE "Translation",0x809,0x4B0
    7.37 +	}
    7.38 +    }
    7.39 +
    7.40 +CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "updatez.exe.manifest"
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/update/updatez.c	Thu Jul 07 19:03:54 2016 +0100
     8.3 @@ -0,0 +1,80 @@
     8.4 +/*
     8.5 + * Copyright (C) 2009, 2011  J. Ali Harlow <ali@juiblex.co.uk>
     8.6 + *
     8.7 + * This program is free software; you can redistribute it and/or modify
     8.8 + * it under the terms of the GNU General Public License as published by
     8.9 + * the Free Software Foundation; either version 2 of the License, or
    8.10 + * (at your option) any later version.
    8.11 + *
    8.12 + * This program is distributed in the hope that it will be useful,
    8.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8.15 + * GNU General Public License for more details.
    8.16 + *
    8.17 + * You should have received a copy of the GNU General Public License along
    8.18 + * with this program; if not, write to the Free Software Foundation, Inc.,
    8.19 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
    8.20 + */
    8.21 +
    8.22 +#include <stdlib.h>
    8.23 +#include <stdio.h>
    8.24 +#include <lua.h>
    8.25 +#include "config.h"
    8.26 +#include "plover/plover.h"
    8.27 +#include "whelk/whelk.h"
    8.28 +
    8.29 +LUALIB_API int luaopen_posix(lua_State *L);
    8.30 +
    8.31 +void update(const char *argv0)
    8.32 +{
    8.33 +    char *path;
    8.34 +    gchar *s,*prefix;
    8.35 +    int ch;
    8.36 +    struct comps *comps;
    8.37 +    GError *error=NULL;
    8.38 +    path=plover_get_program_directory(argv0);
    8.39 +    s=g_strconcat(path,"/repodata/comps.xml",NULL);
    8.40 +    comps=plover_comps_new_from_file(s);
    8.41 +    if (!comps)
    8.42 +    {
    8.43 +	perror(s);
    8.44 +	exit(1);
    8.45 +    }
    8.46 +    g_free(s);
    8.47 +    prefix=plover_default_prefix_for_vendor(comps->vendor);
    8.48 +    if (!plover_installed_files_match_prefix(prefix))
    8.49 +    {
    8.50 +	printf("The existing installation is not under %s\n"
    8.51 +	  "In order to continue, all the existing packages must be removed.\n"
    8.52 +	  "Do you want to remove all existing packages? ",prefix);
    8.53 +	ch=getchar();
    8.54 +	if (ch!='y' && ch!='Y' && ch!=EOF && ch!='\n')
    8.55 +	    exit(1);
    8.56 +	while(ch!='\n' && ch!=EOF)
    8.57 +	    ch=getchar();
    8.58 +	if (plover_remove(NULL,&error))
    8.59 +	{
    8.60 +	    fprintf(stderr,"%s\n",error->message);
    8.61 +	    g_error_free(error);
    8.62 +	    exit(1);
    8.63 +	}
    8.64 +    }
    8.65 +    plover_comps_free(comps);
    8.66 +    if (!plover_update(path,prefix,NULL,&error))
    8.67 +    {
    8.68 +	fprintf(stderr,"%s\n",error->message);
    8.69 +	g_error_free(error);
    8.70 +	exit(1);
    8.71 +    }
    8.72 +    g_free(prefix);
    8.73 +    free(path);
    8.74 +}
    8.75 +
    8.76 +int main(int argc,char **argv)
    8.77 +{
    8.78 +    plover_exception_handler_init();
    8.79 +    razor_set_lua_loader("posix",(void (*)())luaopen_posix);
    8.80 +    razor_set_lua_loader("whelk",(void (*)())luaopen_whelk);
    8.81 +    update(argv[0]);
    8.82 +    exit(0);
    8.83 +}
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/update/updatez.manifest.in	Thu Jul 07 19:03:54 2016 +0100
     9.3 @@ -0,0 +1,22 @@
     9.4 +changequote([,])dnl
     9.5 +<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
     9.6 +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
     9.7 +  <assemblyIdentity
     9.8 +    version="@PLOVER_MAJOR_VERSION@.@PLOVER_MINOR_VERSION@.@PLOVER_MICRO_VERSION@.0"
     9.9 +    name="The plover development team.plover.updatez" type="win32"
    9.10 +    processorArchitecture="ifelse([@HOST_CPU@],[x86_64],[ia64],[x86])" />
    9.11 +  <description>Plover update program</description>
    9.12 +  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    9.13 +    <application>
    9.14 +      <!-- Windows 7 functionality -->
    9.15 +      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
    9.16 +    </application>
    9.17 +  </compatibility>
    9.18 +  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    9.19 +    <security>
    9.20 +      <requestedPrivileges>
    9.21 +        <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
    9.22 +      </requestedPrivileges>
    9.23 +    </security>
    9.24 +  </trustInfo>
    9.25 +</assembly>