Support razor 0.5 (atomic transactions).
Don't create repositories with multiple roots.
Filter out "other" arches from yum repositories.
Mark win32 binaries as needing elevated privileges.
2 * Copyright (C) 2009, 2011 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.
29 #include "plover/plover.h"
30 #include "whelk/whelk.h"
32 LUALIB_API int luaopen_posix(lua_State *L);
39 struct vector *vector_new(void)
41 struct vector *vector;
42 vector=malloc(sizeof(*vector));
45 vector->strings=calloc(vector->alloc,sizeof(char *));
49 void vector_append(struct vector *vector,const char *str)
51 if (++(vector->len)>=vector->alloc)
54 vector->strings=realloc(vector->strings,vector->alloc*sizeof(char *));
56 vector->strings[vector->len-1]=strdup(str);
57 vector->strings[vector->len]=NULL;
60 int vector_contains(struct vector *vector,const char *str)
63 for(i=0;i<vector->len;i++)
64 if (!strcmp(vector->strings[i],str))
69 void vector_free(struct vector *vector)
72 for(i=0;i<vector->len;i++)
73 free(vector->strings[i]);
74 free(vector->strings);
78 void setup(const char *argv0)
80 char *path,*s,*prefix;
83 struct comps_group *group;
84 struct comps_requirement *pkg;
85 struct vector *packages=NULL;
86 path=plover_get_program_directory(argv0);
87 s=plover_strconcat(path,"/repodata/comps.xml",NULL);
88 comps=plover_comps_new_from_file(s);
95 prefix=plover_default_prefix_for_vendor(comps->vendor);
96 if (!plover_installed_files_match_prefix(prefix))
98 printf("The existing installation is not under %s\n"
99 "In order to continue, all the existing packages must be removed.\n"
100 "Do you want to remove all existing packages? ",prefix);
102 if (ch!='y' && ch!='Y' && ch!=EOF && ch!='\n')
104 while(ch!='\n' && ch!=EOF)
108 group=plover_comps_lookup_group(comps,"base");
111 fprintf(stderr,"No base group found in comps.xml\n");
114 packages=vector_new();
118 for(pkg=group->packages;pkg;pkg=pkg->next)
120 if (vector_contains(packages,pkg->name))
122 if (pkg->type==COMPS_REQUIREMENT_DEFAULT ||
123 pkg->type==COMPS_REQUIREMENT_MANDATORY ||
124 pkg->type==COMPS_REQUIREMENT_CONDITIONAL &&
125 vector_contains(packages,pkg->requires))
128 vector_append(packages,pkg->name);
132 plover_comps_free(comps);
135 fprintf(stderr,"No packages to install\n");
138 plover_install(path,prefix,packages->strings);
139 vector_free(packages);
144 int main(int argc,char **argv)
146 razor_set_lua_loader("posix",luaopen_posix);
147 razor_set_lua_loader("whelk",luaopen_whelk);
148 if (argc>1 && !strcmp(argv[1],"-u"))