2 ===================================================================
3 RCS file: /cvs/cvsroot/loki_setup/CHANGES,v
4 retrieving revision 1.77
6 --- CHANGES 2003/02/27 06:16:01 1.77
7 +++ CHANGES 2003/03/29 10:46:13
9 Stephane Peter (Codehost) - Tue Feb 11 20:33:32 PST 2003
10 * Added the 'environment' tag to store the values of
11 environment variables.
12 +TTimo (qeradiant.com) - Mon Feb 10 12:17:08 CET 2003
13 + * Added SETUP_COMPONENT_PATH env to run scripts
14 +TTimo (qeradiant.com) - Sun Jan 26 23:36:06 CET 2003
15 + * Ported over our subcomponent code
16 Stephane Peter (Codehost) - Fri Dec 6 16:31:27 PST 2002
17 * Do not display the main GTK dialog until we're done with the EULAs.
18 * Various fixes for menu items
20 ===================================================================
21 RCS file: /cvs/cvsroot/loki_setup/Makefile.in,v
22 retrieving revision 1.18
23 diff -u -r1.18 Makefile.in
24 --- Makefile.in 2003/03/26 05:45:10 1.18
25 +++ Makefile.in 2003/03/29 10:46:13
27 strip image/setup.data/bin/$(os)/$(arch)/$(libc)/setup.gtk; \
28 $(BRANDELF) -t $(os) image/setup.data/bin/$(os)/$(arch)/$(libc)/setup.gtk; \
30 - echo No directory to copy the binary files to.; \
31 + echo image/setup.data/bin/$(os)/$(arch)/$(libc): No directory to copy the binary files to.; \
36 cp setup.gtk $(IMAGE)/setup.data/bin/$(os)/$(arch)/$(libc); \
37 strip $(IMAGE)/setup.data/bin/$(os)/$(arch)/$(libc)/setup.gtk; \
39 - echo No directory to copy the binary files to.; \
40 + echo $(IMAGE)/setup.data/bin/$(os)/$(arch)/$(libc): No directory to copy the binary files to.; \
45 strip $(IMAGE)/bin/$(os)/$(arch)/check; \
46 cp check.glade $(IMAGE)/misc/; \
48 - echo No directory to copy the binary files to.; \
49 + echo $(IMAGE)/bin/$(os)/$(arch): No directory to copy the binary files to.; \
52 # Copy loki_uninstall and the required files
57 - echo No directory to copy the binary files to.; \
58 + echo $(IMAGE)/bin/$(os)/$(arch): No directory to copy the binary files to.; \
61 install-loki_uninstall: loki_uninstall
66 - echo No directory to copy the binary files to.; \
67 + echo $(IMAGE)/loki_uninstall/bin/$(arch)/$(libc): No directory to copy the binary files to.; \
69 @if [ -d $(UPDATES) ]; then \
70 rm -rf $(UPDATES)/bin-$(arch)-$(UNINSTALL_VERSION)/; \
72 ===================================================================
73 RCS file: /cvs/cvsroot/loki_setup/copy.c,v
74 retrieving revision 1.65
76 --- copy.c 2003/02/27 06:16:01 1.65
77 +++ copy.c 2003/03/29 10:46:16
82 - if ( run_script(info, buf, 0) == 0 ) {
83 + if ( run_script(info, buf, NULL, 0) == 0 ) {
84 const char *target = xmlGetProp(node, "target");
86 char targetpath[PATH_MAX];
88 if ( ! update(info, _("Running script"), 0, 0, current_option_txt) )
91 - return(run_script(info, script, -1));
92 + return(run_script(info, script, dest, -1));
95 ssize_t copy_node(install_info *info, xmlNodePtr node, const char *dest,
99 char tmppath[PATH_MAX];
100 + const char *component_dest;
106 current_component = NULL; /* Out of the component */
109 + /* Parse subcomponents */
110 + else if (!strcmp(node->name, "subcomponent")) {
111 + const char *name, *version;
113 + name = xmlGetProp(node, "name");
115 + log_fatal(_("SubComponent element must have a name"));
116 + version = xmlGetProp(node, "version");
119 + log_warning(_("SubComponent doesn't have a version"));
120 + version = strdup("noversion");
122 + child = node->childs;
125 + if(!strcmp(child->name, "option"))
127 + /* only run if it has been actually selected for install */
128 + const char *install;
129 + install = xmlGetProp(child, "install");
130 + if (install && !strcmp(install,"true"))
132 + /* add this subcomponent as a standard component */
133 + current_component = add_component_entry(info, name, version,
134 + (strcmp(xmlGetProp(child, "install"), "true") != 0) ? 0 : 1);
135 + if(xmlGetProp(child, "path"))
137 + /* if the path's been changed, use the path it was changed to */
138 + component_dest = xmlGetProp(child, "path");
142 + /* if the path hasn't been changed, install to the default path */
143 + component_dest = xmlGetProp(child, "default_path");
145 + // TODO: verify the install location ?
146 + copied = copy_node(info, child, component_dest, update);
151 + copied = copy_tree(info, child->childs, component_dest, update);
158 + child = child->next;
160 } else if ( ! strcmp(node->name, "environment") ) {
161 const char *prop = xmlGetProp(node, "var");
164 ===================================================================
165 RCS file: /cvs/cvsroot/loki_setup/gtk_ui.c,v
166 retrieving revision 1.78
167 diff -u -r1.78 gtk_ui.c
168 --- gtk_ui.c 2003/03/24 00:47:16 1.78
169 +++ gtk_ui.c 2003/03/29 10:46:20
171 static GladeXML *setup_glade = NULL;
172 static GladeXML *setup_glade_readme = NULL;
173 static GladeXML *setup_glade_license = NULL;
174 +static GladeXML *setup_glade_subcomponent = NULL;
175 static int cur_state;
176 static install_info *cur_info;
177 static int diskspace;
179 void setup_destroy_view_readme_slot(GtkWidget*, gpointer);
180 static yesno_answer gtkui_prompt(const char*, yesno_answer);
181 static void gtkui_abort(install_info *info);
182 +static int gtkui_dir_prompt (install_info *info, const char *message, char *path);
184 static int iterate_for_state(void)
186 @@ -1189,6 +1191,189 @@
190 +/*************** subcomponent *********************/
192 +void setup_button_subcomponent_browse(GtkWidget *widget, gpointer func_data)
194 + GtkWidget *entry = (GtkWidget *)func_data;
195 + xmlNodePtr node = gtk_object_get_data(GTK_OBJECT(widget), "node");
196 + char *widget_data = gtk_object_get_data(GTK_OBJECT(widget), "data");
197 + char path[PATH_MAX];
198 + strncpy(path, gtk_entry_get_text(GTK_ENTRY(entry)), PATH_MAX);
200 + gtkui_dir_prompt(cur_info, widget_data, path);
202 + if(path[strlen(path)-1] != '/')
205 + gtk_entry_set_text(GTK_ENTRY(entry), path);
207 + xmlSetProp(node, "path", path);
210 +void setup_subcomponent_toggle(GtkWidget *widget, gpointer func_data)
212 + int state = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
213 + GtkWidget *entry = gtk_object_get_data(GTK_OBJECT(widget), "entry");
214 + GtkWidget *button = gtk_object_get_data(GTK_OBJECT(widget), "button");
215 + xmlNodePtr node = gtk_object_get_data(GTK_OBJECT(widget), "node");
219 + gtk_widget_set_sensitive(GTK_WIDGET(entry), TRUE);
220 + gtk_widget_set_sensitive(GTK_WIDGET(button), TRUE);
221 + xmlSetProp(node, "install", "true");
222 + xmlSetProp(node, "path", gtk_entry_get_text(GTK_ENTRY(entry)));
226 + gtk_widget_set_sensitive(GTK_WIDGET(entry), FALSE);
227 + gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);
228 + xmlSetProp(node, "install", "false");
229 + xmlSetProp(node, "path", "");
233 +void subcomponent_update_entry(GtkWidget *widget, gpointer func_data)
235 + xmlNodePtr node = gtk_object_get_data(GTK_OBJECT(widget), "node");
236 + char *path = malloc(strlen(gtk_entry_get_text(GTK_ENTRY(widget)))+2);
237 + strcpy(path, gtk_entry_get_text(GTK_ENTRY(widget)));
239 + if (path[strlen(path)-1] != '/')
243 + xmlSetProp(node, "path", path);
246 +void setup_button_subcomponent(GtkWidget *widget, gpointer func_data)
250 + GtkWidget *window, *frame, *w, *vbox, *hbox,
251 + *check, *entry, *button, *sep;
257 + install_info *info = (install_info *)func_data;
259 + setup_glade_subcomponent = glade_xml_new(SETUP_GLADE, "subcomponent_dialog");
260 + glade_xml_signal_autoconnect(setup_glade_subcomponent);
261 + window = glade_xml_get_widget(setup_glade_subcomponent, "subcomponent_dialog");
262 + frame = glade_xml_get_widget(setup_glade_subcomponent, "subcomponent_frame");
264 + w = glade_xml_get_widget(setup_glade_subcomponent, "subcomponent_button_cancel");
265 + gtk_widget_hide(w);
267 + gtk_widget_realize(window);
268 + gtk_widget_realize(frame);
269 + gtk_container_foreach(GTK_CONTAINER(frame), empty_container, frame);
271 + w = gtk_vbox_new(TRUE, 2);
272 + gtk_container_add(GTK_CONTAINER(frame), w);
273 + gtk_widget_show(w);
275 + gtk_object_set_data(GTK_OBJECT(window), "data", w);
277 + node = info->config->root->childs;
278 + while(node != NULL && strcmp(node->name, "subcomponent"))
281 + log_fatal(_("subcomponent element not found"));
282 + child = node->childs;
283 + // subcomponent options
284 + while(child != NULL)
286 + if(!strcmp(child->name, "option"))
288 + if(!strcmp(xmlGetProp(child, "install"), "true"))
293 + vbox = gtk_vbox_new(FALSE, 2);
294 + gtk_box_pack_start(GTK_BOX(w), vbox, TRUE, FALSE, 0);
295 + gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
296 + gtk_widget_show(vbox);
300 + sep = gtk_hseparator_new();
301 + gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
302 + gtk_widget_show(sep);
305 + text = xmlNodeListGetString(info->config, child->childs, 1);
306 + parse_line(&text, name, sizeof(name));
308 + check = gtk_check_button_new_with_label(name);
309 + gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
311 + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), TRUE);
312 + gtk_signal_connect(GTK_OBJECT(check), "toggled", GTK_SIGNAL_FUNC(setup_subcomponent_toggle), NULL);
313 + gtk_object_set_data(GTK_OBJECT(check), "name", name);
314 + gtk_object_set_data(GTK_OBJECT(check), "node", child);
315 + gtk_widget_show(check);
317 + hbox = gtk_hbox_new(FALSE, 2);
318 + gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, FALSE, 0);
319 + gtk_widget_show(hbox);
321 + entry = gtk_entry_new();
322 + //gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, FALSE, 0);
323 + gtk_container_add(GTK_CONTAINER(hbox), entry);
325 + gtk_widget_set_sensitive(GTK_WIDGET(entry), FALSE);
326 + gtk_signal_connect(GTK_OBJECT(entry), "focus_out_event", GTK_SIGNAL_FUNC(subcomponent_update_entry), NULL);
327 + gtk_object_set_data(GTK_OBJECT(entry), "name", name);
328 + gtk_object_set_data(GTK_OBJECT(entry), "node", child);
329 + gtk_widget_show(entry);
331 + if(xmlGetProp(child, "path"))
333 + gtk_entry_set_text(GTK_ENTRY(entry), xmlGetProp(child, "path"));
335 + else if (xmlGetProp(child, "default_path"))
337 + gtk_entry_set_text(GTK_ENTRY(entry), xmlGetProp(child, "default_path"));
341 + button = gtk_button_new_with_label("...");
342 + gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
343 + gtk_object_set_data(GTK_OBJECT(button), "data", gtk_entry_get_text(GTK_ENTRY(entry)));
344 + gtk_object_set_data(GTK_OBJECT(button), "node", child);
345 + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(setup_button_subcomponent_browse), entry);
347 + gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);
348 + gtk_widget_show(button);
350 + gtk_object_set_data(GTK_OBJECT(check), "entry", entry);
351 + gtk_object_set_data(GTK_OBJECT(check), "button", button);
355 + child = child->next;
357 + gtk_widget_show(window);
358 + //gtk_window_set_modal(GTK_WINDOW(window), TRUE);
361 +void setup_button_subcomponent_cancel(GtkWidget *widget, gpointer func_data)
363 + GtkWidget *window = glade_xml_get_widget(setup_glade_subcomponent, "subcomponent_dialog");
364 + gtk_widget_hide(window);
367 +void setup_button_subcomponent_ok(GtkWidget *widget, gpointer func_data)
369 + GtkWidget *window = glade_xml_get_widget(setup_glade_subcomponent, "subcomponent_dialog");
370 + gtk_widget_hide(window);
373 /********** UI functions *************/
375 static install_state gtkui_init(install_info *info, int argc, char **argv, int noninteractive)
376 @@ -1496,7 +1681,13 @@
377 parse_option(info, xmlGetProp(node, "name"), child, window, options, 0, NULL, 0, NULL);
381 + } else if ( ! strcmp(node->name, "subcomponent") ) {
382 + GtkWidget *widget = gtk_button_new_with_label(xmlGetProp(node, "name"));
383 + gtk_box_pack_start(GTK_BOX(options), GTK_WIDGET(widget), FALSE, FALSE, 5);
384 + gtk_object_set_data(GTK_OBJECT(widget), "data", (gpointer)xmlGetProp(node, "name"));
385 + gtk_signal_connect(GTK_OBJECT(widget), "clicked", GTK_SIGNAL_FUNC(setup_button_subcomponent), (gpointer)info);
386 + gtk_widget_show(widget);
391 @@ -1681,6 +1872,63 @@
395 +static int dirname_loop;
396 +static int prompt_ret;
398 +void store_dirname_slot(GtkFileSelection *selector, gpointer user_data) {
400 + char *selected_dirname = (char *)user_data;
403 + parent = gtk_widget_get_toplevel (GTK_WIDGET(selector));
404 + aux = gtk_file_selection_get_filename (GTK_FILE_SELECTION (parent));
406 + strcpy(selected_dirname, aux);
411 +void abort_slot(GtkFileSelection *selector, gpointer user_data) {
416 +static int gtkui_dir_prompt (install_info *info, const char *message, char *path)
418 + GtkWidget *selector;
421 + /* Create the selector */
422 + selector = gtk_file_selection_new(message);
424 + gtk_file_selection_set_filename(GTK_FILE_SELECTION(selector), path);
425 + gtk_file_selection_hide_fileop_buttons (GTK_FILE_SELECTION(selector));
427 + gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION(selector)->ok_button),
428 + "clicked", GTK_SIGNAL_FUNC (store_dirname_slot), path);
430 + gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION(selector)->cancel_button),
431 + "clicked", GTK_SIGNAL_FUNC (abort_slot), path);
433 + /* Display that dialog */
435 + gtk_grab_add(selector);
436 + gtk_widget_show (selector);
437 + gtk_grab_remove(selector);
442 + while (dirname_loop==1)
443 + gtk_main_iteration();
445 + aux = gtk_file_selection_get_filename (GTK_FILE_SELECTION(selector));
447 + gtk_widget_destroy(selector);
452 int gtkui_okay(Install_UI *UI, int *argc, char ***argv)
454 extern int force_console;
455 @@ -1730,7 +1978,3 @@
464 ===================================================================
465 RCS file: /cvs/cvsroot/loki_setup/install.c,v
466 retrieving revision 1.102
467 diff -u -r1.102 install.c
468 --- install.c 2003/03/27 04:16:26 1.102
469 +++ install.c 2003/03/29 10:46:24
471 log_fatal(_("XML: 'require' tag doesn't have a mandatory 'command' attribute"));
473 /* Launch the command */
474 - if ( run_script(info, prop, 0) != 0 ) {
475 + if ( run_script(info, prop, NULL, 0) != 0 ) {
476 /* We failed: print out error message */
477 text = xmlNodeListGetString(info->config, node->childs, 1);
479 @@ -1139,7 +1139,7 @@
482 /* Launch the command */
483 - return run_script(info, txt, 0) == 0;
484 + return run_script(info, txt, NULL, 0) == 0;
488 @@ -1321,7 +1321,7 @@
490 if (GetPreUnInstall(info) && info->installed_bytes>0) {
491 snprintf(path, sizeof(path), "sh %s", GetPreUnInstall(info));
492 - run_script(info, path, 0);
493 + run_script(info, path, NULL, 0);
496 if ( file_exists(info->install_path) ) {
497 @@ -1338,7 +1338,7 @@
498 /* Do not run scripts if nothing was installed */
499 if ( info->installed_bytes>0 ) {
500 for ( selem = opt->pre_script_list; selem; selem = selem->next ) { /* RPM pre-uninstall */
501 - run_script(info, selem->script, 0);
502 + run_script(info, selem->script, NULL, 0);
506 @@ -1355,7 +1355,7 @@
508 if ( info->installed_bytes>0 ) {
509 for ( selem = opt->post_script_list; selem; selem = selem->next ) { /* RPM post-uninstall */
510 - run_script(info, selem->script, 0);
511 + run_script(info, selem->script, NULL, 0);
515 @@ -1373,7 +1373,7 @@
517 if (GetPostUnInstall(info) && info->installed_bytes>0) {
518 snprintf(path, sizeof(path), "sh %s", GetPostUnInstall(info));
519 - run_script(info, path, 0);
520 + run_script(info, path, NULL, 0);
523 if ( uninstall_generated ) {
524 @@ -1753,7 +1753,7 @@
525 if ( ! restoring_corrupt() ) {
526 script = GetPreInstall(info);
528 - exitval = run_script(info, script, -1);
529 + exitval = run_script(info, script, NULL, -1);
533 @@ -1766,7 +1766,7 @@
534 if ( ! restoring_corrupt() ) {
535 script = GetPostInstall(info);
537 - exitval = run_script(info, script, -1);
538 + exitval = run_script(info, script, NULL, -1);
542 @@ -1787,7 +1787,7 @@
543 /* Run the command and set it to "true" if the return value is ok */
544 str = xmlGetProp(child, "command");
546 - cmd = run_script(info, str, 0);
547 + cmd = run_script(info, str, NULL, 0);
548 xmlSetProp(child, "install", cmd ? "false" : "true");
550 log_fatal(_("Missing 'command' attribute for an option"));
551 @@ -2213,12 +2213,15 @@
554 /* Run some shell script commands */
555 -int run_script(install_info *info, const char *script, int arg)
556 +int run_script(install_info *info, const char *script, const char *dest, int arg)
558 char script_file[PATH_MAX];
561 char working_dir[PATH_MAX];
566 /* We need to append the working directory onto the script name so
567 it can always be found. Do this only if the script file exists
568 @@ -2255,7 +2258,8 @@
569 "SETUP_CDROMPATH=\"%s\"\n"
570 "SETUP_DISTRO=\"%s\"\n"
571 "SETUP_OPTIONTAGS=\"%s\"\n"
572 - "export SETUP_PRODUCTNAME SETUP_PRODUCTVER SETUP_INSTALLPATH SETUP_SYMLINKSPATH SETUP_CDROMPATH SETUP_DISTRO SETUP_OPTIONTAGS\n"
573 + "SETUP_COMPONENT_PATH=\"%s\"\n"
574 + "export SETUP_PRODUCTNAME SETUP_PRODUCTVER SETUP_INSTALLPATH SETUP_SYMLINKSPATH SETUP_CDROMPATH SETUP_DISTRO SETUP_OPTIONTAGS SETUP_COMPONENT_PATH\n"
576 info->name, info->version,
578 @@ -2263,6 +2267,7 @@
579 info->cdroms_list ? info->cdroms_list->mounted : "",
580 info->distro ? distribution_symbol[info->distro] : "",
581 get_optiontags_string(info),
583 working_dir, script);
584 fchmod(fileno(fp),0755); /* Turn on executable bit */
587 ===================================================================
588 RCS file: /cvs/cvsroot/loki_setup/install.h,v
589 retrieving revision 1.65
590 diff -u -r1.65 install.h
591 --- install.h 2003/02/27 06:16:01 1.65
592 +++ install.h 2003/03/29 10:46:25
594 If 'arg' is >= 0, it is passed to the script as a numeric argument,
595 otherwise the install path is passed as a command line argument.
597 -extern int run_script(install_info *info, const char *script, int arg);
598 +extern int run_script(install_info *info, const char *script, const char *dest, int arg);
600 /* returns true if any deviant paths are not writable */
601 char check_deviant_paths(xmlNodePtr node, install_info *info);
605 #endif /* _install_h */