1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
/* -*- 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>
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifndef BUILD_DATE
#define BUILD_DATE "unknown"
#endif
#include <pwd.h>
#include <sys/types.h>
#include <gnome.h>
#include "installer.h"
#include "support.h"
#include "callbacks.h"
#include <libtrilobite/helixcode-utils.h>
extern int installer_debug;
extern int installer_output;
extern int installer_test;
extern int installer_force;
extern int installer_dont_ask_questions;
extern char *installer_server;
extern int installer_server_port;
extern char* installer_local;
extern char* installer_package;
extern char* installer_cgi_path;
extern char* installer_tmpdir;
extern char* installer_homedir;
static int installer_show_build = 0;
static char *installer_user = NULL;
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 the installer without actually installing packages"), NULL},
{"force", 'f', POPT_ARG_NONE, &installer_force, 0, N_("Forced install"), NULL},
{"local", '\0', POPT_ARG_STRING, &installer_local, 0, N_("Use local RPMs instead of HTTP server"), "XML-file"},
{"server", '\0', POPT_ARG_STRING, &installer_server, 0, N_("Specify Eazel installation server"), NULL},
{"tmpdir", '\0', POPT_ARG_STRING, &installer_tmpdir, 0, N_("Specify download dir"), NULL},
{"homedir", '\0', POPT_ARG_STRING|POPT_ARGFLAG_DOC_HIDDEN, &installer_homedir, 0, "", NULL},
{"user", '\0', POPT_ARG_STRING|POPT_ARGFLAG_DOC_HIDDEN, &installer_user, 0, "", NULL},
{"package", '\0', POPT_ARG_STRING, &installer_package, 0 , N_("Install package"), NULL},
{"port", '\0', POPT_ARG_INT, &installer_server_port, 0 , N_("Set port number for Eazel installation server (default: 80)"), NULL},
{"cgi-path", '\0', POPT_ARG_STRING, &installer_cgi_path, 0, N_("Specify CGI path for Eazel installation server"), NULL},
{"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},
{NULL, '\0', 0, NULL, 0}
};
int
main (int argc, char *argv[])
{
EazelInstaller *installer;
char *fake_argv0 = "eazel-installer.sh";
#ifdef ENABLE_NLS
bindtextdomain ("eazel-installer", GNOMELOCALEDIR);
textdomain ("eazel-installer");
#endif
argv[0] = fake_argv0;
if (strcmp (argv[1], "--build") == 0) {
/* skip the crap. */
printf ("\nEazel Installer v%s (build %s)\n\n", VERSION, BUILD_DATE);
exit (0);
}
gnome_init_with_popt_table ("eazel-installer", VERSION, argc, argv, options, 0, NULL);
if (installer_show_build) {
printf ("\nEazel Installer v%s (build %s)\n\n", VERSION, BUILD_DATE);
exit (0);
}
if (installer_user == NULL) {
printf ("\nThe --user flag is mandatory.\n");
exit (0);
}
if (installer_homedir == NULL) {
struct passwd *passwd_entry;
passwd_entry = getpwnam (installer_user);
if (passwd_entry != NULL) {
installer_homedir = g_strdup (passwd_entry->pw_dir);
} else {
/* give up */
printf ("*** Unable to find user's homedir: using '/'\n");
installer_homedir = g_strdup ("/");
}
}
installer = eazel_installer_new ();
gtk_main ();
gtk_object_unref (GTK_OBJECT (installer->service));
gtk_object_unref (GTK_OBJECT (installer->problem));
printf ("Exiting\n");
g_mem_profile ();
return 0;
}
/* Dummy functions to make linking work
(this is the type of code your mother warned you about) */
const gpointer oaf_popt_options = NULL;
gpointer oaf_init (int argc, char *argv[]) { return NULL; }
int bonobo_init (gpointer a, gpointer b, gpointer c) { return 0; };
char *nautilus_pixmap_file (const char *a) { return NULL; };
/* stub out esound */
int esd_open_sound (const char *host) { return -1; }
int esd_sample_getid (int esd, const char *name) { return -1; }
int esd_sample_play (int esd, int sample) { return -1; }
int esd_sample_cache (int esd, void *format, const int rate, const int length, const char *name) { return -1; }
int esd_sample_free (int esd, int sample) { return -1; }
int esd_confirm_sample_cache (int esd) { return -1; }
int esd_close (int esd) { return -1; }
void *afOpenFile (const char *filename, const char *mode, int setup) { return NULL; }
int afGetFrameCount (void *file, int track) { return 0; }
int afGetChannels (void *file, int track) { return 0; }
double afGetRate (void *file, int track) { return 0.0; }
void afGetSampleFormat (void *file, int track, int *sampfmt, int *sampwidth) { }
int afReadFrames (void *file, int track, void *buffer, int frameCount) { return 0; }
int afCloseFile (void *file) { return 0; }
|