summaryrefslogtreecommitdiff
path: root/nautilus-installer
diff options
context:
space:
mode:
authorRobey Pointer <robey@src.gnome.org>2001-01-11 23:34:22 +0000
committerRobey Pointer <robey@src.gnome.org>2001-01-11 23:34:22 +0000
commit92f288c876b06639bb06e0a881e49150fe39517d (patch)
tree3d08f0cb6bf2b77ddaae512e84669e184631aacc /nautilus-installer
parent38f9b0946c5806e9b79cd78a59216ce93b50f332 (diff)
downloadnautilus-92f288c876b06639bb06e0a881e49150fe39517d.tar.gz
Turn g_error to g_warning in the EazelInstallCallback initializer, so that
* components/services/install/lib/eazel-install-corba-callback.c: (eazel_install_callback_initialize), (eazel_install_callback_new): Turn g_error to g_warning in the EazelInstallCallback initializer, so that it doesn't kill off the view when the install service isn't around. Instead, set some fields to NULL and return normally. The *_new call then returns NULL on failure. * components/services/install/nautilus-view/nautilus-service-instal l-view.c: (nautilus_service_install_installing), (nautilus_service_install_view_update_from_uri): Notice if the eazel_install_callback_new call returns NULL, and gracefully handle it by ceasing operations and popping up a dialog about the failure. This solves the "don't crash if the install service is missing" bug. * components/services/install/lib/eazel-install-object.c: (eazel_install_add_repository): * components/services/install/lib/eazel-install-private.h: * components/services/install/lib/eazel-install-protocols.c: (my_copy_file), (eazel_install_fetch_file): * components/services/install/lib/eazel-install-public.h: * nautilus-installer/src/installer.c: (get_candidate_dirs), (search_for_local_cds), (eazel_installer_initialize): * nautilus-installer/src/main.c: Retrofit the --cache-dir option and code to automatically add mounted CD packages to the repository, from the PR3 installer branch. * nautilus-installer/src/Makefile: Help me, Obi-wan, you're my only hope.
Diffstat (limited to 'nautilus-installer')
-rw-r--r--nautilus-installer/src/Makefile3
-rw-r--r--nautilus-installer/src/installer.c77
-rw-r--r--nautilus-installer/src/main.c2
3 files changed, 82 insertions, 0 deletions
diff --git a/nautilus-installer/src/Makefile b/nautilus-installer/src/Makefile
index fa49ac7a3..7b325a777 100644
--- a/nautilus-installer/src/Makefile
+++ b/nautilus-installer/src/Makefile
@@ -157,6 +157,9 @@ VFS_CFLAGS = -I/gnome/include -I/gnome/lib/vfs/include -I/gnome/include/glib-1.2
VFS_LIBS = -rdynamic -L/gnome/lib -lgnomevfs -lgmodule -lgthread -lglib -lpthread -ldl
XML_CFLAGS = -I/gnome/include/gnome-xml
XML_CONFIG = /gnome/bin/xml-config
+XML_I18N_EXTRACT = $(top_builddir)/xml-i18n-extract
+XML_I18N_MERGE = $(top_builddir)/xml-i18n-merge
+XML_I18N_UPDATE = $(top_builddir)/xml-i18n-update
XML_LIBS = -L/gnome/lib -lxml -lz
ZVT_LIBS =
Z_LIBS = -lz
diff --git a/nautilus-installer/src/installer.c b/nautilus-installer/src/installer.c
index e9ac5f712..349578966 100644
--- a/nautilus-installer/src/installer.c
+++ b/nautilus-installer/src/installer.c
@@ -211,6 +211,7 @@ int installer_server_port = 0;
char *installer_cgi_path = NULL;
char *installer_tmpdir = "/tmp";
char *installer_homedir = NULL;
+char *installer_cache_dir = NULL;
static void check_if_next_okay (GnomeDruidPage *page, void *unused, EazelInstaller *installer);
static void jump_to_retry_page (EazelInstaller *installer);
@@ -1903,6 +1904,80 @@ start_logging (EazelInstaller *installer)
}
+static void
+get_candidate_dirs (EazelInstall *install, char *dir)
+{
+ DIR *dirfd;
+ struct dirent *file;
+ char *candidate;
+ struct stat statbuf;
+
+ dirfd = opendir (dir);
+ if (dirfd == NULL) {
+ return;
+ }
+ while ((file = readdir (dirfd)) != NULL) {
+ candidate = g_strdup_printf ("%s/%s", dir, file->d_name);
+ if ((lstat (candidate, &statbuf) == 0) &&
+ (statbuf.st_mode & S_IFDIR) &&
+ ((statbuf.st_mode & S_IFLNK) != S_IFLNK) &&
+ (statbuf.st_nlink == 2)) {
+ if ((strstr (file->d_name, "RPM") != NULL) ||
+ (strstr (file->d_name, "package") != NULL)) {
+ /* good candidate! */
+ printf ("candidate: '%s'\n", candidate);
+ eazel_install_add_repository (install, candidate);
+ }
+ }
+ g_free (candidate);
+ }
+ closedir (dirfd);
+}
+
+/* look for a mounted cdrom:
+ * anything with "cdrom" or "iso9660" in the name
+ */
+static void
+search_for_local_cds (EazelInstall *install)
+{
+ FILE *fp;
+ char line[256];
+ char *p, *q;
+ char *dir;
+
+ fp = fopen ("/proc/mounts", "r");
+ if (fp == NULL) {
+ g_warning ("Couldn't open /proc/mounts");
+ return;
+ }
+ while (! feof (fp)) {
+ fgets (line, 250, fp);
+ if (feof (fp)) {
+ break;
+ }
+ line[250] = '\0';
+ if ((strstr (line, "cdrom") != NULL) ||
+ (strstr (line, "iso9660") != NULL)) {
+ /* candidate: 2nd field is the mountpoint */
+ p = strchr (line, ' ');
+ if (p != NULL) {
+ p++;
+ q = strchr (p, ' ');
+ if (q != NULL) {
+ dir = g_strndup (p, q-p);
+ get_candidate_dirs (install, dir);
+ g_free (dir);
+ }
+ }
+ }
+ }
+ fclose (fp);
+
+ if (installer_cache_dir != NULL) {
+ eazel_install_add_repository (install, installer_cache_dir);
+ }
+}
+
/* if there's an older tmpdir left over from a previous attempt, use it */
#define TMPDIR_PREFIX "eazel-installer."
static char *
@@ -2056,6 +2131,8 @@ eazel_installer_initialize (EazelInstaller *object)
"cgi_path", installer_cgi_path ? installer_cgi_path : CGI_PATH,
NULL));
+ search_for_local_cds (installer->service);
+
gnome_druid_set_buttons_sensitive (installer->druid, FALSE, FALSE, TRUE);
/* show what we have so far */
diff --git a/nautilus-installer/src/main.c b/nautilus-installer/src/main.c
index c31a7b83f..f1651c0e0 100644
--- a/nautilus-installer/src/main.c
+++ b/nautilus-installer/src/main.c
@@ -53,6 +53,7 @@ extern char* installer_package;
extern char* installer_cgi_path;
extern char* installer_tmpdir;
extern char* installer_homedir;
+extern char* installer_cache_dir;
static int installer_show_build = 0;
static char *installer_user = NULL;
@@ -78,6 +79,7 @@ static const struct poptOption options[] = {
{"build", 'B', POPT_ARG_NONE, &installer_show_build, 0, N_("Display installer version"), NULL},
{"batch", '\0', POPT_ARG_NONE, &installer_dont_ask_questions, 0, N_("Solve installation issues without interaction"), NULL},
{"ignore-disk-space", '\0', POPT_ARG_NONE | POPT_ARGFLAG_DOC_HIDDEN, &installer_ignore_disk_space, 0, "", NULL},
+ {"cache-dir", 'C', POPT_ARG_STRING, &installer_cache_dir, 0, N_("Look here for cached package files"), "directory"},
{NULL, '\0', 0, NULL, 0}
};