# HG changeset patch # User J. Ali Harlow # Date 1467914634 -3600 # Node ID 4b52e95a01042930d54026e6cbd2d702cae8fa84 # Parent e0f448fb54a5d1e9b971eea719fd72c0f6b00c99 First steps towards adding updatez diff -r e0f448fb54a5 -r 4b52e95a0104 configure.ac --- a/configure.ac Fri Jul 08 07:50:42 2016 +0100 +++ b/configure.ac Thu Jul 07 19:03:54 2016 +0100 @@ -15,7 +15,8 @@ setup/Makefile setup/resources.rc update/Makefile -update/resources.rc +update/update-res.rc +update/updatez-res.rc pre-inst/Makefile pre-inst/resources.rc app-manager/Makefile @@ -27,7 +28,8 @@ tests/plover-gtk/Makefile ]) PLOVER_MSWIN_MANIFEST([setup/setup.exe.manifest:setup/manifest.xml.in -update/update.exe.manifest:update/manifest.xml.in +update/update.exe.manifest:update/update.manifest.in +update/updatez.exe.manifest:update/updatez.manifest.in pre-inst/pre-inst.exe.manifest:pre-inst/manifest.xml.in app-manager/app-manager.exe.manifest:app-manager/manifest.xml.in plover-open/plover-open.exe.manifest:plover-open/manifest.xml.in diff -r e0f448fb54a5 -r 4b52e95a0104 update/Makefile.am --- a/update/Makefile.am Fri Jul 08 07:50:42 2016 +0100 +++ b/update/Makefile.am Thu Jul 07 19:03:54 2016 +0100 @@ -3,20 +3,28 @@ INCLUDES=-I$(top_srcdir) CCLD = $(CXX) -bin_PROGRAMS=update +bin_PROGRAMS=update updatez bin_SCRIPTS=update.js update_SOURCES=update.c update_LDFLAGS=-all-static update_LIBTOOLFLAGS=--tag=CXX if HAVE_WINDRES -update_SOURCES+=resources.rc update.exe.manifest +update_SOURCES+=update-res.rc update.exe.manifest +endif + +updatez_SOURCES=updatez.c +updatez_LDFLAGS=-all-static +updatez_LIBTOOLFLAGS=--tag=CXX +if HAVE_WINDRES +updatez_SOURCES+=updatez-res.rc updatez.exe.manifest endif .rc.$(OBJEXT): - $(AM_V_GEN)$(WINDRES) resources.rc $@ + $(AM_V_GEN)$(WINDRES) $< $@ -resources.$(OBJEXT): resources.rc update.exe.manifest update.ico +update-res.$(OBJEXT): update-res.rc update.exe.manifest update.ico +updatez-res.$(OBJEXT): updatez-res.rc updatez.exe.manifest update.ico %.js: $(srcdir)/%.js.in $(AM_V_GEN)sed -e 's/$$/\r/' $(srcdir)/$@.in > $@ diff -r e0f448fb54a5 -r 4b52e95a0104 update/manifest.xml.in --- a/update/manifest.xml.in Fri Jul 08 07:50:42 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -changequote([,])dnl - - - - Plover update program - - - - - - - - - - - - - - diff -r e0f448fb54a5 -r 4b52e95a0104 update/resources.rc.in --- a/update/resources.rc.in Fri Jul 08 07:50:42 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -#include -#include - -#pragma code_page(65001) - -MAINICON ICON "update.ico" - -VS_VERSION_INFO VERSIONINFO - FILEVERSION @PLOVER_MAJOR_VERSION@,@PLOVER_MINOR_VERSION@, - @PLOVER_MICRO_VERSION@,0 - PRODUCTVERSION @PLOVER_MAJOR_VERSION@,@PLOVER_MINOR_VERSION@, - @PLOVER_MICRO_VERSION@,0 - FILEOS VOS__WINDOWS32 - FILETYPE VFT_APP - { - BLOCK "StringFileInfo" - { - BLOCK "080904B0" - { - VALUE "CompanyName","The plover development team" - VALUE "FileDescription","Plover update program" - VALUE "FileVersion","@PACKAGE_VERSION@" - VALUE "InternalName","update" - VALUE "LegalCopyright", - "Copyright © 2009,2011,2012 J. Ali Harlow et al" - VALUE "OriginalFilename","update.exe" - VALUE "ProductName","plover" - VALUE "ProductVersion","@PACKAGE_VERSION@" - } - } - BLOCK "VarFileInfo" - { - VALUE "Translation",0x809,0x4B0 - } - } - -CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "update.exe.manifest" diff -r e0f448fb54a5 -r 4b52e95a0104 update/update-res.rc.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/update/update-res.rc.in Thu Jul 07 19:03:54 2016 +0100 @@ -0,0 +1,37 @@ +#include +#include + +#pragma code_page(65001) + +MAINICON ICON "update.ico" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION @PLOVER_MAJOR_VERSION@,@PLOVER_MINOR_VERSION@, + @PLOVER_MICRO_VERSION@,0 + PRODUCTVERSION @PLOVER_MAJOR_VERSION@,@PLOVER_MINOR_VERSION@, + @PLOVER_MICRO_VERSION@,0 + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + { + BLOCK "StringFileInfo" + { + BLOCK "080904B0" + { + VALUE "CompanyName","The plover development team" + VALUE "FileDescription","Plover update program" + VALUE "FileVersion","@PACKAGE_VERSION@" + VALUE "InternalName","update" + VALUE "LegalCopyright", + "Copyright © 2009,2011,2012 J. Ali Harlow et al" + VALUE "OriginalFilename","update.exe" + VALUE "ProductName","plover" + VALUE "ProductVersion","@PACKAGE_VERSION@" + } + } + BLOCK "VarFileInfo" + { + VALUE "Translation",0x809,0x4B0 + } + } + +CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "update.exe.manifest" diff -r e0f448fb54a5 -r 4b52e95a0104 update/update.manifest.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/update/update.manifest.in Thu Jul 07 19:03:54 2016 +0100 @@ -0,0 +1,22 @@ +changequote([,])dnl + + + + Plover update program + + + + + + + + + + + + + + diff -r e0f448fb54a5 -r 4b52e95a0104 update/updatez-res.rc.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/update/updatez-res.rc.in Thu Jul 07 19:03:54 2016 +0100 @@ -0,0 +1,37 @@ +#include +#include + +#pragma code_page(65001) + +MAINICON ICON "update.ico" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION @PLOVER_MAJOR_VERSION@,@PLOVER_MINOR_VERSION@, + @PLOVER_MICRO_VERSION@,0 + PRODUCTVERSION @PLOVER_MAJOR_VERSION@,@PLOVER_MINOR_VERSION@, + @PLOVER_MICRO_VERSION@,0 + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + { + BLOCK "StringFileInfo" + { + BLOCK "080904B0" + { + VALUE "CompanyName","The plover development team" + VALUE "FileDescription","Plover update program" + VALUE "FileVersion","@PACKAGE_VERSION@" + VALUE "InternalName","updatez" + VALUE "LegalCopyright", + "Copyright © 2009,2011,2012 J. Ali Harlow et al" + VALUE "OriginalFilename","updatez.exe" + VALUE "ProductName","plover" + VALUE "ProductVersion","@PACKAGE_VERSION@" + } + } + BLOCK "VarFileInfo" + { + VALUE "Translation",0x809,0x4B0 + } + } + +CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "updatez.exe.manifest" diff -r e0f448fb54a5 -r 4b52e95a0104 update/updatez.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/update/updatez.c Thu Jul 07 19:03:54 2016 +0100 @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2009, 2011 J. Ali Harlow + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include +#include +#include +#include "config.h" +#include "plover/plover.h" +#include "whelk/whelk.h" + +LUALIB_API int luaopen_posix(lua_State *L); + +void update(const char *argv0) +{ + char *path; + gchar *s,*prefix; + int ch; + struct comps *comps; + GError *error=NULL; + path=plover_get_program_directory(argv0); + s=g_strconcat(path,"/repodata/comps.xml",NULL); + comps=plover_comps_new_from_file(s); + if (!comps) + { + perror(s); + exit(1); + } + g_free(s); + prefix=plover_default_prefix_for_vendor(comps->vendor); + if (!plover_installed_files_match_prefix(prefix)) + { + printf("The existing installation is not under %s\n" + "In order to continue, all the existing packages must be removed.\n" + "Do you want to remove all existing packages? ",prefix); + ch=getchar(); + if (ch!='y' && ch!='Y' && ch!=EOF && ch!='\n') + exit(1); + while(ch!='\n' && ch!=EOF) + ch=getchar(); + if (plover_remove(NULL,&error)) + { + fprintf(stderr,"%s\n",error->message); + g_error_free(error); + exit(1); + } + } + plover_comps_free(comps); + if (!plover_update(path,prefix,NULL,&error)) + { + fprintf(stderr,"%s\n",error->message); + g_error_free(error); + exit(1); + } + g_free(prefix); + free(path); +} + +int main(int argc,char **argv) +{ + plover_exception_handler_init(); + razor_set_lua_loader("posix",(void (*)())luaopen_posix); + razor_set_lua_loader("whelk",(void (*)())luaopen_whelk); + update(argv[0]); + exit(0); +} diff -r e0f448fb54a5 -r 4b52e95a0104 update/updatez.manifest.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/update/updatez.manifest.in Thu Jul 07 19:03:54 2016 +0100 @@ -0,0 +1,22 @@ +changequote([,])dnl + + + + Plover update program + + + + + + + + + + + + + +