From 11ea07b34274ec197c1722f9fa09569ee0b77357 Mon Sep 17 00:00:00 2001 From: Eskil Heyn Olsen Date: Fri, 2 Jun 2000 10:10:12 +0000 Subject: Docs with my scetches on how to redo the rpm-glue to make * components/services/docs/installer-dep-check: Docs with my scetches on how to redo the rpm-glue to make eazel-install-lib autofetch deps. * components/services/install/command-line/eazel-alt-install.c: (eazel_download_progress): Borked, but compiles again. Will update when libinstall stabilizes. * components/services/install/lib/eazel-install-object.c: (gtk_marshal_NONE__POINTER_ENUM_POINTER), (eazel_install_class_initialize), (eazel_install_emit_download_failed), (eazel_install_emit_install_failed), (eazel_install_emit_uninstall_failed): Revamped the install_failed signal to take a PackageData object instead of char * name. * components/services/install/lib/eazel-install-protocols.c: (http_fetch_remote_file): * components/services/install/lib/eazel-install-public.h: * components/services/install/lib/eazel-install-rpm-glue.c: (install_new_packages), (download_a_package), (download_all_packages), (install_all_packages), (uninstall_packages), (uninstall_a_package), (build_packagedata_list_from_deps), (do_rpm_install), (do_rpm_uninstall), (ensure_deps_are_fetched): * components/services/install/lib/eazel-install-types.c: (categorydata_destroy_foreach), (categorydata_destroy), (packagedata_new_from_rpm_header), (packagedata_destroy_foreach), (packagedata_destroy): * components/services/install/lib/eazel-install-types.h: Doing a lot of hacking to prepare for the autofetch stuff. * nautilus-installer/src/prescript: * nautilus-installer/src/HACKING: * nautilus-installer/src/Makefile: * nautilus-installer/src/Makefile.am: * nautilus-installer/src/callbacks.c: (druid_cancel), (begin_install), (druid_finish), (prep_install), (set_images): * nautilus-installer/src/installer.c: (append_string_to_window_list), (download_failed), (install_failed_foreach), (requeue), (install_failed), (gen_report), (installer): * nautilus-installer/src/link.sh: * nautilus-installer/src/main.c: Hacking in the installer. This one is borked sine I'm trying to figure out the right scheme of reported dep fails. Actually, I want the lib to autofetch deps by option, instead of failing them Also added stuff to link.sh, so it builds static from scratch, strips gzips and adds prescript to the gzexe file. So if you build using link.sh, you get a 644 binary which when executed using sh ./nautilus-installer prompts for root password and does the magic. Easier for newbies. * components/services/time/idl/Makefile.am: * components/services/install/idl//Makefile.am: * components/services/time/Makefile.am: * components/services/install/Makefile.am: * components/services/install/lib/Makefile.am: * components/services/time/service/Makefile.am: * components/services/trilobite/idl/Makefile.am: * components/services/trilobite/libtrilobite/Makefile.am: * components/services/trilobite/sample/service/Makefile.am: * configure.in: * nautilus.spec.in: * po/POTFILES.in: * src/Makefile.am: Loads of makefile fixing to make make dist and rpm -ta work. --- nautilus-installer/src/HACKING | 15 +++++++++++ nautilus-installer/src/Makefile | 4 +-- nautilus-installer/src/Makefile.am | 5 +++- nautilus-installer/src/callbacks.c | 6 ----- nautilus-installer/src/installer.c | 55 +++++++++++++++++++++++++++++++------- nautilus-installer/src/link.sh | 20 ++++++++++++++ nautilus-installer/src/main.c | 2 ++ nautilus-installer/src/prescript | 14 ++++++++++ 8 files changed, 103 insertions(+), 18 deletions(-) create mode 100755 nautilus-installer/src/link.sh create mode 100644 nautilus-installer/src/prescript (limited to 'nautilus-installer') diff --git a/nautilus-installer/src/HACKING b/nautilus-installer/src/HACKING index a046ae9de..c982c4a12 100644 --- a/nautilus-installer/src/HACKING +++ b/nautilus-installer/src/HACKING @@ -1,3 +1,5 @@ +link.sh will build the statically linked version, plus +strip gzexe and patch prescript into it. This command will statically link all the gnome shit into the installer, but leave the rpm, db, z, bz and generic X crap as shared libs @@ -21,3 +23,16 @@ gcc -static -o nautilus-installer main.o support.o interface.o callbacks.o inst -L/usr/lib -lrpm -lz -ldb1 \ /usr/lib/libpopt.a \ -lxml + + +The gzexed file should have skip=22 replaced with + +skip=28 +if test $UID -ne 0; then + xhost + localhost + su - -c "export DISPLAY=$DISPLAY && cd $PWD && sh $0" + xhost - localhost + exit +fi + +this causes it not to require root access before running diff --git a/nautilus-installer/src/Makefile b/nautilus-installer/src/Makefile index 0c2db759b..ba9487845 100644 --- a/nautilus-installer/src/Makefile +++ b/nautilus-installer/src/Makefile @@ -147,10 +147,10 @@ l = NULL = -INCLUDES = -I$(top_srcdir)/components/services/install/lib $(GNOMEUI_CFLAGS) $(XML_CFLAGS) $(GNET_CFLAGS) $(GHTTP_CFLAGS) $(GNOME_INCLUDEDIR) -DGNOMELOCALEDIR=\""$(datadir)/locale"\" -DG_LOG_DOMAIN=\"Nautilus-Installer\" $(NULL) +INCLUDES = -I$(top_srcdir)/components/services/install/lib -I$(top_srcdir)/components/services/trilbite -I/usr/include/rpm $(GNOMEUI_CFLAGS) $(XML_CFLAGS) $(GNET_CFLAGS) $(GHTTP_CFLAGS) $(GNOME_INCLUDEDIR) -DGNOMELOCALEDIR=\""$(datadir)/locale"\" -DG_LOG_DOMAIN=\"Nautilus-Installer\" $(NULL) -CFLAGS = -O $(WERROR) +CFLAGS = -g $(WERROR) bin_PROGRAMS = nautilus-installer diff --git a/nautilus-installer/src/Makefile.am b/nautilus-installer/src/Makefile.am index e70062c77..2adc439c2 100644 --- a/nautilus-installer/src/Makefile.am +++ b/nautilus-installer/src/Makefile.am @@ -4,6 +4,8 @@ NULL = INCLUDES = \ -I$(top_srcdir)/components/services/install/lib \ + -I$(top_srcdir)/components/services/trilbite \ + -I/usr/include/rpm \ $(GNOMEUI_CFLAGS) \ $(XML_CFLAGS) \ $(GNET_CFLAGS) \ @@ -13,7 +15,8 @@ INCLUDES = \ -DG_LOG_DOMAIN=\"Nautilus-Installer\" \ $(NULL) -CFLAGS = -O $(WERROR) +CFLAGS = -g $(WERROR) +##LDFLAGS = -static bin_PROGRAMS = nautilus-installer diff --git a/nautilus-installer/src/callbacks.c b/nautilus-installer/src/callbacks.c index a0b76b385..41b2f1db3 100644 --- a/nautilus-installer/src/callbacks.c +++ b/nautilus-installer/src/callbacks.c @@ -19,7 +19,6 @@ void druid_cancel (GnomeDruid *gnomedruid, gpointer data) { - g_message ("Installation cancelled"); exit (1); } @@ -29,7 +28,6 @@ begin_install (GtkButton *button, gpointer window) { GnomeDruid *druid; - g_message ("Begin install"); druid = GNOME_DRUID (gtk_object_get_data (GTK_OBJECT (window), "druid")); gnome_druid_set_buttons_sensitive(druid,TRUE,FALSE,TRUE); @@ -67,7 +65,6 @@ druid_finish (GnomeDruidPage *gnomedruidpage, gpointer arg1, gpointer user_data) { - g_message ("Installation completed"); exit (0); } @@ -78,7 +75,6 @@ prep_install (GnomeDruidPage *gnomedruidpage, { GnomeDruid *druid; GtkButton *button; - g_message ("in prep_install"); button = GTK_BUTTON (gtk_object_get_data (GTK_OBJECT (window), "begin_button")); gtk_widget_set_sensitive (GTK_WIDGET (button), TRUE); @@ -92,8 +88,6 @@ set_images (GtkWidget *window) GnomeDruidPage *page; - g_message ("in prep"); - page = GNOME_DRUID_PAGE (gtk_object_get_data(GTK_OBJECT (window), "start_page")); gnome_druid_page_start_set_logo (GNOME_DRUID_PAGE_START (page), gdk_imlib_create_image_from_xpm_data (step_one_top)); gnome_druid_page_start_set_watermark (GNOME_DRUID_PAGE_START (page), gdk_imlib_create_image_from_xpm_data (banner_left)); diff --git a/nautilus-installer/src/installer.c b/nautilus-installer/src/installer.c index 91c02380b..eac512a0e 100644 --- a/nautilus-installer/src/installer.c +++ b/nautilus-installer/src/installer.c @@ -87,7 +87,7 @@ eazel_download_progress (EazelInstall *service, } static void -append_name_to (GtkWidget *widget, +append_string_to_window_list (GtkWidget *widget, const char *listname, const char *name) { @@ -98,23 +98,61 @@ append_name_to (GtkWidget *widget, gtk_object_set_data (GTK_OBJECT (widget), listname, list); } -void +static void download_failed (EazelInstall *service, const char *name, GtkWidget *window) { - append_name_to (window, "download_failed_list", name); + append_string_to_window_list (window, "download_failed_list", name); +} + +static void +install_failed_foreach (PackageData *dep, + GtkWidget *window) +{ + char *string; + string = g_strdup_printf (" requires %s %s", dep->name, + dep->version ? dep->version : ""); + append_string_to_window_list (window, "install_failed_list", string); + g_free (string); +} + +static void +requeue (PackageData *dep, + const PackageData *pd) +{ + g_message ("%s-%s failed, requeue and add %s for %s, version >= %s", + pd->name, + pd->version, + dep->name, + dep->archtype, + dep->version); } void install_failed (EazelInstall *service, - const char *name, - GtkWidget *window) + const PackageData *pd, + RPM_FAIL code, + GList *deps, + GtkWidget *window) { - append_name_to (window, "install_failed_list", name); + append_string_to_window_list (window, "install_failed_list", pd->name); + + switch (code) { + case RPM_DEP_FAIL: + g_list_foreach (deps, (GFunc)install_failed_foreach, window); + g_list_foreach (deps, (GFunc)requeue, (gpointer)pd); + break; + case RPM_SRC_NOT_SUPPORTED: + append_string_to_window_list (window, "install_failed_list", "source packaages not supported" ); + break; + default: + break; + } + } -static char * +static void gen_report (GtkWidget *widget, const char *listname, char **text, @@ -136,7 +174,7 @@ gen_report (GtkWidget *widget, ptr = list; while (ptr) { char *tmp; - tmp = g_strconcat ((*text), "* ", (char*)ptr->data, "\n", NULL); + tmp = g_strconcat ((*text), (char*)ptr->data, "\n", NULL); g_free ((*text)); (*text) = tmp; ptr = ptr->next; @@ -190,7 +228,6 @@ void installer (GtkWidget *window, service = eazel_install_new_with_config ("/var/eazel/services/eazel-services-config.xml"); g_assert (service != NULL); - eazel_install_open_log (service, TMP_DIR "/log"); eazel_install_set_hostname (service, HOSTNAME); eazel_install_set_rpmrc_file (service, RPMRC); eazel_install_set_package_list_storage_path (service, "/package-list.xml"); diff --git a/nautilus-installer/src/link.sh b/nautilus-installer/src/link.sh new file mode 100755 index 000000000..79f72ced4 --- /dev/null +++ b/nautilus-installer/src/link.sh @@ -0,0 +1,20 @@ +#! /bin/bash +make clean +make CFLAGS="-O -Werror" LDFLAGS="-static" +gcc -static -O -Werror -o nautilus-installer main.o support.o interface.o callbacks.o installer.o ../../components/services/trilobite/libtrilobite/helixcode-utils.o ../../components/services/install/lib/libinstall.a -L/gnome/lib -lgnomeui -lgnome -lart_lgpl -lgdk_imlib -lgtk -lgdk -lgmodule -lglib -L/usr/X11R6/lib -ldl -lXext -lX11 -lm -lSM -lICE /usr/lib/libesd.a /usr/lib/libaudiofile.a -lghttp -L/usr/lib -lrpm -lz -ldb1 -lpopt -lxml + +echo Stripping... +strip nautilus-installer +echo Packing... +gzexe nautilus-installer + +echo Patching... +chmod 644 nautilus-installer +mv nautilus-installer hest +extraskip=`expr 22 + \`wc -l prescript|awk '{printf $1"\n"}'\`` +echo "#!/bin/sh" > nautilus-installer +echo "skip=$extraskip" >> nautilus-installer +cat prescript >> nautilus-installer +tail +3 hest >> nautilus-installer +rm hest +echo Done... diff --git a/nautilus-installer/src/main.c b/nautilus-installer/src/main.c index 3ca65d2a5..e4d39f7ea 100644 --- a/nautilus-installer/src/main.c +++ b/nautilus-installer/src/main.c @@ -11,6 +11,8 @@ #include "interface.h" #include "support.h" +#include "callbacks.h" +#include int main (int argc, char *argv[]) diff --git a/nautilus-installer/src/prescript b/nautilus-installer/src/prescript new file mode 100644 index 000000000..cef0a719d --- /dev/null +++ b/nautilus-installer/src/prescript @@ -0,0 +1,14 @@ +if test x$DISPLAY = x; then + echo "The Nautilus-Installer requires X" +fi +if test $UID -ne 0; then + echo "" + echo "The Nautilus-Installer requires superuser access to install packages." + echo "yadayada insecure yadayada trust us blablabla" + echo "" + echo "Please enter root password at the prompt" + xhost + localhost + su - -c "export DISPLAY=$DISPLAY && cd $PWD && sh $0" + xhost - localhost + exit +fi -- cgit v1.2.1