2 ===================================================================
3 RCS file: /cvs/cvsroot/loki_setup/CHANGES,v
4 retrieving revision 1.86
6 --- CHANGES 2003/09/24 04:02:47 1.86
7 +++ CHANGES 2003/10/24 18:12:36
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 Ryan C. Gordon (icculus.org) - Tue Jan 14 23:46:31 EST 2003
17 * Committed initial MacOS X patches to CVS on behalf of Jon C.
18 Stephane Peter (Codehost) - Fri Dec 6 16:31:27 PST 2002
20 ===================================================================
21 RCS file: /cvs/cvsroot/loki_setup/Makefile.in,v
22 retrieving revision 1.25
23 diff -u -r1.25 Makefile.in
24 --- Makefile.in 2003/05/02 22:54:49 1.25
25 +++ Makefile.in 2003/10/24 18:12:36
28 @if [ -d image/setup.data/bin/$(os)/$(arch)/$(libc) ]; then \
29 cp setup image/setup.data/bin/$(os)/$(arch); \
30 - strip image/setup.data/bin/$(os)/$(arch)/setup; \
31 + strip -r image/setup.data/bin/$(os)/$(arch)/setup; \
32 $(BRANDELF) -t $(os) image/setup.data/bin/$(os)/$(arch)/setup; \
33 cp uninstall image/setup.data/bin/$(os)/$(arch); \
34 - strip image/setup.data/bin/$(os)/$(arch)/uninstall; \
35 + strip -r image/setup.data/bin/$(os)/$(arch)/uninstall; \
36 $(BRANDELF) -t $(os) image/setup.data/bin/$(os)/$(arch)/uninstall; \
37 cp xsu image/setup.data/bin/$(os)/$(arch)/$(libc); \
38 - strip image/setup.data/bin/$(os)/$(arch)/$(libc)/xsu; \
39 + strip -r image/setup.data/bin/$(os)/$(arch)/$(libc)/xsu; \
40 $(BRANDELF) -t $(os) image/setup.data/bin/$(os)/$(arch)/$(libc)/xsu; \
41 cp setup.gtk image/setup.data/bin/$(os)/$(arch)/$(libc); \
42 - strip image/setup.data/bin/$(os)/$(arch)/$(libc)/setup.gtk; \
43 + strip -r image/setup.data/bin/$(os)/$(arch)/$(libc)/setup.gtk; \
44 $(BRANDELF) -t $(os) image/setup.data/bin/$(os)/$(arch)/$(libc)/setup.gtk; \
46 - echo No directory to copy the binary files to.; \
47 + echo image/setup.data/bin/$(os)/$(arch)/$(libc): No directory to copy the binary files to.; \
52 cp setup.gtk $(IMAGE)/setup.data/bin/$(os)/$(arch)/$(libc); \
53 strip $(IMAGE)/setup.data/bin/$(os)/$(arch)/$(libc)/setup.gtk; \
55 - echo No directory to copy the binary files to.; \
56 + echo $(IMAGE)/setup.data/bin/$(os)/$(arch)/$(libc): No directory to copy the binary files to.; \
61 strip $(IMAGE)/bin/$(os)/$(arch)/check; \
62 cp check.glade $(IMAGE)/misc/; \
64 - echo No directory to copy the binary files to.; \
65 + echo $(IMAGE)/bin/$(os)/$(arch): No directory to copy the binary files to.; \
68 # Copy loki_uninstall and the required files
73 - echo No directory to copy the binary files to.; \
74 + echo $(IMAGE)/bin/$(os)/$(arch): No directory to copy the binary files to.; \
77 install-loki_uninstall: loki_uninstall
82 - echo No directory to copy the binary files to.; \
83 + echo $(IMAGE)/loki_uninstall/bin/$(arch)/$(libc): No directory to copy the binary files to.; \
85 @if [ -d $(UPDATES) ]; then \
86 rm -rf $(UPDATES)/bin-$(arch)-$(UNINSTALL_VERSION)/; \
88 ===================================================================
89 RCS file: /cvs/cvsroot/loki_setup/configure.in,v
90 retrieving revision 1.41
91 diff -u -r1.41 configure.in
92 --- configure.in 2003/08/13 21:48:29 1.41
93 +++ configure.in 2003/10/24 18:12:36
97 powerpc-apple-darwin*)
104 CARBONLIBS="$CARBON_LIBS $LIBINTL"
109 - powerpc-apple-darwin*)
110 - if test -f /sw/lib/libintl.a; then
111 - LIBINTL="/sw/lib/libintl.a /sw/lib/libiconv.a"
112 - LIBS="$LIBS $LIBINTL"
113 - GUILIBS="$GUI_LIBS $LIBINTL"
114 - CARBONLIBS="$CARBON_LIBS $LIBINTL"
118 AC_CHECK_LIB(gpm, Gpm_Open, USE_GPM=yes)
121 ===================================================================
122 RCS file: /cvs/cvsroot/loki_setup/copy.c,v
123 retrieving revision 1.69
124 diff -u -r1.69 copy.c
125 --- copy.c 2003/09/04 02:29:03 1.69
126 +++ copy.c 2003/10/24 18:12:37
131 - if ( run_script(info, buf, 0, 1) == 0 ) {
132 + if ( run_script(info, buf, NULL, 0, 1) == 0 ) {
133 const char *target = xmlGetProp(node, "target");
135 char targetpath[PATH_MAX];
137 if ( ! update(info, _("Running script"), 0, 0, current_option_txt) )
140 - return(run_script(info, script, -1, 1));
141 + return(run_script(info, script, dest, -1, 1));
144 ssize_t copy_node(install_info *info, xmlNodePtr node, const char *dest,
147 ssize_t size, copied;
148 char tmppath[PATH_MAX];
149 + const char *component_dest;
155 current_component = NULL; /* Out of the component */
158 + /* Parse subcomponents */
159 + else if (!strcmp(node->name, "subcomponent")) {
160 + const char *name, *version;
162 + name = xmlGetProp(node, "name");
164 + log_fatal(_("SubComponent element must have a name"));
165 + version = xmlGetProp(node, "version");
168 + log_warning(_("SubComponent doesn't have a version"));
169 + version = strdup("noversion");
171 + child = node->childs;
174 + if(!strcmp(child->name, "option"))
176 + /* only run if it has been actually selected for install */
177 + const char *install;
178 + install = xmlGetProp(child, "install");
179 + if (install && !strcmp(install,"true"))
181 + /* add this subcomponent as a standard component */
182 + current_component = add_component_entry(info, name, version,
183 + (strcmp(xmlGetProp(child, "install"), "true") != 0) ? 0 : 1, NULL, NULL );
184 + if(xmlGetProp(child, "path"))
186 + /* if the path's been changed, use the path it was changed to */
187 + component_dest = xmlGetProp(child, "path");
191 + /* if the path hasn't been changed, install to the default path */
192 + component_dest = xmlGetProp(child, "default_path");
194 + // TODO: verify the install location ?
195 + copied = copy_node(info, child, component_dest, update);
200 + copied = copy_tree(info, child->childs, component_dest, update);
207 + child = child->next;
209 } else if ( ! strcmp(node->name, "environment") ) {
210 const char *prop = xmlGetProp(node, "var");
213 ===================================================================
214 RCS file: /cvs/cvsroot/loki_setup/gtk_ui.c,v
215 retrieving revision 1.87
216 diff -u -r1.87 gtk_ui.c
217 --- gtk_ui.c 2003/10/15 00:08:11 1.87
218 +++ gtk_ui.c 2003/10/24 18:12:37
220 static GladeXML *setup_glade = NULL;
221 static GladeXML *setup_glade_readme = NULL;
222 static GladeXML *setup_glade_license = NULL;
223 +static GladeXML *setup_glade_subcomponent = NULL;
224 static int cur_state;
225 static install_info *cur_info;
226 static int diskspace;
228 void setup_destroy_view_readme_slot(GtkWidget*, gpointer);
229 static yesno_answer gtkui_prompt(const char*, yesno_answer);
230 static void gtkui_abort(install_info *info);
231 +static int gtkui_dir_prompt (install_info *info, const char *message, char *path);
233 static int iterate_for_state(void)
235 @@ -1216,6 +1218,189 @@
239 +/*************** subcomponent *********************/
241 +void setup_button_subcomponent_browse(GtkWidget *widget, gpointer func_data)
243 + GtkWidget *entry = (GtkWidget *)func_data;
244 + xmlNodePtr node = gtk_object_get_data(GTK_OBJECT(widget), "node");
245 + char *widget_data = gtk_object_get_data(GTK_OBJECT(widget), "data");
246 + char path[PATH_MAX];
247 + strncpy(path, gtk_entry_get_text(GTK_ENTRY(entry)), PATH_MAX);
249 + gtkui_dir_prompt(cur_info, widget_data, path);
251 + if(path[strlen(path)-1] != '/')
254 + gtk_entry_set_text(GTK_ENTRY(entry), path);
256 + xmlSetProp(node, "path", path);
259 +void setup_subcomponent_toggle(GtkWidget *widget, gpointer func_data)
261 + int state = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
262 + GtkWidget *entry = gtk_object_get_data(GTK_OBJECT(widget), "entry");
263 + GtkWidget *button = gtk_object_get_data(GTK_OBJECT(widget), "button");
264 + xmlNodePtr node = gtk_object_get_data(GTK_OBJECT(widget), "node");
268 + gtk_widget_set_sensitive(GTK_WIDGET(entry), TRUE);
269 + gtk_widget_set_sensitive(GTK_WIDGET(button), TRUE);
270 + xmlSetProp(node, "install", "true");
271 + xmlSetProp(node, "path", gtk_entry_get_text(GTK_ENTRY(entry)));
275 + gtk_widget_set_sensitive(GTK_WIDGET(entry), FALSE);
276 + gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);
277 + xmlSetProp(node, "install", "false");
278 + xmlSetProp(node, "path", "");
282 +void subcomponent_update_entry(GtkWidget *widget, gpointer func_data)
284 + xmlNodePtr node = gtk_object_get_data(GTK_OBJECT(widget), "node");
285 + char *path = malloc(strlen(gtk_entry_get_text(GTK_ENTRY(widget)))+2);
286 + strcpy(path, gtk_entry_get_text(GTK_ENTRY(widget)));
288 + if (path[strlen(path)-1] != '/')
292 + xmlSetProp(node, "path", path);
295 +void setup_button_subcomponent(GtkWidget *widget, gpointer func_data)
299 + GtkWidget *window, *frame, *w, *vbox, *hbox,
300 + *check, *entry, *button, *sep;
306 + install_info *info = (install_info *)func_data;
308 + setup_glade_subcomponent = glade_xml_new(SETUP_GLADE, "subcomponent_dialog");
309 + glade_xml_signal_autoconnect(setup_glade_subcomponent);
310 + window = glade_xml_get_widget(setup_glade_subcomponent, "subcomponent_dialog");
311 + frame = glade_xml_get_widget(setup_glade_subcomponent, "subcomponent_frame");
313 + w = glade_xml_get_widget(setup_glade_subcomponent, "subcomponent_button_cancel");
314 + gtk_widget_hide(w);
316 + gtk_widget_realize(window);
317 + gtk_widget_realize(frame);
318 + gtk_container_foreach(GTK_CONTAINER(frame), empty_container, frame);
320 + w = gtk_vbox_new(TRUE, 2);
321 + gtk_container_add(GTK_CONTAINER(frame), w);
322 + gtk_widget_show(w);
324 + gtk_object_set_data(GTK_OBJECT(window), "data", w);
326 + node = info->config->root->childs;
327 + while(node != NULL && strcmp(node->name, "subcomponent"))
330 + log_fatal(_("subcomponent element not found"));
331 + child = node->childs;
332 + // subcomponent options
333 + while(child != NULL)
335 + if(!strcmp(child->name, "option"))
337 + if(!strcmp(xmlGetProp(child, "install"), "true"))
342 + vbox = gtk_vbox_new(FALSE, 2);
343 + gtk_box_pack_start(GTK_BOX(w), vbox, TRUE, FALSE, 0);
344 + gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
345 + gtk_widget_show(vbox);
349 + sep = gtk_hseparator_new();
350 + gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
351 + gtk_widget_show(sep);
354 + text = xmlNodeListGetString(info->config, child->childs, 1);
355 + parse_line(&text, name, sizeof(name));
357 + check = gtk_check_button_new_with_label(name);
358 + gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
360 + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), TRUE);
361 + gtk_signal_connect(GTK_OBJECT(check), "toggled", GTK_SIGNAL_FUNC(setup_subcomponent_toggle), NULL);
362 + gtk_object_set_data(GTK_OBJECT(check), "name", name);
363 + gtk_object_set_data(GTK_OBJECT(check), "node", child);
364 + gtk_widget_show(check);
366 + hbox = gtk_hbox_new(FALSE, 2);
367 + gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, FALSE, 0);
368 + gtk_widget_show(hbox);
370 + entry = gtk_entry_new();
371 + //gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, FALSE, 0);
372 + gtk_container_add(GTK_CONTAINER(hbox), entry);
374 + gtk_widget_set_sensitive(GTK_WIDGET(entry), FALSE);
375 + gtk_signal_connect(GTK_OBJECT(entry), "focus_out_event", GTK_SIGNAL_FUNC(subcomponent_update_entry), NULL);
376 + gtk_object_set_data(GTK_OBJECT(entry), "name", name);
377 + gtk_object_set_data(GTK_OBJECT(entry), "node", child);
378 + gtk_widget_show(entry);
380 + if(xmlGetProp(child, "path"))
382 + gtk_entry_set_text(GTK_ENTRY(entry), xmlGetProp(child, "path"));
384 + else if (xmlGetProp(child, "default_path"))
386 + gtk_entry_set_text(GTK_ENTRY(entry), xmlGetProp(child, "default_path"));
390 + button = gtk_button_new_with_label("...");
391 + gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
392 + gtk_object_set_data(GTK_OBJECT(button), "data", gtk_entry_get_text(GTK_ENTRY(entry)));
393 + gtk_object_set_data(GTK_OBJECT(button), "node", child);
394 + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(setup_button_subcomponent_browse), entry);
396 + gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);
397 + gtk_widget_show(button);
399 + gtk_object_set_data(GTK_OBJECT(check), "entry", entry);
400 + gtk_object_set_data(GTK_OBJECT(check), "button", button);
404 + child = child->next;
406 + gtk_widget_show(window);
407 + //gtk_window_set_modal(GTK_WINDOW(window), TRUE);
410 +void setup_button_subcomponent_cancel(GtkWidget *widget, gpointer func_data)
412 + GtkWidget *window = glade_xml_get_widget(setup_glade_subcomponent, "subcomponent_dialog");
413 + gtk_widget_hide(window);
416 +void setup_button_subcomponent_ok(GtkWidget *widget, gpointer func_data)
418 + GtkWidget *window = glade_xml_get_widget(setup_glade_subcomponent, "subcomponent_dialog");
419 + gtk_widget_hide(window);
422 /********** UI functions *************/
424 static install_state gtkui_init(install_info *info, int argc, char **argv, int noninteractive)
425 @@ -1533,6 +1718,12 @@
429 + } else if ( ! strcmp(node->name, "subcomponent") ) {
430 + GtkWidget *widget = gtk_button_new_with_label(xmlGetProp(node, "name"));
431 + gtk_box_pack_start(GTK_BOX(options), GTK_WIDGET(widget), FALSE, FALSE, 5);
432 + gtk_object_set_data(GTK_OBJECT(widget), "data", (gpointer)xmlGetProp(node, "name"));
433 + gtk_signal_connect(GTK_OBJECT(widget), "clicked", GTK_SIGNAL_FUNC(setup_button_subcomponent), (gpointer)info);
434 + gtk_widget_show(widget);
438 @@ -1719,6 +1910,63 @@
442 +static int dirname_loop;
443 +static int prompt_ret;
445 +void store_dirname_slot(GtkFileSelection *selector, gpointer user_data) {
447 + char *selected_dirname = (char *)user_data;
450 + parent = gtk_widget_get_toplevel (GTK_WIDGET(selector));
451 + aux = gtk_file_selection_get_filename (GTK_FILE_SELECTION (parent));
453 + strcpy(selected_dirname, aux);
458 +void abort_slot(GtkFileSelection *selector, gpointer user_data) {
463 +static int gtkui_dir_prompt (install_info *info, const char *message, char *path)
465 + GtkWidget *selector;
468 + /* Create the selector */
469 + selector = gtk_file_selection_new(message);
471 + gtk_file_selection_set_filename(GTK_FILE_SELECTION(selector), path);
472 + gtk_file_selection_hide_fileop_buttons (GTK_FILE_SELECTION(selector));
474 + gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION(selector)->ok_button),
475 + "clicked", GTK_SIGNAL_FUNC (store_dirname_slot), path);
477 + gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION(selector)->cancel_button),
478 + "clicked", GTK_SIGNAL_FUNC (abort_slot), path);
480 + /* Display that dialog */
482 + gtk_grab_add(selector);
483 + gtk_widget_show (selector);
484 + gtk_grab_remove(selector);
489 + while (dirname_loop==1)
490 + gtk_main_iteration();
492 + aux = gtk_file_selection_get_filename (GTK_FILE_SELECTION(selector));
494 + gtk_widget_destroy(selector);
499 int gtkui_okay(Install_UI *UI, int *argc, char ***argv)
501 extern int force_console;
502 @@ -1769,7 +2017,3 @@
511 ===================================================================
512 RCS file: /cvs/cvsroot/loki_setup/install.c,v
513 retrieving revision 1.124
514 diff -u -r1.124 install.c
515 --- install.c 2003/09/27 01:52:38 1.124
516 +++ install.c 2003/10/24 18:12:38
519 prop = xmlGetProp(node, "command");
520 if ( prop ) { /* Run the command */
521 - if ( run_script(info, prop, 0, 1) != 0 ) /* Failed, skip */
522 + if ( run_script(info, prop, NULL, 0, 1) != 0 ) /* Failed, skip */
525 prop = xmlGetProp(node, "lang");
526 @@ -1084,7 +1084,7 @@
527 log_fatal(_("XML: 'require' tag doesn't have a mandatory 'command' attribute"));
529 /* Launch the command */
530 - if ( run_script(info, prop, 0, 0) != 0 ) {
531 + if ( run_script(info, prop, NULL, 0, 0) != 0 ) {
532 /* We failed: print out error message */
533 text = xmlNodeListGetString(info->config, node->childs, 1);
535 @@ -1224,7 +1224,7 @@
538 /* Launch the command */
539 - return run_script(info, txt, 0, 0) == 0;
540 + return run_script(info, txt, NULL, 0, 0) == 0;
544 @@ -1431,7 +1431,7 @@
546 if (GetPreUnInstall(info) && info->installed_bytes>0) {
547 snprintf(path, sizeof(path), "sh %s", GetPreUnInstall(info));
548 - run_script(info, path, 0, 1);
549 + run_script(info, path, NULL, 0, 1);
552 if ( file_exists(info->install_path) ) {
553 @@ -1448,7 +1448,7 @@
554 /* Do not run scripts if nothing was installed */
555 if ( info->installed_bytes>0 ) {
556 for ( selem = opt->pre_script_list; selem; selem = selem->next ) { /* RPM pre-uninstall */
557 - run_script(info, selem->script, 0, 1);
558 + run_script(info, selem->script, NULL, 0, 1);
562 @@ -1465,7 +1465,7 @@
564 if ( info->installed_bytes>0 ) {
565 for ( selem = opt->post_script_list; selem; selem = selem->next ) { /* RPM post-uninstall */
566 - run_script(info, selem->script, 0, 1);
567 + run_script(info, selem->script, NULL, 0, 1);
571 @@ -1483,7 +1483,7 @@
573 if (GetPostUnInstall(info) && info->installed_bytes>0) {
574 snprintf(path, sizeof(path), "sh %s", GetPostUnInstall(info));
575 - run_script(info, path, 0, 1);
576 + run_script(info, path, NULL, 0, 1);
579 if ( uninstall_generated ) {
580 @@ -1896,7 +1896,7 @@
581 if ( ! restoring_corrupt() ) {
582 script = GetPreInstall(info);
584 - exitval = run_script(info, script, -1, 1);
585 + exitval = run_script(info, script, NULL, -1, 1);
589 @@ -1909,7 +1909,7 @@
590 if ( ! restoring_corrupt() ) {
591 script = GetPostInstall(info);
593 - exitval = run_script(info, script, -1, 1);
594 + exitval = run_script(info, script, NULL, -1, 1);
598 @@ -1930,7 +1930,7 @@
599 /* Run the command and set it to "true" if the return value is ok */
600 str = xmlGetProp(child, "command");
602 - cmd = run_script(info, str, 0, 0);
603 + cmd = run_script(info, str, NULL, 0, 0);
604 xmlSetProp(child, "install", cmd ? "false" : "true");
605 log_debug("Script run: '%s' returned %d\n", str, cmd);
607 @@ -2370,13 +2370,16 @@
610 /* Run some shell script commands */
611 -int run_script(install_info *info, const char *script, int arg, int include_tags)
612 +int run_script(install_info *info, const char *script, const char *dest, int arg, int include_tags)
614 char script_file[PATH_MAX];
617 char working_dir[PATH_MAX];
622 /* We need to append the working directory onto the script name so
623 it can always be found. Do this only if the script file exists
624 (to avoid problems with 'sh script.sh')
625 @@ -2412,13 +2415,16 @@
626 "SETUP_CDROMPATH=\"%s\"\n"
627 "SETUP_DISTRO=\"%s\"\n"
628 "SETUP_REINSTALL=\"%s\"\n"
629 - "export SETUP_PRODUCTNAME SETUP_PRODUCTVER SETUP_INSTALLPATH SETUP_SYMLINKSPATH SETUP_CDROMPATH SETUP_DISTRO SETUP_REINSTALL\n",
630 + "SETUP_COMPONENT_PATH=\"%s\"\n"
631 + "export SETUP_PRODUCTNAME SETUP_PRODUCTVER SETUP_INSTALLPATH SETUP_SYMLINKSPATH SETUP_CDROMPATH SETUP_DISTRO SETUP_REINSTALL SETUP_OPTIONTAGS SETUP_COMPONENT_PATH\n",
632 info->name, info->version,
635 info->cdroms_list ? info->cdroms_list->mounted : "",
636 info->distro ? distribution_symbol[info->distro] : "",
637 - info->options.reinstalling ? "1" : "0");
638 + info->options.reinstalling ? "1" : "0",
646 ===================================================================
647 RCS file: /cvs/cvsroot/loki_setup/install.h,v
648 retrieving revision 1.73
649 diff -u -r1.73 install.h
650 --- install.h 2003/09/24 04:02:48 1.73
651 +++ install.h 2003/10/24 18:12:38
653 otherwise the install path is passed as a command line argument.
654 'include_tags' indicates if the SETUP_OPTIONTAGS should be set in the script header.
656 -extern int run_script(install_info *info, const char *script, int arg, int include_tags);
657 +extern int run_script(install_info *info, const char *script, const char *dest, int arg, int include_tags);
659 /* returns true if any deviant paths are not writable */
660 char check_deviant_paths(xmlNodePtr node, install_info *info);
664 #endif /* _install_h */