Added eazel-revert, should probably change name...

* components/services/install/command-line/Makefile.am:
	Added eazel-revert, should probably change name...

	* components/services/install/command-line/eazel-alt-install-corba.c:
	(done), (main):
	Fixed type in the POPT options and the destruction of the
	eazelinstall object.

	* components/services/install/command-line/eazel-alt-install.c:
	(main):
	Tried to revive it, but dropped it. Probably would be a nice
	feature, as to make a statically linked tool (see bug#1863).

	* components/services/install/command-line/eazel-revert.c:
	(set_parameters_from_command_line), (eazel_preflight_check_signal),
	(eazel_download_progress_signal), (eazel_install_progress_signal),
	(download_failed), (install_failed), (dep_check), (delete_files),
	(done), (get_password_dude), (set_root_client), (main):
	Did the first pass at a cli reversion tool.

	* components/services/install/idl/trilobite-eazel-install.idl:
	Removed some oneway statements and added the revert-transaction
	call.

	* components/services/install/lib/eazel-install-corba.c:
	(impl_Eazel_Install_uninstall_packages),
	(impl_Eazel_Install_revert_transaction), (eazel_install_get_epv):
	* components/services/install/lib/eazel-install-corba-callback.h:
	* components/services/install/lib/eazel-install-corba-callback.c:
	(eazel_install_callback_destroy), (eazel_install_callback_query),
	(eazel_install_callback_revert_transaction):
	Added the revert-transaction hooks.

	* components/services/install/lib/eazel-install-corba-types.c:
	(corba_packagedatastruct_from_packagedata):
	Updated for the changes to trilobite-distro-get-name

	* components/services/install/lib/eazel-install-public.h:
	* components/services/install/lib/eazel-install-object.c:
	(eazel_install_destroy), (eazel_install_install_packages),
	(eazel_install_uninstall_packages),
	(eazel_install_revert_transaction_from_xmlstring):
	install downloads the package list to the tmpdir. Added the code
	to call the revert-transaction in rpm-glue.c

	* components/services/install/lib/eazel-install-protocols.c:
	(http_fetch_remote_file), (get_search_url_for_package):
	First stuff for using lhamels rpmsearch cgi script.

	* components/services/install/lib/eazel-install-rpm-glue.h:
	* components/services/install/lib/eazel-install-rpm-glue.c:
	(ei_get_packages_with_mod_flag), (ei_check_uninst_vs_downgrade),
	(hest), (revert_transaction),
	(eazel_install_do_rpm_transaction_save_report_helper),
	(eazel_install_do_rpm_transaction_save_report),
	(eazel_uninstall_upward_traverse):
	Did bug#1586, 1818, 1820. Hest is a debug function, will go
	away. The rest is code for the revert-transaction.

	* components/services/install/lib/eazel-install-types.c:
	(packagedata_fill_from_rpm_header):
	Read the RPMTAG_SUMMARY instead of RPMTAG_DESCRIPTION.

	* components/services/install/lib/eazel-install-xml-package-list.h:
	* components/services/install/lib/eazel-install-xml-package-list.c:
	(parse_package), (parse_memory_transaction_file),
	(eazel_install_packagedata_to_xml):
	Added code to parse a transaction file (bug#1817). Also some
	sanity checks wrt reading the status fields.

	* components/services/trilobite/libtrilobite/trilobite-core-distribut
	ion.c: (trilobite_get_distribution_name):
	* components/services/trilobite/libtrilobite/trilobite-core-distribut
	ion.h:
	Added a compact version of the distro names.

	* components/services/install/lib/makefile.staticlib.in:
	* nautilus-installer/src/Makefile:
	* nautilus-installer/src/Makefile.am:
	* nautilus-installer/src/installer.c: (installer), (oaf_init),
	(bonobo_init):
	* nautilus-installer/src/link.sh:
	* nautilus-installer/src/main.c: (main):
	* nautilus-installer/src/prescript:
	Updated the installer wrt the changes in libeazelinstall.
This commit is contained in:
Eskil Heyn Olsen 2000-08-02 04:31:38 +00:00
parent 7c6fcde57e
commit fe4f4c5942
27 changed files with 917 additions and 94 deletions

View file

@ -1,3 +1,91 @@
2000-08-01 Eskil Heyn Olsen <eskil@eazel.com>
* components/services/install/command-line/Makefile.am:
Added eazel-revert, should probably change name...
* components/services/install/command-line/eazel-alt-install-corba.c:
(done), (main):
Fixed type in the POPT options and the destruction of the
eazelinstall object.
* components/services/install/command-line/eazel-alt-install.c:
(main):
Tried to revive it, but dropped it. Probably would be a nice
feature, as to make a statically linked tool (see bug#1863).
* components/services/install/command-line/eazel-revert.c:
(set_parameters_from_command_line), (eazel_preflight_check_signal),
(eazel_download_progress_signal), (eazel_install_progress_signal),
(download_failed), (install_failed), (dep_check), (delete_files),
(done), (get_password_dude), (set_root_client), (main):
Did the first pass at a cli reversion tool.
* components/services/install/idl/trilobite-eazel-install.idl:
Removed some oneway statements and added the revert-transaction
call.
* components/services/install/lib/eazel-install-corba.c:
(impl_Eazel_Install_uninstall_packages),
(impl_Eazel_Install_revert_transaction), (eazel_install_get_epv):
* components/services/install/lib/eazel-install-corba-callback.h:
* components/services/install/lib/eazel-install-corba-callback.c:
(eazel_install_callback_destroy), (eazel_install_callback_query),
(eazel_install_callback_revert_transaction):
Added the revert-transaction hooks.
* components/services/install/lib/eazel-install-corba-types.c:
(corba_packagedatastruct_from_packagedata):
Updated for the changes to trilobite-distro-get-name
* components/services/install/lib/eazel-install-public.h:
* components/services/install/lib/eazel-install-object.c:
(eazel_install_destroy), (eazel_install_install_packages),
(eazel_install_uninstall_packages),
(eazel_install_revert_transaction_from_xmlstring):
install downloads the package list to the tmpdir. Added the code
to call the revert-transaction in rpm-glue.c
* components/services/install/lib/eazel-install-protocols.c:
(http_fetch_remote_file), (get_search_url_for_package):
First stuff for using lhamels rpmsearch cgi script.
* components/services/install/lib/eazel-install-rpm-glue.h:
* components/services/install/lib/eazel-install-rpm-glue.c:
(ei_get_packages_with_mod_flag), (ei_check_uninst_vs_downgrade),
(hest), (revert_transaction),
(eazel_install_do_rpm_transaction_save_report_helper),
(eazel_install_do_rpm_transaction_save_report),
(eazel_uninstall_upward_traverse):
Did bug#1586, 1818, 1820. Hest is a debug function, will go
away. The rest is code for the revert-transaction.
* components/services/install/lib/eazel-install-types.c:
(packagedata_fill_from_rpm_header):
Read the RPMTAG_SUMMARY instead of RPMTAG_DESCRIPTION.
* components/services/install/lib/eazel-install-xml-package-list.h:
* components/services/install/lib/eazel-install-xml-package-list.c:
(parse_package), (parse_memory_transaction_file),
(eazel_install_packagedata_to_xml):
Added code to parse a transaction file (bug#1817). Also some
sanity checks wrt reading the status fields.
* components/services/trilobite/libtrilobite/trilobite-core-distribut
ion.c: (trilobite_get_distribution_name):
* components/services/trilobite/libtrilobite/trilobite-core-distribut
ion.h:
Added a compact version of the distro names.
* components/services/install/lib/makefile.staticlib.in:
* nautilus-installer/src/Makefile:
* nautilus-installer/src/Makefile.am:
* nautilus-installer/src/installer.c: (installer), (oaf_init),
(bonobo_init):
* nautilus-installer/src/link.sh:
* nautilus-installer/src/main.c: (main):
* nautilus-installer/src/prescript:
Updated the installer wrt the changes in libeazelinstall.
2000-08-01 Robey Pointer <robey@eazel.com>
* components/services/install/server/Makefile.am:

View file

@ -30,12 +30,16 @@ LDADD = \
$(RPM_LIBS) \
$(NULL)
bin_PROGRAMS = eazel-install eazel-uninstall eazel-gen-xml eazel-package-query
bin_PROGRAMS = eazel-install eazel-uninstall eazel-gen-xml eazel-package-query eazel-revert
eazel_install_SOURCES = \
eazel-alt-install-corba.c \
$(NULL)
eazel_revert_SOURCES = \
eazel-revert.c \
$(NULL)
eazel_uninstall_SOURCES = \
eazel-uninstall.c \
$(NULL)

View file

@ -74,7 +74,7 @@ CORBA_Environment ev;
static const struct poptOption options[] = {
{"debug", 'd', POPT_ARG_NONE, &arg_debug, 0 , N_("Show debug output"), NULL},
{"delay", '\0', POPT_ARG_NONE, &arg_delay, 0 , N_("10 sec delay after starting service"), NULL},
{"port", '\0', POPT_ARG_NONE, &arg_port, 0 , N_("Set port numer (80)"), NULL},
{"port", '\0', POPT_ARG_INT, &arg_port, 0 , N_("Set port numer (80)"), NULL},
{"test", 't', POPT_ARG_NONE, &arg_dry_run, 0, N_("Test run"), NULL},
{"erase", 'e', POPT_ARG_NONE, &arg_erase, 0, N_("Erase packages"), NULL},
{"force", 'F', POPT_ARG_NONE, &arg_force, 0, N_("Force install"), NULL},
@ -340,7 +340,6 @@ done (EazelInstallCallback *service,
gpointer unused)
{
fprintf (stderr, "Installation Done\n");
eazel_install_callback_destroy (GTK_OBJECT (service));
gtk_main_quit ();
}
@ -461,6 +460,8 @@ int main(int argc, char *argv[]) {
fprintf (stdout, "\nEntering main loop...\n");
bonobo_main ();
eazel_install_callback_destroy (GTK_OBJECT (cb));
/* Corba cleanup */
CORBA_exception_free (&ev);

View file

@ -271,6 +271,14 @@ int main(int argc, char *argv[]) {
gnomelib_init ("Eazel Install", "1.0");
gnomelib_register_popt_table (options, "Eazel Install");
ctxt = gnomelib_parse_args (argc, argv, 0);
oaf_init (argc, argv);
if (bonobo_init (NULL, NULL, NULL) == FALSE) {
g_error ("Could not init bonobo");
}
bonobo_activate ();
packages = NULL;
categories = NULL;

View file

@ -0,0 +1,423 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
* 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: Eskil Heyn Olsen <eskil@eazel.com>
*
*/
#include <config.h>
#include <gnome.h>
#include <liboaf/liboaf.h>
#include <bonobo.h>
#include <sys/utsname.h>
#include <eazel-install-types.h>
#include <eazel-install-corba-types.h>
#include <eazel-install-corba-callback.h>
#include <libtrilobite/libtrilobite.h>
#include <trilobite-eazel-install.h>
#define PACKAGE_FILE_NAME "package-list.xml"
#define DEFAULT_CONFIG_FILE "/var/eazel/services/eazel-services-config.xml"
#define DEFAULT_HOSTNAME "testmachine.eazel.com"
#define DEFAULT_PORT_NUMBER 80
#define DEFAULT_PROTOCOL PROTOCOL_HTTP
#define DEFAULT_TMP_DIR "/tmp/eazel-install"
#define DEFAULT_RPMRC "/usr/lib/rpm/rpmrc"
#define DEFAULT_REMOTE_PACKAGE_LIST "/package-list.xml"
#define DEFAULT_REMOTE_RPM_DIR "/RPMS"
#define DEFAULT_LOG_FILE "/tmp/eazel-install/log"
/* This ensure that if the arch is detected as i[3-9]86, the
requested archtype will be set to i386 */
#define ASSUME_ix86_IS_i386
#define OAF_ID "OAFIID:trilobite_eazel_install_service:8ff6e815-1992-437c-9771-d932db3b4a17"
/* Popt stuff */
int arg_dry_run,
arg_http,
arg_ftp,
arg_local,
arg_debug,
arg_port,
arg_delay,
arg_file,
arg_force,
arg_upgrade,
arg_erase;
char *arg_server,
*arg_config_file,
*arg_tmp_dir;
CORBA_ORB orb;
CORBA_Environment ev;
static const struct poptOption options[] = {
{"debug", 'd', POPT_ARG_NONE, &arg_debug, 0 , N_("Show debug output"), NULL},
{"delay", '\0', POPT_ARG_NONE, &arg_delay, 0 , N_("10 sec delay after starting service"), NULL},
{"port", '\0', POPT_ARG_NONE, &arg_port, 0 , N_("Set port numer (80)"), NULL},
{"test", 't', POPT_ARG_NONE, &arg_dry_run, 0, N_("Test run"), NULL},
{"tmp", '\0', POPT_ARG_STRING, &arg_tmp_dir, 0, N_("Set tmp dir (/tmp/eazel-install)"), NULL},
{"server", '\0', POPT_ARG_STRING, &arg_server, 0, N_("Specify server"), NULL},
{"http", 'h', POPT_ARG_NONE, &arg_http, 0, N_("Use http"), NULL},
{"ftp", 'f', POPT_ARG_NONE, &arg_ftp, 0, N_("Use ftp"), NULL},
{"local", 'l', POPT_ARG_NONE, &arg_local, 0, N_("Use local"), NULL},
{"file",'\0', POPT_ARG_NONE, &arg_file, 0, N_("RPM args are filename"), NULL},
{"config", '\0', POPT_ARG_STRING, &arg_config_file, 0, N_("Specify config file (/var/eazel/services/eazel-services-config.xml)"), NULL},
{NULL, '\0', 0, NULL, 0}
};
#define check_ev(s) if (ev._major!=CORBA_NO_EXCEPTION) { g_warning ("%s: Caught exception %s", s, CORBA_exception_id (&ev)); }
static void
set_parameters_from_command_line (Trilobite_Eazel_Install service)
{
if (!arg_debug) {
Trilobite_Eazel_Install__set_log_file (service, DEFAULT_LOG_FILE, &ev);
check_ev ("set_log_file");
}
/* We only want 1 protocol type */
if (arg_http + arg_ftp + arg_local > 1) {
fprintf (stderr, "*** You cannot specify more then one protocol type.\n");
exit (1);
}
if (arg_http) {
Trilobite_Eazel_Install__set_protocol (service, Trilobite_Eazel_PROTOCOL_HTTP, &ev);
check_ev ("set_protocol");
} else if (arg_ftp) {
Trilobite_Eazel_Install__set_protocol (service, Trilobite_Eazel_PROTOCOL_FTP, &ev);
check_ev ("set_protocol");
} else if (arg_local) {
Trilobite_Eazel_Install__set_protocol (service, Trilobite_Eazel_PROTOCOL_LOCAL, &ev);
check_ev ("set_protocol");
} else {
Trilobite_Eazel_Install__set_protocol (service, Trilobite_Eazel_PROTOCOL_HTTP, &ev);
check_ev ("set_protocol");
}
if (arg_server == NULL) {
arg_server = g_strdup (DEFAULT_HOSTNAME);
}
if (arg_tmp_dir == NULL) {
arg_tmp_dir = g_strdup (DEFAULT_TMP_DIR);
}
if (arg_port == 0) {
arg_port = DEFAULT_PORT_NUMBER;
}
if (arg_dry_run) {
Trilobite_Eazel_Install__set_test_mode (service, TRUE, &ev);
}
if (arg_force) {
Trilobite_Eazel_Install__set_force (service, TRUE, &ev);
}
Trilobite_Eazel_Install__set_tmp_dir (service, arg_tmp_dir, &ev);
check_ev ("set_tmp_dir");
Trilobite_Eazel_Install__set_server (service, arg_server, &ev);
check_ev ("set_server");
Trilobite_Eazel_Install__set_server_port (service, arg_port, &ev);
check_ev ("set_server_port");
}
static void
eazel_preflight_check_signal (EazelInstallCallback *service,
int total_bytes,
int total_packages,
gpointer unused)
{
fprintf (stdout, "About to %s a total of %d packages, %dKb\n",
arg_erase ? "uninstall" : "install",
total_packages, total_bytes/1024);
}
static void
eazel_download_progress_signal (EazelInstallCallback *service,
const char *name,
int amount,
int total,
char *title)
{
if (amount==0) {
fprintf (stdout, "Downloading %s...\n", name);
} else if (amount != total ) {
fprintf (stdout, "(%d/%d) %% %f\r",
amount, total,
(float) (((float) amount * 100.0) / total));
fflush (stdout);
} else if (amount == total && total!=0) {
fprintf (stdout, "(%d/%d) %% %f\r",
amount, total, 100.0);
fprintf (stdout, "\nDone\n");
fflush (stdout);
}
}
static void
eazel_install_progress_signal (EazelInstallCallback *service,
const PackageData *pack,
int package_num, int num_packages,
int amount, int total,
int total_size_completed, int total_size,
char *title)
{
if (amount==0) {
fprintf (stdout, "%s %s: \"%20.20s\"...\n", title, pack->name, pack->summary);
} else if (amount != total ) {
fprintf (stdout, "(%d/%d), (%d/%d)b - (%d/%d) %% %f\r",
package_num, num_packages,
total_size_completed, total_size,
amount, total,
(float) (((float) amount * 100.0) / total));
fflush (stdout);
}
if (amount == total && total!=0) {
fprintf (stdout, "(%d/%d), (%d/%d)b - (%d/%d) %% %f\r",
package_num, num_packages,
total_size_completed, total_size,
amount, total, 100.0);
fprintf (stdout, "\nDone\n");
fflush (stdout);
}
}
static void
download_failed (EazelInstallCallback *service,
const char *name,
gpointer unused)
{
fprintf (stdout, "Download of %s FAILED\n", name);
}
/*
This dumps the entire tree for the failed package.
*/
static void
install_failed (EazelInstallCallback *service,
const PackageData *pd,
gchar *indent)
{
GList *iterator;
if (pd->toplevel) {
fprintf (stdout, "\n***The package %s failed. Here's the dep tree\n", pd->name);
}
switch (pd->status) {
case PACKAGE_DEPENDENCY_FAIL:
fprintf (stdout, "%s%s, which FAILED\n", indent, rpmfilename_from_packagedata (pd));
break;
case PACKAGE_CANNOT_OPEN:
fprintf (stdout, "%s%s,which was NOT FOUND\n", indent, rpmfilename_from_packagedata (pd));
break;
case PACKAGE_SOURCE_NOT_SUPPORTED:
fprintf (stdout, "%s%s, which is a source package\n", indent, rpmfilename_from_packagedata (pd));
break;
case PACKAGE_BREAKS_DEPENDENCY:
fprintf (stdout, "%s%s, which breaks deps\n", indent, rpmfilename_from_packagedata (pd));
break;
default:
fprintf (stdout, "%s%s\n", indent, rpmfilename_from_packagedata (pd));
break;
}
for (iterator = pd->soft_depends; iterator; iterator = iterator->next) {
PackageData *pack;
char *indent2;
indent2 = g_strconcat (indent, (iterator->next || pd->breaks) ? " |-d- " : " +-d- " , NULL);
pack = (PackageData*)iterator->data;
install_failed (service, pack, indent2);
g_free (indent2);
}
for (iterator = pd->breaks; iterator; iterator = iterator->next) {
PackageData *pack;
char *indent2;
indent2 = g_strconcat (indent, iterator->next ? " |-b- " : " +-b- " , NULL);
pack = (PackageData*)iterator->data;
install_failed (service, pack, indent2);
g_free (indent2);
}
for (iterator = pd->modifies; iterator; iterator = iterator->next) {
PackageData *pack;
char *indent2;
indent2 = g_strconcat (indent, iterator->next ? " |-m- " : " +-m- " , NULL);
pack = (PackageData*)iterator->data;
install_failed (service, pack, indent2);
g_free (indent2);
}
}
static void
dep_check (EazelInstallCallback *service,
const PackageData *package,
const PackageData *needs,
gpointer unused)
{
fprintf (stdout, "Doing dependency check for %s - need %s\n", package->name, needs->name);
}
static gboolean
delete_files (EazelInstallCallback *service, gpointer unused)
{
char answer[10];
printf ("should i delete the RPM files? (y/n) ");
fflush (stdout);
fgets (answer, 10, stdin);
if (answer[0] == 'y' || answer[0] == 'Y') {
printf ("you said: YES\n");
fflush (stdout);
return TRUE;
}
printf ("you said: NO\n");
fflush (stdout);
return FALSE;
}
static void
done (EazelInstallCallback *service,
int *calls)
{
(*calls) --;
fprintf (stderr, "Transaction done, %d left\n", *calls);
if (!(*calls)) {
gtk_main_quit ();
}
}
static char *
get_password_dude (TrilobiteRootClient *root_client, const char *prompt, void *user_data)
{
char password[80];
printf ("gimme %s's password : ", prompt);
fflush (stdout);
fgets (password, 80, stdin);
if (password[strlen (password) - 1] == '\n') {
password[strlen (password) - 1] = 0;
}
password[79] = 0;
return g_strdup (password);
}
static TrilobiteRootClient *
set_root_client (BonoboObjectClient *service)
{
TrilobiteRootClient *root_client;
if (bonobo_object_client_has_interface (service, "IDL:Trilobite/PasswordQuery:1.0", &ev)) {
root_client = trilobite_root_client_new ();
gtk_signal_connect (GTK_OBJECT (root_client), "need_password", GTK_SIGNAL_FUNC (get_password_dude),
NULL);
if (! trilobite_root_client_attach (root_client, service)) {
g_warning ("unable to attach root client to Trilobite/PasswordQuery!");
}
return root_client;
} else {
g_warning ("Object does not support IDL:Trilobite/PasswordQuery:1.0");
return NULL;
}
}
int main(int argc, char *argv[]) {
poptContext ctxt;
char *str;
GList *xmlfiles;
GList *iterator;
int calls;
EazelInstallCallback *cb;
CORBA_exception_init (&ev);
xmlfiles = NULL;
/* Seems that bonobo_main doens't like
not having gnome_init called, dies in a
X call, yech */
#if 1
gnome_init_with_popt_table ("Eazel Install", "1.0", argc, argv, options, 0, &ctxt);
#else
gtk_type_init ();
gnomelib_init ("Eazel Install", "1.0");
gnomelib_register_popt_table (options, "Eazel Install");
ctxt = gnomelib_parse_args (argc, argv, 0);
#endif
/* If there are more args, get them and parse them as xmlfiles */
while ((str = poptGetArg (ctxt)) != NULL) {
xmlfiles = g_list_prepend (xmlfiles, g_strdup (str));
}
if (xmlfiles == NULL) {
fprintf (stderr, "No transaction files provided ?\n");
exit (1);
}
/* Chech that we're root and on a redhat system */
if (check_for_root_user() == FALSE) {
fprintf (stderr, "*** This tool requires root access.\n");
}
if (check_for_redhat () == FALSE) {
fprintf (stderr, "*** This tool can only be used on RedHat.\n");
}
orb = oaf_init (argc, argv);
if (bonobo_init (NULL, NULL, NULL) == FALSE) {
g_error ("Could not init bonobo");
}
bonobo_activate ();
cb = eazel_install_callback_new ();
if (arg_delay) {
sleep (10);
}
calls = g_list_length (xmlfiles);
set_parameters_from_command_line (eazel_install_callback_corba_objref (cb));
set_root_client (eazel_install_callback_bonobo (cb));
gtk_signal_connect (GTK_OBJECT (cb), "download_progress", eazel_download_progress_signal, "Download progress");
gtk_signal_connect (GTK_OBJECT (cb), "preflight_check", eazel_preflight_check_signal, NULL);
gtk_signal_connect (GTK_OBJECT (cb), "install_progress", eazel_install_progress_signal, "Installing");
gtk_signal_connect (GTK_OBJECT (cb), "install_failed", install_failed, "");
gtk_signal_connect (GTK_OBJECT (cb), "uninstall_progress", eazel_install_progress_signal, "Uninstalling");
gtk_signal_connect (GTK_OBJECT (cb), "uninstall_failed", install_failed, "");
gtk_signal_connect (GTK_OBJECT (cb), "download_failed", download_failed, NULL);
gtk_signal_connect (GTK_OBJECT (cb), "dependency_check", dep_check, NULL);
gtk_signal_connect (GTK_OBJECT (cb), "delete_files", (void *)delete_files, NULL);
gtk_signal_connect (GTK_OBJECT (cb), "done", done, &calls);
for (iterator = xmlfiles; iterator; iterator = iterator->next) {
eazel_install_callback_revert_transaction (cb, iterator->data, &ev);
}
fprintf (stdout, "\nEntering main loop...\n");
bonobo_main ();
eazel_install_callback_destroy (GTK_OBJECT (cb));
/* Corba cleanup */
CORBA_exception_free (&ev);
return 0;
};

View file

@ -106,16 +106,16 @@ module Trilobite {
/* Called whenever a package (un)install fails
*/
oneway void download_failed (in string file);
void download_failed (in string file);
/* FIXME: bugzilla.eazel.com 1542
This is what they should be, but orbit-idl's lack of
recursive structures, forces us to encode the structures
as xml and transfer these instead.
oneway void install_failed (in PackageDataStruct package);
oneway void uninstall_failed (in PackageDataStruct package);
void install_failed (in PackageDataStruct package);
void uninstall_failed (in PackageDataStruct package);
*/
oneway void install_failed (in string xml_package);
oneway void uninstall_failed (in string xml_package);
void install_failed (in string xml_package);
void uninstall_failed (in string xml_package);
/* Called to find out whether to delete the rpms or not, after finishing */
boolean delete_files ();
@ -149,6 +149,9 @@ module Trilobite {
/* Run a query to the package sys */
PackageDataStructList query (in string query);
/* Revert a operation */
oneway void revert_transaction (in string xml, in InstallCallback cb);
};
};
};

View file

@ -244,14 +244,19 @@ eazel_install_callback_destroy (GtkObject *object)
g_return_if_fail (object != NULL);
g_return_if_fail (EAZEL_INSTALL_CALLBACK (object));
g_message ("in eazel_install_callback_destroy");
service = EAZEL_INSTALL_CALLBACK (object);
if (service->installservice_corba != CORBA_OBJECT_NIL) {
CORBA_Environment ev;
CORBA_exception_init (&ev);
bonobo_object_unref (BONOBO_OBJECT (service->installservice_bonobo));
Bonobo_Unknown_unref (service->installservice_corba, &ev);
CORBA_Object_release (service->installservice_corba, &ev);
CORBA_Object_release (service->installservice_corba, &ev);
CORBA_Object_release (service->cb, &ev);
CORBA_exception_free (&ev);
}
@ -259,6 +264,7 @@ eazel_install_callback_destroy (GtkObject *object)
if (GTK_OBJECT_CLASS (eazel_install_callback_parent_class)->destroy) {
GTK_OBJECT_CLASS (eazel_install_callback_parent_class)->destroy (object);
}
g_message ("out eazel_install_callback_destroy");
}
static void
@ -470,3 +476,25 @@ eazel_install_callback_query (EazelInstallCallback *service,
ev);
return result;
}
void
eazel_install_callback_revert_transaction (EazelInstallCallback *service,
char *xmlfile,
CORBA_Environment *ev)
{
xmlDocPtr doc;
xmlChar *mem;
int size;
CORBA_char *arg;
doc = xmlParseFile (xmlfile);
xmlDocDumpMemory (doc, &mem, &size);
arg = CORBA_string_dup (mem);
Trilobite_Eazel_Install_revert_transaction (service->installservice_corba,
arg,
service->cb,
ev);
CORBA_free (arg);
g_free (mem);
xmlFreeDoc (doc);
}

View file

@ -114,6 +114,9 @@ GList* eazel_install_callback_query (EazelInstallCallback *service,
char *query,
CORBA_Environment *ev);
void eazel_install_callback_revert_transaction (EazelInstallCallback *service,
char *xmlfile,
CORBA_Environment *ev);
/* Stuff */
GtkType eazel_install_callback_get_type (void);

View file

@ -54,11 +54,11 @@ corba_packagedatastruct_from_packagedata (const PackageData *pack)
if (pack->distribution.name == DISTRO_UNKNOWN) {
DistributionInfo dist;
dist = trilobite_get_distribution ();
corbapack.distribution.name = trilobite_get_distribution_name (dist, FALSE);
corbapack.distribution.name = trilobite_get_distribution_name (dist, FALSE, FALSE);
corbapack.distribution.major = dist.version_major;
corbapack.distribution.minor = dist.version_minor;
} else {
corbapack.distribution.name = trilobite_get_distribution_name (pack->distribution, FALSE);
corbapack.distribution.name = trilobite_get_distribution_name (pack->distribution, FALSE, FALSE);
corbapack.distribution.major = pack->distribution.version_major;
corbapack.distribution.minor = pack->distribution.version_minor;
}

View file

@ -104,7 +104,6 @@ impl_Eazel_Install_uninstall_packages(impl_POA_Trilobite_Eazel_Install *servant,
SET_CB (cb);
categories = NULL;
servant->object->callback = cb;
categories = categorydata_list_from_corba_categorystructlist (*corbacategories);
eazel_install_uninstall_packages (servant->object, categories);
@ -114,6 +113,20 @@ impl_Eazel_Install_uninstall_packages(impl_POA_Trilobite_Eazel_Install *servant,
return;
}
static void
impl_Eazel_Install_revert_transaction (impl_POA_Trilobite_Eazel_Install *servant,
const CORBA_char *xml,
const Trilobite_Eazel_InstallCallback cb,
CORBA_Environment * ev)
{
RELEASE_CB;
SET_CB (cb);
eazel_install_revert_transaction_from_xmlstring (servant->object, xml, strlen (xml));
return;
}
static void
impl_Eazel_Install__set_verbose (impl_POA_Trilobite_Eazel_Install *servant,
const CORBA_boolean value,
@ -320,6 +333,7 @@ eazel_install_get_epv ()
epv->uninstall = (gpointer)&impl_Eazel_Install_uninstall;
epv->install_packages = (gpointer)&impl_Eazel_Install_install_packages;
epv->uninstall_packages = (gpointer)&impl_Eazel_Install_uninstall_packages;
epv->revert_transaction = (gpointer)&impl_Eazel_Install_revert_transaction;
epv->_set_verbose = (gpointer)&impl_Eazel_Install__set_verbose;
epv->_get_verbose = (gpointer)&impl_Eazel_Install__get_verbose;

View file

@ -161,6 +161,8 @@ eazel_install_destroy (GtkObject *object)
{
EazelInstall *service;
g_message ("in eazel_install_destroy");
g_return_if_fail (object != NULL);
g_return_if_fail (EAZEL_INSTALL (object));
@ -186,6 +188,8 @@ eazel_install_destroy (GtkObject *object)
if (GTK_OBJECT_CLASS (eazel_install_parent_class)->destroy) {
GTK_OBJECT_CLASS (eazel_install_parent_class)->destroy (object);
}
g_message ("out eazel_install_destroy");
}
static void
@ -644,7 +648,11 @@ eazel_install_install_packages (EazelInstall *service, GList *categories)
}
if (categories == NULL && eazel_install_get_package_list (service) == NULL) {
eazel_install_set_package_list (service, "/var/eazel/services/package-list.xml");
char *tmp;
tmp = g_strdup_printf ("%s/package-list.xml", eazel_install_get_tmp_dir (service));
eazel_install_set_package_list (service, tmp);
g_free (tmp);
switch (service->private->iopts->protocol) {
case PROTOCOL_HTTP:
eazel_install_fetch_remote_package_list (service);
@ -719,6 +727,17 @@ eazel_install_uninstall_packages (EazelInstall *service, GList *categories)
eazel_install_emit_done (service);
}
void eazel_install_revert_transaction_from_xmlstring (EazelInstall *service,
char *xml, int size)
{
GList *packages;
packages = parse_memory_transaction_file (xml, size);
revert_transaction (service, packages);
eazel_install_emit_done (service);
}
/************************************************
Signal emitters and default handlers.
The default handlers check for the existance of

View file

@ -30,8 +30,14 @@
#include "eazel-install-private.h"
#include <config.h>
#include <sys/utsname.h>
#include <errno.h>
#define CGI_BASE "http://%s:%d/cgi-bin/rpmsearch.cgi"
/* This string defines the url for the rpmsearch cgi script.
It should contain a %s for the server name, and later
a %d for the portnumber. In this order, no other
order */
#define CGI_BASE "http://%s:%d/cgi-bin/rpmsearch.cgi"
/* #define CGI_BASE "http://%s:%d/catalog/find" */
gboolean http_fetch_remote_file (EazelInstall *service,
char* url,
@ -63,6 +69,18 @@ http_fetch_remote_file (EazelInstall *service,
g_message (_("Downloading %s..."), url);
if (! g_file_test (eazel_install_get_tmp_dir (service), G_FILE_TEST_ISDIR)) {
int retval;
retval = mkdir (eazel_install_get_tmp_dir (service), 0755);
if (retval < 0) {
if (errno != EEXIST) {
g_error (_("*** Could not create tmp directory (%s)! ***\n"),
eazel_install_get_tmp_dir (service));
}
}
}
file = fopen (target_file, "wb");
get_failed = 0;
length = -1;
@ -405,10 +423,18 @@ char* get_search_url_for_package (EazelInstall *service,
const gpointer data)
{
char *url;
DistributionInfo dist;
url = g_strdup_printf (CGI_BASE,
eazel_install_get_server (service),
eazel_install_get_server_port (service));
/*
FIXME: bugzilla.eazel.com 1333
We need to send distro name at some point. Depends on the rpmsearch cgi script
*/
dist = trilobite_get_distribution ();
switch (entry) {
case RPMSEARCH_ENTRY_NAME: {
PackageData *pack;
@ -417,6 +443,9 @@ char* get_search_url_for_package (EazelInstall *service,
add_to_url (&url, "?name=", pack->name);
add_to_url (&url, "&arch=", pack->archtype);
add_to_url (&url, "&version>=", pack->version);
if (pack->distribution.name != DISTRO_UNKNOWN) {
dist = pack->distribution;
}
}
break;
case RPMSEARCH_ENTRY_PROVIDES: {
@ -428,6 +457,16 @@ char* get_search_url_for_package (EazelInstall *service,
break;
}
/*
if (dist.name != DISTRO_UNKNOWN) {
char *distro;
distro = g_strdup_printf ("\"%s\"",
trilobite_get_distribution_name (dist, TRUE, TRUE));
add_to_url (&url, "&distro=", distro);
g_free (distro);
}
*/
switch (eazel_install_get_protocol (service)) {
case PROTOCOL_HTTP:
add_to_url (&url, "&protocol=", "http");
@ -438,18 +477,5 @@ char* get_search_url_for_package (EazelInstall *service,
default:
break;
}
/*
FIXME: bugzilla.eazel.com 1333
We need to send distro name at some point. Depends on the rpmsearch cgi script
*/
/*
if (pack->name != DISTRO_UNKNOWN) {
char *distro;
distro = g_strdup_printf ("\"%s\"",
trilobite_get_distribution_name (pack->distribution, TRUE));
add_to_url (&url, "&distro=", distro);
g_free (distro);
}
*/
return url;
}

View file

@ -151,6 +151,8 @@ GList* eazel_install_query_package_system (EazelInstall *service,
const char *query,
int flags) ;
void eazel_install_revert_transaction_from_xmlstring (EazelInstall *service, char *xml, int size);
/******************************************************************************/
/* Beware, from hereonafter, it's #def madness, to make the get/set functions */

View file

@ -36,7 +36,12 @@
#include "eazel-install-query.h"
#ifndef EAZEL_INSTALL_NO_CORBA
#include <libtrilobite/libtrilobite.h>
#else
#include <libtrilobite/trilobite-root-helper.h>
#endif
#include <libtrilobite/libtrilobite-service.h>
#include <rpm/rpmlib.h>
#include <rpm/rpmmacro.h>
@ -330,6 +335,96 @@ uninstall_packages (EazelInstall *service,
} /* end install_new_packages */
GList *
ei_get_packages_with_mod_flag (GList *packages,
PackageModification mod)
{
GList *it;
GList *res;
res = NULL;
for (it = packages; it; it = it->next) {
PackageData *pack;
pack = (PackageData*)it->data;
if (pack->modify_status == mod) {
res = g_list_prepend (res, pack);
}
if (pack->soft_depends) {
res = g_list_concat (res,
ei_get_packages_with_mod_flag (pack->soft_depends, mod));
}
if (pack->modifies) {
res = g_list_concat (res,
ei_get_packages_with_mod_flag (pack->modifies, mod));
}
}
return res;
}
/* Function to prune the uninstall list for elements marked as downgrade */
void
ei_check_uninst_vs_downgrade (GList **inst,
GList **down)
{
GList *it;
GList *remove;
remove = NULL;
for (it = *inst; it; it = it->next) {
GList *entry;
PackageData *pack;
pack = (PackageData*)it->data;
entry = g_list_find_custom (*down, pack->name, (GCompareFunc)eazel_install_package_name_compare);
if (entry != NULL) {
remove = g_list_prepend (remove, it->data);
}
}
for (it = remove; it; it = it->next) {
(*inst) = g_list_remove (*inst, it->data);
}
}
void hest (PackageData *pack, char *str) {
g_message ("Must %s %s", str, pack->name);
}
gboolean
revert_transaction (EazelInstall *service,
GList *packages)
{
GList *uninst, *inst, *upgrade, *downgrade;
CategoryData *cat;
GList *categories;
uninst = ei_get_packages_with_mod_flag (packages, PACKAGE_MOD_INSTALLED);
inst = ei_get_packages_with_mod_flag (packages, PACKAGE_MOD_UNINSTALLED);
upgrade = ei_get_packages_with_mod_flag (packages, PACKAGE_MOD_DOWNGRADED);
downgrade = ei_get_packages_with_mod_flag (packages, PACKAGE_MOD_UPGRADED);
ei_check_uninst_vs_downgrade (&uninst, &downgrade);
g_list_foreach (uninst, (GFunc)hest, "uninstall");
g_list_foreach (inst, (GFunc)hest, "install");
g_list_foreach (downgrade, (GFunc)hest, "downgrade");
g_list_foreach (upgrade, (GFunc)hest, "upgrade");
cat = g_new0 (CategoryData, 1);
categories = g_list_prepend (NULL, cat);
if (uninst) {
eazel_install_set_uninstall (service, TRUE);
cat->packages = uninst;
uninstall_packages (service, categories);
}
if (inst) {
eazel_install_set_uninstall (service, FALSE);
cat->packages = inst;
install_new_packages (service, categories);
}
}
static void
eazel_install_do_rpm_transaction_fill_hash (EazelInstall *service,
GList *packages)
@ -494,11 +589,38 @@ eazel_install_do_rpm_transaction_process_pipe (EazelInstall *service,
fclose (pipe);
}
static void
eazel_install_do_rpm_transaction_save_report_helper (xmlNodePtr node,
GList *packages)
{
GList *iterator;
for (iterator = packages; iterator; iterator = iterator->next) {
PackageData *pack;
char *tmp;
pack = (PackageData*)iterator->data;
switch (pack->modify_status) {
case PACKAGE_MOD_INSTALLED:
tmp = g_strdup_printf ("Installed %s", pack->name);
xmlNewChild (node, NULL, "DESCRIPTION", tmp);
g_free (tmp);
break;
case PACKAGE_MOD_UNINSTALLED:
tmp = g_strdup_printf ("Uninstalled %s", pack->name);
xmlNewChild (node, NULL, "DESCRIPTION", tmp);
g_free (tmp);
break;
}
if (pack->modifies) {
eazel_install_do_rpm_transaction_save_report_helper (node, pack->modifies);
}
}
}
static void
eazel_install_do_rpm_transaction_save_report (EazelInstall *service)
{
FILE *outfile;
GList *iterator;
xmlDocPtr doc;
xmlNodePtr node, root;
char *name;
@ -536,23 +658,7 @@ eazel_install_do_rpm_transaction_save_report (EazelInstall *service)
g_free (tmp);
}
for (iterator = service->private->transaction; iterator; iterator = iterator->next) {
PackageData *pack;
char *tmp;
pack = (PackageData*)iterator->data;
switch (pack->modify_status) {
case PACKAGE_MOD_INSTALLED:
tmp = g_strdup_printf ("Installed %s", pack->name);
xmlNewChild (node, NULL, "DESCRIPTION", tmp);
g_free (tmp);
break;
case PACKAGE_MOD_UNINSTALLED:
tmp = g_strdup_printf ("Uninstalled %s", pack->name);
xmlNewChild (node, NULL, "DESCRIPTION", tmp);
g_free (tmp);
break;
}
}
eazel_install_do_rpm_transaction_save_report_helper (node, service->private->transaction);
xmlDocDump (outfile, doc);
@ -1499,7 +1605,7 @@ eazel_uninstall_upward_traverse (EazelInstall *service,
service->private->packsys.rpm.set = rpmtransCreateSet (service->private->packsys.rpm.db, "/");
/* Add all packages to the set */
eazel_install_add_to_set (service, packages, failed);
/* eazel_install_add_to_set (service, packages, failed); */
for (iterator = *packages; iterator; iterator = iterator->next) {
PackageData *pack;

View file

@ -34,5 +34,6 @@
gboolean install_new_packages (EazelInstall *service, GList *categories);
gboolean uninstall_packages (EazelInstall *service, GList *categories);
gboolean revert_transaction (EazelInstall *service, GList *packages);
#endif /* EAZEL_INSTALL_RPM_GLUE_H */

View file

@ -154,7 +154,7 @@ packagedata_fill_from_rpm_header (PackageData *pack,
(void **) &sizep, NULL);
pack->bytesize = *sizep;
headerGetEntry (*hd,
RPMTAG_DESCRIPTION, NULL,
RPMTAG_SUMMARY, NULL,
(void **) &pack->summary, NULL);
pack->packsys_struc = (gpointer)hd;

View file

@ -49,7 +49,9 @@ parse_package (xmlNode* package, gboolean set_toplevel) {
rv->version = g_strdup (xml_get_value (package, "VERSION"));
rv->minor = g_strdup (xml_get_value (package, "MINOR"));
rv->archtype = g_strdup (xml_get_value (package, "ARCH"));
rv->status = packagedata_status_str_to_enum (xml_get_value (package, "STATUS"));
if (xml_get_value (package, "STATUS")) {
rv->status = packagedata_status_str_to_enum (xml_get_value (package, "STATUS"));
}
if (xml_get_value (package, "MODSTATUS")) {
rv->modify_status = packagedata_modstatus_str_to_enum (xml_get_value (package, "MODSTATUS"));
}
@ -191,6 +193,49 @@ GList* parse_memory_xml_package_list (char *mem, int size) {
return parse_shared (doc);
}
GList*
parse_memory_transaction_file (char *mem,
int size)
{
xmlDocPtr doc;
xmlNodePtr base;
xmlNodePtr packages;
GList* rv;
g_return_val_if_fail (mem!=NULL, NULL);
doc = xmlParseMemory (mem, size);
rv = NULL;
if (doc == NULL) {
xmlFreeDoc (doc);
return NULL;
}
base = doc->root;
if (g_strcasecmp (base->name, "TRANSACTION")) {
g_print (_("*** Cannot find the TRANSACTION xmlnode! ***\n"));
xmlFreeDoc (doc);
g_warning (_("*** Bailing from transaction parse! ***\n"));
return NULL;
}
packages = doc->root->childs->childs;
if(packages == NULL) {
g_print (_("*** No packages! ***\n"));
xmlFreeDoc (doc);
g_warning (_("*** Bailing from transaction parse! ***\n"));
return NULL;
}
while (packages) {
PackageData *pack;
pack = parse_package (packages, TRUE);
g_message ("TRANS PARSE %s", pack->name);
rv = g_list_append (rv, pack);
packages = packages->next;
}
}
GList*
parse_local_xml_package_list (const char* pkg_list_file) {
xmlDocPtr doc;
@ -361,7 +406,7 @@ eazel_install_packagedata_to_xml (const PackageData *pack, char *title, xmlNodeP
node = xmlNewChild (root, NULL, "STATUS", packagedata_status_enum_to_str (pack->status));
node = xmlNewChild (root, NULL, "MODSTATUS", packagedata_modstatus_enum_to_str (pack->modify_status));
tmp = trilobite_get_distribution_name(pack->distribution, FALSE);
tmp = trilobite_get_distribution_name(pack->distribution, FALSE, FALSE);
node = xmlNewChild (root, NULL, "DISTRIBUTION", tmp);
g_free (tmp);
if (pack->distribution.version_major!=-1) {

View file

@ -37,6 +37,8 @@
GList* parse_memory_xml_package_list (char *mem, int size);
GList* parse_local_xml_package_list (const char* pkg_list_file);
GList* parse_memory_transaction_file (char *mem, int size);
void free_categories (GList* categories);
gboolean generate_xml_package_list (const char* pkg_template_file,
const char* target_file);

View file

@ -18,7 +18,6 @@ INCLUDES=\
@GCONF_CFLAGS@ \
@XML_CFLAGS@ \
@GHTTP_CFLAGS@ \
@WERROR@ \
$(NULL)
LIB=libeazelinstall_minimal.a

View file

@ -36,7 +36,7 @@
#include <string.h>
#define RHAT "Red Hat Linux"
#define RHAT "RedHat Linux"
#define DEBI "Debian GNU/Linux"
#define CALD "Caldera"
#define SUSE "S.u.S.E"
@ -44,7 +44,17 @@
#define TURB "TurboLinux"
#define CORL "CorelLinux"
#define MAND "Mandrake"
#define UNKW "unkown"
#define UNKW "unknown"
#define RHATc "RedHat"
#define DEBIc "Debian"
#define CALDc "Caldera"
#define SUSEc "S.u.S.E"
#define LPPCc "LinuxPPC"
#define TURBc "TurboLinux"
#define CORLc "CorelLinux"
#define MANDc "Mandrake"
#define UNKWc "unknown"
/* FIXME bugzilla.eazel.com 908
need to implement the rest of the determine_FOO_version
@ -165,7 +175,8 @@ trilobite_get_distribution ()
char*
trilobite_get_distribution_name (DistributionInfo distinfo,
gboolean show_version)
gboolean show_version,
gboolean compact)
{
char *result;
char *name;
@ -176,42 +187,54 @@ trilobite_get_distribution_name (DistributionInfo distinfo,
arch = g_strdup (""); /* We don't set the arch type yet */
switch (distinfo.name) {
case DISTRO_REDHAT:
name = g_strdup (RHAT);
case DISTRO_REDHAT:
name = g_strdup (compact ? RHATc : RHAT);
break;
case DISTRO_DEBIAN:
name = g_strdup (DEBI);
name = g_strdup (compact ? DEBIc : DEBI);
break;
case DISTRO_CALDERA:
name = g_strdup (CALD);
name = g_strdup (compact ? CALDc : CALD);
break;
case DISTRO_SUSE:
name = g_strdup (SUSE);
name = g_strdup (compact ? SUSEc : SUSE);
break;
case DISTRO_LINUXPPC:
name = g_strdup (LPPC);
name = g_strdup (compact ? LPPCc : LPPC);
break;
case DISTRO_TURBOLINUX:
name = g_strdup (TURB);
name = g_strdup (compact ? TURBc : TURB);
break;
case DISTRO_COREL:
name = g_strdup (CORL);
name = g_strdup (compact ? CORLc : CORL);
break;
case DISTRO_MANDRAKE:
name = g_strdup (MAND);
name = g_strdup (compact ? MANDc : MAND);
break;
default:
name = g_strdup (UNKW);
name = g_strdup (compact ? UNKWc : UNKW);
break;
}
if (show_version) {
if (distinfo.version_major >= 0 && distinfo.version_minor >= 0) {
g_free (version);
version = g_strdup_printf (" %d.%d", distinfo.version_major, distinfo.version_minor);
if (compact) {
version = g_strdup_printf ("%d%d",
distinfo.version_major,
distinfo.version_minor);
} else {
version = g_strdup_printf (" %d.%d",
distinfo.version_major,
distinfo.version_minor);
}
} else if (distinfo.version_major >= 0) {
g_free (version);
version = g_strdup_printf (" %d", distinfo.version_major);
if (compact) {
version = g_strdup_printf ("%d", distinfo.version_major);
} else {
version = g_strdup_printf (" %d", distinfo.version_major);
}
}
}

View file

@ -57,7 +57,8 @@ DistributionInfo trilobite_get_distribution (void);
Return value must be freed
*/
char* trilobite_get_distribution_name (DistributionInfo distinfo,
gboolean show_version);
gboolean show_version,
gboolean compact);
/*
Returns the enum corresponding to the given string,

View file

@ -61,8 +61,8 @@ host_alias = i686-pc-linux-gnu
host_triplet = i686-pc-linux-gnu
AS = @AS@
BONOBO_CFLAGS = -I/gnome/include -DNEED_GNOMESUPPORT_H -I/gnome/lib/gnome-libs/include -I/gnome/lib/glib/include -I/usr/X11R6/include -I/gnome/include/gnome-xml
BONOBO_LIBS = -rdynamic -L/gnome/lib -L/usr/X11R6/lib -L/usr/lib -lbonobo -lgnomeprint -lgnomeui -lart_lgpl -lgdk_imlib -lSM -lICE -lgnome -lgnomesupport -lesd -laudiofile -ldb1 -lgdk_pixbuf -ltiff -ljpeg -lpng -lgtk -lgdk -lgmodule -ldl -lXext -lX11 -lxml -lz -loaf -lORBitCosNaming -lORBit -lIIOP -lORBitutil -lglib -lnsl -lm
CATALOGS =
BONOBO_LIBS = -rdynamic -L/gnome/lib -L/usr/X11R6/lib -L/usr/lib -lbonobo -lgdk_pixbuf -ltiff -ljpeg -lpng -lgnomeprint -lgnomeui -lart_lgpl -lgdk_imlib -lSM -lICE -lgtk -lgdk -lgmodule -lXext -lX11 -lgnome -lgnomesupport -lesd -laudiofile -ldb1 -ldl -lxml -lz -loaf -lORBitCosNaming -lORBit -lIIOP -lORBitutil -lglib -lnsl -lm
CATALOGS = da.gmo de.gmo fr.gmo gl.gmo ja.gmo ko.gmo no.gmo ru.gmo sv.gmo tr.gmo
CATOBJEXT = .gmo
CC = gcc
CPP = gcc -E
@ -70,9 +70,9 @@ CXX = c++
DATADIRNAME = share
DLLTOOL = @DLLTOOL@
EAZEL_SERVICES = 1
GCONF_CFLAGS = -I/gnome/include -I/gnome/lib/glib/include -I/usr/X11R6/include
GCONF_CFLAGS = -I/gnome/include/gconf/1 -I/gnome/include -I/gnome/lib/glib/include -I/usr/X11R6/include
GCONF_CONFIG = /gnome/bin/gconf-config
GCONF_LIBS = -rdynamic -L/gnome/lib -L/usr/X11R6/lib -lgconf-gtk -lgconf -loaf -lORBitCosNaming -lORBit -lIIOP -lORBitutil -lnsl -lgtk -lgdk -lgmodule -lglib -ldl -lXext -lX11 -lm
GCONF_LIBS = -rdynamic -L/gnome/lib -L/usr/X11R6/lib -lgconf-gtk-1 -lgconf-1 -loaf -lORBitCosNaming -lORBit -lIIOP -lORBitutil -lnsl -lgtk -lgdk -lgmodule -lglib -ldl -lXext -lX11 -lm
GDK_PIXBUF_CFLAGS = -I/gnome/include -I/gnome/lib/glib/include -I/gnome/include -I/usr/X11R6/include
GDK_PIXBUF_CONFIG = /gnome/bin/gdk-pixbuf-config
GDK_PIXBUF_LIBS = -L/gnome/lib -lgdk_pixbuf -L/gnome/lib -L/usr/X11R6/lib -lgtk -lgdk -rdynamic -lgmodule -lglib -ldl -lXext -lX11 -lm
@ -94,8 +94,8 @@ GNOME_CONFIG = /gnome/bin/gnome-config
GNOME_LIBS = -L/gnome/lib -L/usr/lib -lgnome -lgnomesupport -lesd -laudiofile -lm -ldb1 -lglib -ldl
GNORBA_CFLAGS =
GNORBA_LIBS =
GTKHTML_CFLAGS = -I/gnome/include -I/gnome/lib/glib/include -I/usr/X11R6/include -DNEED_GNOMESUPPORT_H -I/gnome/lib/gnome-libs/include -I/gnome/include/gnome-xml -DGTKHTML_HAVE_GCONF
GTKHTML_LIBS = -rdynamic -L/gnome/lib -L/usr/X11R6/lib -L/usr/lib -lgtkhtml -lgnomeprint -lgnomeui -lart_lgpl -lgdk_imlib -lSM -lICE -lgnome -lgnomesupport -lesd -laudiofile -ldb1 -lgdk_pixbuf -ltiff -ljpeg -lpng -lxml -lz -lgconf-gtk -lgconf -loaf -lORBitCosNaming -lORBit -lIIOP -lORBitutil -lnsl -lgtk -lgdk -lgmodule -lglib -ldl -lXext -lX11 -lm
GTKHTML_CFLAGS = -I/gnome/include -I/gnome/lib/glib/include -I/usr/X11R6/include -DNEED_GNOMESUPPORT_H -I/gnome/lib/gnome-libs/include -I/gnome/include/gnome-xml
GTKHTML_LIBS = -rdynamic -L/gnome/lib -L/usr/X11R6/lib -L/usr/lib -lgtkhtml -lgdk_pixbuf -ltiff -ljpeg -lpng -lgnomeprint -lgnomeui -lart_lgpl -lgdk_imlib -lSM -lICE -lgtk -lgdk -lgmodule -lXext -lX11 -lgnome -lgnomesupport -lesd -laudiofile -lm -ldb1 -lglib -ldl -lxml -lz
GTK_CFLAGS =
GTK_LIBS =
GT_NO =
@ -115,6 +115,8 @@ LIBWWW_LIBS = -L/usr/lib -lmd5 -lwwwxml -lxmltok -lxmlparse -lwwwzip -lwwwinit -
LN_S = ln -s
MAINT =
MAKEINFO = makeinfo
MEDUSA_CFLAGS = -I/gnome/include -I/gnome/lib/vfs/include -I/gnome/lib/glib/include -D_REENTRANT
MEDUSA_LIBS = -rdynamic -L/gnome/lib -lmedusa -lgnomevfs -lgmodule -lgthread -lglib -lpthread -ldl
MKINSTALLDIRS = ./mkinstalldirs
MOZILLA_COMPONENT_CFLAGS = -I/usr/include/mozilla
MOZILLA_COMPONENT_LDFLAGS = -L/usr/lib/mozilla
@ -139,7 +141,6 @@ USE_NLS = yes
VERSION = 0.1.0
VFS_CFLAGS = -I/gnome/include -I/gnome/lib/vfs/include -I/gnome/lib/glib/include -D_REENTRANT
VFS_LIBS = -rdynamic -L/gnome/lib -lgnomevfs -lgmodule -lgthread -lglib -lpthread -ldl
WERROR = -Werror
XML_CFLAGS = -I/gnome/include/gnome-xml
XML_CONFIG = /gnome/bin/xml-config
XML_LIBS = -L/gnome/lib -lxml -lz
@ -155,7 +156,7 @@ INCLUDES = -I$(top_srcdir)/components/services/install/lib -I$(top_srcdir)/c
CPPFLAGS = -DEAZEL_INSTALL_NO_CORBA
CFLAGS = -g $(WERROR)
CFLAGS = -g
bin_PROGRAMS = nautilus-installer
@ -164,7 +165,7 @@ nautilus_installer_SOURCES = main.c support.c support.h interface.c interfac
nautilus_installer_LDFLAGS = -static
nautilus_installer_LDADD = $(top_builddir)/components/services/trilobite/libtrilobite/helixcode-utils.o $(top_builddir)/components/services/trilobite/libtrilobite/trilobite-core-distribution.o $(top_builddir)/components/services/install/lib/libeazelinstall_minimal.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
nautilus_installer_LDADD = $(top_builddir)/components/services/trilobite/libtrilobite/helixcode-utils.o $(top_builddir)/components/services/trilobite/libtrilobite/trilobite-core-distribution.o $(top_builddir)/components/services/install/lib/libeazelinstall_minimal.a $(top_builddir)/components/services/trilobite/libtrilobite/trilobite-root-helper.o $(top_builddir)/components/services/trilobite/libtrilobite/trilobite-core-utils.o -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
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
@ -181,6 +182,8 @@ nautilus_installer_DEPENDENCIES = \
$(top_builddir)/components/services/trilobite/libtrilobite/helixcode-utils.o \
$(top_builddir)/components/services/trilobite/libtrilobite/trilobite-core-distribution.o \
$(top_builddir)/components/services/install/lib/libeazelinstall_minimal.a \
$(top_builddir)/components/services/trilobite/libtrilobite/trilobite-root-helper.o \
$(top_builddir)/components/services/trilobite/libtrilobite/trilobite-core-utils.o \
/usr/lib/libesd.a /usr/lib/libaudiofile.a
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)

View file

@ -34,6 +34,8 @@ nautilus_installer_LDADD = \
$(top_builddir)/components/services/trilobite/libtrilobite/helixcode-utils.o \
$(top_builddir)/components/services/trilobite/libtrilobite/trilobite-core-distribution.o \
$(top_builddir)/components/services/install/lib/libeazelinstall_minimal.a \
$(top_builddir)/components/services/trilobite/libtrilobite/trilobite-root-helper.o \
$(top_builddir)/components/services/trilobite/libtrilobite/trilobite-core-utils.o \
-L/gnome/lib \
-lgnomeui \
-lgnome \

View file

@ -34,6 +34,9 @@ static char *package_list[LAST] = {
};
char *failure_info;
int installer_debug;
int installer_test;
static void
eazel_install_progress (EazelInstall *service,
@ -213,12 +216,20 @@ void installer (GtkWidget *window,
gnome_warning_dialog ("We don't do UPGRADE yet");
return;
}
if (!installer_test) {
GnomeDialog *d;
d = GNOME_DIALOG (gnome_warning_dialog_parented (_("This is a warning, you're running\n"
"the installer for real, without \n"
"the --test flag... Beware!"),
GTK_WINDOW (window)));
gnome_dialog_run_and_close (d);
}
service = EAZEL_INSTALL (gtk_object_new (TYPE_EAZEL_INSTALL,
"verbose", TRUE,
"silent", FALSE,
"debug", TRUE,
"test", check_for_root_user () ? FALSE : TRUE,
"test", TRUE, //installer_test () ? FALSE : TRUE,
"force", TRUE,
"depend", FALSE,
"update", TRUE,
@ -241,6 +252,9 @@ void installer (GtkWidget *window,
eazel_install_set_tmp_dir (service, TMP_DIR);
eazel_install_set_server_port (service, PORT_NUMBER);
eazel_install_set_protocol (service, PROTOCOL);
if (!installer_debug) {
eazel_install_open_log (service, "/tmp/nautilus-install.log");
}
g_assert (service != NULL);
@ -274,3 +288,10 @@ void installer (GtkWidget *window,
gnome_error_dialog_parented (failure_info, GTK_WINDOW (window));
}
}
/* Dummy functions to make linking work */
const gpointer oaf_popt_options = NULL;
gpointer oaf_init (int argc, char *argv[]) {}
int bonobo_init (gpointer a, gpointer b, gpointer c) {};

View file

@ -9,9 +9,11 @@ popd
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/install/lib/libeazelinstall_minimal.a \
../../components/services/trilobite/libtrilobite/helixcode-utils.o \
../../components/services/trilobite/libtrilobite/trilobite-core-distribution.o \
../../components/services/install/lib/libeazelinstall_minimal.a \
../../components/services/trilobite/libtrilobite/trilobite-root-helper.o \
../../components/services/trilobite/libtrilobite/trilobite-core-utils.o \
-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 -lbz2 -lz -ldb1 -lpopt -lxml

View file

@ -14,6 +14,15 @@
#include "callbacks.h"
#include <libtrilobite/helixcode-utils.h>
extern int installer_debug;
extern int installer_test;
static const struct poptOption options[] = {
{"debug", 'd', POPT_ARG_NONE, &installer_debug, 0 , N_("Show debug output"), NULL},
{"test", 't', POPT_ARG_NONE, &installer_test, 0, N_("Test run"), NULL},
{NULL, '\0', 0, NULL, 0}
};
int
main (int argc, char *argv[])
{
@ -23,8 +32,7 @@ main (int argc, char *argv[])
bindtextdomain ("nautilus-installer", GNOMELOCALEDIR);
textdomain ("nautilus-installer");
#endif
gnome_init ("nautilus-installer", VERSION, argc, argv);
gnome_init_with_popt_table ("nautilus-installer", VERSION, argc, argv, options, 0, NULL);
/*
* The following code was added by Glade to create one of each component
@ -34,16 +42,6 @@ main (int argc, char *argv[])
window = create_window ();
set_images (window);
if (check_for_root_user ()==FALSE) {
GnomeDialog *d;
d = GNOME_DIALOG (gnome_error_dialog_parented ("I'll bring my axe and ore and beat you...\n"
"This means you should run this as root.\n\n"
"But we're reasonable, so you get to continue,\n"
"but the test flag will be enabled",
GTK_WINDOW (window)));
gnome_dialog_run_and_close (d);
}
gtk_widget_show (window);
gtk_main ();

View file

@ -1,20 +1,21 @@
if test x$DISPLAY = x; then
echo "The Nautilus-Installer requires X"
fi
if test $UID -ne 0; then
if ! test -d /var/eazel/services; then
echo ""
echo "Nautilus-Installer v 0.1d"
echo ""
echo "argle bargle glob glyf muhainapuniua bork bork bork"
echo "fisk er dumme og heste er grimme"
echo ""
echo "The Nautilus-Installer requires superuser access to install packages."
echo "The Nautilus-Installer requires superuser access to prepare the system"
echo "It needs to create a few administrative directories on in /var and"
echo "yadayada insecure yadayada trust us blablabla"
echo "we would never hurt a fly arglebargle."
echo ""
echo "Please enter root password at the prompt"
xhost + localhost
su - -c "export DISPLAY=$DISPLAY && cd $PWD && echo Uncompressing... && sh $0 $USER"
xhost - localhost
su - -c "mkdir /var/eazel && mkdir /var/eazel/services"
echo Uncompressing...
sh $0 $* $USER
exit
fi