2 * Copyright (C) 2009, 2011, 2016 J. Ali Harlow <ali@juiblex.co.uk>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include "plover/plover.h"
24 #include "whelk/whelk.h"
26 LUALIB_API int luaopen_posix(lua_State *L);
28 void update_from_executable_zip(const char *argv0)
35 s=plover_get_program(argv0);
36 uri=g_strconcat("file:",s,NULL);
38 s=g_strconcat(uri,"/repodata/comps.xml",NULL);
39 comps=plover_comps_new_from_uri(s);
46 prefix=plover_default_prefix_for_vendor(comps->vendor);
47 if (!plover_installed_files_match_prefix(prefix))
49 printf("The existing installation is not under %s\n"
50 "In order to continue, all the existing packages must be removed.\n"
51 "Do you want to remove all existing packages? ",prefix);
53 if (ch!='y' && ch!='Y' && ch!=EOF && ch!='\n')
55 while(ch!='\n' && ch!=EOF)
57 if (plover_remove(NULL,&error))
59 fprintf(stderr,"%s\n",error->message);
64 plover_comps_free(comps);
65 if (!plover_update_uri(uri,prefix,NULL,&error))
67 fprintf(stderr,"%s\n",error->message);
75 int main(int argc,char **argv)
77 plover_exception_handler_init();
78 razor_set_lua_loader("posix",(void (*)())luaopen_posix);
79 razor_set_lua_loader("whelk",(void (*)())luaopen_whelk);
80 update_from_executable_zip(argv[0]);