update/updatez.c
changeset 61 31fb35727621
parent 60 772ff096a326
child 62 5c3ef7363959
     1.1 --- a/update/updatez.c	Fri Jul 08 08:33:44 2016 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,82 +0,0 @@
     1.4 -/*
     1.5 - * Copyright (C) 2009, 2011, 2016  J. Ali Harlow <ali@juiblex.co.uk>
     1.6 - *
     1.7 - * This program is free software; you can redistribute it and/or modify
     1.8 - * it under the terms of the GNU General Public License as published by
     1.9 - * the Free Software Foundation; either version 2 of the License, or
    1.10 - * (at your option) any later version.
    1.11 - *
    1.12 - * This program is distributed in the hope that it will be useful,
    1.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.15 - * GNU General Public License for more details.
    1.16 - *
    1.17 - * You should have received a copy of the GNU General Public License along
    1.18 - * with this program; if not, write to the Free Software Foundation, Inc.,
    1.19 - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
    1.20 - */
    1.21 -
    1.22 -#include <stdlib.h>
    1.23 -#include <stdio.h>
    1.24 -#include <lua.h>
    1.25 -#include "config.h"
    1.26 -#include "plover/plover.h"
    1.27 -#include "whelk/whelk.h"
    1.28 -
    1.29 -LUALIB_API int luaopen_posix(lua_State *L);
    1.30 -
    1.31 -void update_from_executable_zip(const char *argv0)
    1.32 -{
    1.33 -    char *uri;
    1.34 -    gchar *s,*prefix;
    1.35 -    int ch;
    1.36 -    struct comps *comps;
    1.37 -    GError *error=NULL;
    1.38 -    s=plover_get_program(argv0);
    1.39 -    uri=g_strconcat("file:",s,NULL);
    1.40 -    g_free(s);
    1.41 -    s=g_strconcat(uri,"/repodata/comps.xml",NULL);
    1.42 -    comps=plover_comps_new_from_uri(s);
    1.43 -    if (!comps)
    1.44 -    {
    1.45 -	perror(s);
    1.46 -	exit(1);
    1.47 -    }
    1.48 -    g_free(s);
    1.49 -    prefix=plover_default_prefix_for_vendor(comps->vendor);
    1.50 -    if (!plover_installed_files_match_prefix(prefix))
    1.51 -    {
    1.52 -	printf("The existing installation is not under %s\n"
    1.53 -	  "In order to continue, all the existing packages must be removed.\n"
    1.54 -	  "Do you want to remove all existing packages? ",prefix);
    1.55 -	ch=getchar();
    1.56 -	if (ch!='y' && ch!='Y' && ch!=EOF && ch!='\n')
    1.57 -	    exit(1);
    1.58 -	while(ch!='\n' && ch!=EOF)
    1.59 -	    ch=getchar();
    1.60 -	if (plover_remove(NULL,&error))
    1.61 -	{
    1.62 -	    fprintf(stderr,"%s\n",error->message);
    1.63 -	    g_error_free(error);
    1.64 -	    exit(1);
    1.65 -	}
    1.66 -    }
    1.67 -    plover_comps_free(comps);
    1.68 -    if (!plover_update_uri(uri,prefix,NULL,&error))
    1.69 -    {
    1.70 -	fprintf(stderr,"%s\n",error->message);
    1.71 -	g_error_free(error);
    1.72 -	exit(1);
    1.73 -    }
    1.74 -    g_free(prefix);
    1.75 -    free(uri);
    1.76 -}
    1.77 -
    1.78 -int main(int argc,char **argv)
    1.79 -{
    1.80 -    plover_exception_handler_init();
    1.81 -    razor_set_lua_loader("posix",(void (*)())luaopen_posix);
    1.82 -    razor_set_lua_loader("whelk",(void (*)())luaopen_whelk);
    1.83 -    update_from_executable_zip(argv[0]);
    1.84 -    exit(0);
    1.85 -}