summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rwxr-xr-xnautilus-installer/Makefile11
-rw-r--r--nautilus-installer/helixcode-utils.c413
-rw-r--r--nautilus-installer/helixcode-utils.h65
-rw-r--r--nautilus-installer/nautilus-installer.c94
5 files changed, 107 insertions, 485 deletions
diff --git a/ChangeLog b/ChangeLog
index 7548e4d4f..1240bf8b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2000-05-24 J Shane Culpepper <pepper@eazel.com>
+
+ *nautilus-installer/nautilus-installer.c
+ *nautilus-installer/Makefile
+
+ Removed the duplicate helixcode files from the installer. Temporarily
+ added 4 duplicate functions to the installer until I get libtrilobite
+ statically linked in.
+
2000-05-24 Maciej Stachowiak <mjs@eazel.com>
* src/ntl-uri-map.c: Make content loser component have lower
diff --git a/nautilus-installer/Makefile b/nautilus-installer/Makefile
index 873788b01..2ef8e5800 100755
--- a/nautilus-installer/Makefile
+++ b/nautilus-installer/Makefile
@@ -1,4 +1,6 @@
CC=gcc
+
+TRILOBITE_CFLAGS=-I../components/services/trilobite/lib
EAZEL_CFLAGS=-I../components/services/install/lib
EAZEL_LIBS=../components/services/install/lib/libinstall.a
GNET_CFLAGS=`gnet-config --cflags`
@@ -13,14 +15,11 @@ SHAREDIR=/gnome/share/eazel
all: nautilus-installer
-nautilus-installer: nautilus-installer.o helixcode-utils.o
- $(CC) -static -g -O2 -o nautilus-installer nautilus-installer.o helixcode-utils.o -L/gnome/lib $(EAZEL_LIBS) $(RPM_LIBS) $(GNET_LIBS) $(GHTTP_LIBS) $(XML_LIBS) `/gnome/bin/gnome-config --libs gnomeui` -lz
-
-helixcode-utils.o: helixcode-utils.c
- $(CC) -Wall -g -c -o helixcode-utils.o helixcode-utils.c -I. -I.. `/gnome/bin/gnome-config --cflags gnomeui`
+nautilus-installer: nautilus-installer.o
+ $(CC) -static -g -O2 -o nautilus-installer nautilus-installer.o -L/gnome/lib $(EAZEL_LIBS) $(RPM_LIBS) $(GNET_LIBS) $(GHTTP_LIBS) $(XML_LIBS) `/gnome/bin/gnome-config --libs gnomeui` -lz -lbz2
nautilus-installer.o: nautilus-installer.c
- $(CC) -Wall -g -c -o nautilus-installer.o nautilus-installer.c -I. -I.. $(EAZEL_CFLAGS) `/gnome/bin/gnome-config --cflags gnomeui`
+ $(CC) -Wall -g -c -o nautilus-installer.o nautilus-installer.c -I. -I.. $(EAZEL_CFLAGS) $(TRILOBITE_CFLAGS) `/gnome/bin/gnome-config --cflags gnomeui`
clean:
diff --git a/nautilus-installer/helixcode-utils.c b/nautilus-installer/helixcode-utils.c
deleted file mode 100644
index 5103a6777..000000000
--- a/nautilus-installer/helixcode-utils.c
+++ /dev/null
@@ -1,413 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/*
- * Copyright (C) 2000 Helix Code, Inc
- * Copyright (C) 2000 Eazel, Inc
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors: Joe Shaw <joe@helixcode.com>
- * J. Shane Culpepper <pepper@eazel.com>
- */
-
-/* Most of this code is taken directly from Joe Shaw's Helix Code install / Updater
- * with a few very minor changes made by me. */
-
-#include <config.h>
-#include "helixcode-utils.h"
-
-static float determine_redhat_version (void);
-static float determine_mandrake_version (void);
-static float determine_turbolinux_version (void);
-static float determine_suse_version (void);
-static float determine_debian_version (void);
-
-char*
-xml_get_value (xmlNode* node, const char* name)
-{
- char* ret;
- xmlNode *child;
-
- ret = xmlGetProp (node, name);
- if (ret) {
- return ret;
- }
- child = node->childs;
- while (child) {
- if (g_strcasecmp (child->name, name) == 0) {
- ret = xmlNodeGetContent (child);
- if (ret) {
- return ret;
- }
- }
- child = child->next;
- }
- return NULL;
-} /* end xml_get_value */
-
-xmlDocPtr
-prune_xml (char* xmlbuf)
-{
- xmlDocPtr doc;
- char* newbuf;
- int length;
- int i;
-
- newbuf = strstr(xmlbuf, "<?xml");
- if (!newbuf) {
- return NULL;
- }
- length = strlen (newbuf);
- for (i = 0; i < length; i++) {
- if (newbuf[i] == '\0') {
- newbuf[i] = ' ';
- }
- }
- newbuf[length] = '\0';
- doc = xmlParseMemory (newbuf, length);
-
- if (!doc) {
- fprintf(stderr, "***Could not prune package file !***\n");
- return NULL;
- }
-
- return doc;
-} /* end prune_xml */
-
-gboolean
-check_for_root_user (void)
-{
- uid_t uid;
-
- uid = getuid ();
- if (uid == 0) {
- return TRUE;
- }
- else {
- return FALSE;
- }
-} /* end check_for_root_user */
-
-gboolean
-check_for_redhat (void)
-{
- if (g_file_exists ("/etc/redhat-release") != 0) {
- return TRUE;
- }
- else {
- return FALSE;
- }
-} /* end check_for_redhat */
-
-/* FIXME bugzilla.eazel.com 908: - the following functions are not
- * closing fd correctly. This needs to be fixed and the functions
- * need to be cleaned up. They are ugly right now.
- */
-static float
-determine_redhat_version (void)
-{
-
- int fd;
- char buf[1024];
- char* text;
- char* v;
- float version;
-
- fd = open ("/etc/redhat-release", O_RDONLY);
- g_return_val_if_fail (fd != -1, 0);
- read (fd, buf, 1023);
- close (fd);
- buf[1023] = '\0';
- /* These check for LinuxPPC. For whatever reason, they use
- /etc/redhat-release */
- text = strstr (buf, "1999");
- if (text)
- return 1999;
- text = strstr (buf, "2000");
- if (text)
- return 2000;
- text = strstr (buf, "6.0");
- if (text)
- return 6.0;
- text = strstr (buf, "6.");
- if (text) {
- v = g_strndup (text, 3);
- sscanf (v, "%f", &version);
- g_free (v);
- return version;
- }
- text = strstr (buf, "5.");
- if (text) {
- v = g_strndup (text, 3);
- sscanf (v, "%f", &version);
- g_free (v);
- return version;
- }
- return 0.0;
-} /* determine_redhat_version */
-
-static float
-determine_mandrake_version (void)
-{
- int fd;
- char buf[1024];
- char* text;
- char* v;
- float version;
-
- fd = open ("/etc/mandrake-release", O_RDONLY);
- g_return_val_if_fail (fd != -1, 0);
- read (fd, buf, 1023);
- close (fd);
- buf[1023] = '\0';
- text = strstr (buf, "6.0");
- if (text)
- return 6.0;
- text = strstr (buf, "6.");
- if (text) {
- v = g_strndup (text, 3);
- sscanf (v, "%f", &version);
- g_free (v);
- return version;
- }
- text = strstr (buf, "7.");
- if (text) {
- v = g_strndup (text, 3);
- sscanf (v, "%f", &version);
- g_free (v);
- return version;
- }
- return 0.0;
-} /* determine_mandrake_version */
-
-static float
-determine_turbolinux_version (void)
-{
- int fd;
- char buf[1024];
- char* text;
- char* v;
- float version;
-
- fd = open ("/etc/turbolinux-release", O_RDONLY);
- g_return_val_if_fail (fd != -1, 0);
- read (fd, buf, 1023);
- close (fd);
- buf[1023] = '\0';
- text = strstr (buf, "7.");
- if (text)
- return 7;
- text = strstr (buf, "6.");
- if (text) {
- v = g_strndup (text, 3);
- sscanf (v, "%f", &version);
- g_free (v);
- return version;
- }
- text = strstr (buf, "4.");
- if (text) {
- v = g_strndup (text, 3);
- sscanf (v, "%f", &version);
- g_free (v);
- return version;
- }
- return 0.0;
-} /* determine_turbolinux_version */
-
-static float
-determine_suse_version (void)
-{
- int fd;
- char buf[1024];
- char* text;
- char* v;
- float version;
-
- fd = open ("/etc/SuSE-release", O_RDONLY);
- g_return_val_if_fail (fd != -1, 0);
- read (fd, buf, 1023);
- close (fd);
- buf[1023] = '\0';
- text = strstr (buf, "6.");
- if (!text)
- return 0.0;
- v = g_strndup (text, 3);
- if (!v)
- return 0.0;
- sscanf (v, "%f", &version);
- g_free (v);
- if (version >= 2.2)
- return version;
- else
- return 0.0;
-} /* determine_suse_version */
-
-static float
-determine_debian_version (void)
-{
-
- int fd;
- char buf[1024];
- float version;
-
- fd = open ("/etc/debian_version", O_RDONLY);
- g_return_val_if_fail (fd != -1, 0);
- read (fd, buf, 1023);
- close (fd);
- buf[1023] = '\0';
- sscanf (buf, "%f", &version);
- if (version < 2.1)
- return 0.0;
- return version;
-} /* determine_debian_version */
-
-DistributionType
-determine_distribution_type (void)
-{
- float version;
- DistributionType rv;
-
- /* Check for TurboLinux */
- if (g_file_exists ("/etc/turbolinux-release")) {
- version = determine_turbolinux_version ();
- if (version >= 7) {
- rv = DISTRO_TURBOLINUX_6;
- }
- else if (version >= 6) {
- rv = DISTRO_TURBOLINUX_6;
- }
- else if (version >= 4) {
- rv = DISTRO_TURBOLINUX_4;
- }
- return rv;
- }
- /* Check for Mandrake */
- if (g_file_exists ("/etc/mandrake-release")) {
- version = determine_mandrake_version ();
- if (version >= 7) {
- rv = DISTRO_MANDRAKE_7;
- }
- else if (version > 6) {
- rv = DISTRO_MANDRAKE_6_1;
- }
- else {
- rv = DISTRO_UNKNOWN;
- }
- return rv;
- }
- /* Check for SuSE */
- else if (g_file_exists ("/etc/SuSE-release")) {
- version = determine_suse_version ();
- if (version) {
- rv = DISTRO_SUSE;
- }
- else {
- rv = DISTRO_UNKNOWN;
- }
- return rv;
- }
- /* Check for Corel */
- else if (g_file_exists ("/etc/environment.corel")) {
- rv = DISTRO_COREL;
- return rv;
- }
- /* Check for Debian */
- else if (g_file_exists ("/etc/debian_version")) {
- version = determine_debian_version ();
- if (version == 2.1) {
- rv = DISTRO_DEBIAN_2_1;
- }
- else if (version >= 2.2) {
- rv = DISTRO_DEBIAN_2_2;
- }
- else {
- rv = DISTRO_UNKNOWN;
- }
- return rv;
- }
- /* Check for Caldera */
- else if (g_file_exists ("/etc/coas")) {
- rv = DISTRO_CALDERA;
- return rv;
- }
- /* Check for Red Hat/LinuxPPC */
- /* This has to be checked last because many of the Red Hat knockoff
- distros keep /etc/redhat-release around. */
- if (g_file_exists ("/etc/redhat-release")) {
- version = determine_redhat_version ();
- if (version >= 1999) {
- rv = DISTRO_LINUXPPC;
- }
- else if (version == 6.0) {
- rv = DISTRO_REDHAT_6;
- }
- else if (version == 6.1) {
- rv = DISTRO_REDHAT_6_1;
- }
- else if (version >= 6.2) {
- rv = DISTRO_REDHAT_6_2;
- }
- else if (version >= 5) {
- rv = DISTRO_REDHAT_5;
- }
- else {
- rv = DISTRO_UNKNOWN;
- }
- return rv;
- }
- /* If all fail... */
- rv = DISTRO_UNKNOWN;
- return rv;
-} /* determine_distribution_type */
-
-char *
-get_distribution_name (const DistributionType* dtype)
-{
- switch ((int) dtype) {
- case DISTRO_REDHAT_5:
- return g_strdup ("RedHat Linux 5.x");
- case DISTRO_REDHAT_6:
- return g_strdup ("RedHat Linux 6.0");
- case DISTRO_REDHAT_6_1:
- return g_strdup ("RedHat Linux 6.1");
- case DISTRO_REDHAT_6_2:
- return g_strdup ("RedHat Linux 6.2");
- case DISTRO_MANDRAKE_6_1:
- return g_strdup ("Mandrake Linux 6.2");
- case DISTRO_MANDRAKE_7:
- return g_strdup ("Mandrake Linux 7.x");
- case DISTRO_CALDERA:
- return g_strdup ("Caldera OpenLinux");
- case DISTRO_SUSE:
- return g_strdup ("SuSe Linux");
- case DISTRO_LINUXPPC:
- return g_strdup ("LinuxPPC");
- case DISTRO_TURBOLINUX_4:
- return g_strdup ("TurboLinux 4.x");
- case DISTRO_TURBOLINUX_6:
- return g_strdup ("TurboLinux 6.x");
- case DISTRO_COREL:
- return g_strdup ("Corel Linux");
- case DISTRO_DEBIAN_2_1:
- return g_strdup ("Debian GNU/Linux 2.1");
- case DISTRO_DEBIAN_2_2:
- return g_strdup ("Debian GNU/Linux 2.2");
- case DISTRO_UNKNOWN:
- return g_strdup ("unknown Linux distribution");
- default:
- fprintf (stderr, "Invalid DistributionType !\n");
- exit (1);
- }
-} /* end get_distribution_name */
diff --git a/nautilus-installer/helixcode-utils.h b/nautilus-installer/helixcode-utils.h
deleted file mode 100644
index 3aad9e73e..000000000
--- a/nautilus-installer/helixcode-utils.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/*
- * Copyright (C) 2000 Helix Code, Inc
- * Copyright (C) 2000 Eazel, Inc
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors: Joe Shaw <joe@helixcode.com>
- * J. Shane Culpepper <pepper@eazel.com>
- */
-
-/* Most of this code is taken directly from Joe Shaw's Helix Code install / Updater
- * with a few very minor changes made by me. */
-
-#ifndef __HELIXCODE_INSTALL_UTILS_H__
-#define __HELIXCODE_INSTALL_UTILS_H__
-
-#include <gnome.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <gnome-xml/tree.h>
-#include <gnome-xml/parser.h>
-
-typedef enum _DistributionType DistributionType;
-
-enum _DistributionType {
- DISTRO_REDHAT_5, /* Red Hat 5.x (glibc 2.0) */
- DISTRO_REDHAT_6, /* Red Hat 6.0 (glibc 2.1) */
- DISTRO_REDHAT_6_1, /* Red Hat 6.1 (glibc 2.1) */
- DISTRO_REDHAT_6_2, /* Red Hat 6.2 (glibc 2.1) */
- DISTRO_MANDRAKE_6_1, /* Mandrake 6.1 (glibc 2.1) */
- DISTRO_MANDRAKE_7, /* Mandrake 7.0 */
- DISTRO_CALDERA, /* Caldera */
- DISTRO_SUSE, /* SuSE */
- DISTRO_LINUXPPC, /* LinuxPPC */
- DISTRO_TURBOLINUX_4, /* TurboLinux 4 */
- DISTRO_TURBOLINUX_6, /* TurboLinux 6 */
- DISTRO_COREL, /* Corel Linux */
- DISTRO_DEBIAN_2_1, /* Debian Linux 2.1 */
- DISTRO_DEBIAN_2_2, /* Debian Linux 2.2 */
- DISTRO_UNKNOWN /* Everything Else */
-};
-
-char* xml_get_value (xmlNode* node, const char* name);
-xmlDocPtr prune_xml (char* xmlbuf);
-gboolean check_for_root_user (void);
-gboolean check_for_redhat (void);
-DistributionType determine_distribution_type (void);
-char* get_distribution_name (const DistributionType* dtype);
-
-#endif /* __HELIXCODE_INSTALL_UTILS_H__ */
diff --git a/nautilus-installer/nautilus-installer.c b/nautilus-installer/nautilus-installer.c
index 1122cfc8e..93e0b9acc 100644
--- a/nautilus-installer/nautilus-installer.c
+++ b/nautilus-installer/nautilus-installer.c
@@ -47,6 +47,17 @@
#define DEFAULT_TMP_DIR "/tmp/eazel-install"
/* Forward Function Declarations */
+
+/* THe following 4 functions are a stupid copy of a few functions from
+ * components/services/trilobite/libtrilobite. These should be statically
+ * in at some point.
+ */
+
+char* xml_get_value (xmlNode* node, const char* name);
+xmlDocPtr prune_xml (char* xmlbuf);
+gboolean check_for_root_user (void);
+gboolean check_for_redhat (void);
+
static void show_usage (int exitcode, char* error);
static void show_license (int exitcode, char* error);
static TransferOptions* init_default_topts (void);
@@ -100,6 +111,88 @@ show_license (int exitcode, char* error) {
} /* end show_license */
+/* The following 4 functions are a stupid copy of a few functions from
+ * components/services/trilobite/libtrilobite. These should be statically
+ * in at some point.
+ */
+
+char*
+xml_get_value (xmlNode* node, const char* name)
+{
+ char* ret;
+ xmlNode *child;
+
+ ret = xmlGetProp (node, name);
+ if (ret) {
+ return ret;
+ }
+ child = node->childs;
+ while (child) {
+ if (g_strcasecmp (child->name, name) == 0) {
+ ret = xmlNodeGetContent (child);
+ if (ret) {
+ return ret;
+ }
+ }
+ child = child->next;
+ }
+ return NULL;
+} /* end xml_get_value */
+
+xmlDocPtr
+prune_xml (char* xmlbuf)
+{
+ xmlDocPtr doc;
+ char* newbuf;
+ int length;
+ int i;
+
+ newbuf = strstr(xmlbuf, "<?xml");
+ if (!newbuf) {
+ return NULL;
+ }
+ length = strlen (newbuf);
+ for (i = 0; i < length; i++) {
+ if (newbuf[i] == '\0') {
+ newbuf[i] = ' ';
+ }
+ }
+ newbuf[length] = '\0';
+ doc = xmlParseMemory (newbuf, length);
+
+ if (!doc) {
+ fprintf(stderr, "***Could not prune package file !***\n");
+ return NULL;
+ }
+
+ return doc;
+} /* end prune_xml */
+
+gboolean
+check_for_root_user (void)
+{
+ uid_t uid;
+
+ uid = getuid ();
+ if (uid == 0) {
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
+} /* end check_for_root_user */
+
+gboolean
+check_for_redhat (void)
+{
+ if (g_file_exists ("/etc/redhat-release") != 0) {
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
+} /* end check_for_redhat */
+
/* Initialize the InstallOptions struct with default values */
static InstallOptions*
init_default_iopts () {
@@ -188,7 +281,6 @@ main (int argc, char* argv[]) {
InstallOptions* iopts;
TransferOptions* topts;
poptContext pctx;
- char* config_file;
char* popt_tmpdir;
struct poptOption optionsTable[] = {