Adding aoutogeneration of the configuration file if it does not exist and

creates a metadata directory in /etc/eazel/services to store info now.
This commit is contained in:
J Shane Culpepper 2000-04-19 17:32:19 +00:00
parent 0e6ba110e9
commit e6bd1f20e2
4 changed files with 74 additions and 2 deletions

View file

@ -1,3 +1,12 @@
2000-04-18 Shane Culpepper <pepper@eazel.com>
* components/services/install/eazel-install-lib-xml.c
* components/services/install/eazel-install-lib.h
* components/services/install/eazel-install.c
Adding configuration file generator and creating a metadata directory.
A directory called /etc/eazel/services will be created to store
cofiguration options and uninstall data now.
2000-04-19 Maciej Stachowiak <mjs@eazel.com>
* src/ntl-view.c (nautilus_view_destroy_client): Reverted the last

View file

@ -60,7 +60,28 @@ init_default_install_configuration (const char* config_file) {
xmlDocPtr doc;
xmlNodePtr base;
char* tmpbuf;
if (!g_file_exists (config_file)) {
gboolean retval;
int rc;
g_print("Creating default configuration file ...\n");
rc = mkdir ("/etc/eazel/services", 0644);
if (rc < 0) {
if (errno != EEXIST) {
fprintf (stderr, "***Could not create services directory !***\n");
exit (1);
}
}
retval = create_default_configuration_metafile();
if (retval == FALSE) {
fprintf(stderr, "***Could not create the default configuration file !***\n");
exit (1);
}
}
doc = xmlParseFile (config_file);
if (doc == NULL) {
@ -326,3 +347,41 @@ free_categories (GList* categories) {
g_list_free (categories);
} /* end free_categories */
gboolean
create_default_configuration_metafile () {
xmlDocPtr doc;
xmlNodePtr tree;
char* tmp_str;
doc = xmlNewDoc ("1.0");
doc->root = xmlNewDocNode (doc, NULL, "EAZEL_INSTALLER", NULL);
tree = xmlNewChild (doc->root, NULL, "PROTOCOL", "LOCAL");
tree = xmlNewChild (doc->root, NULL, "DEBUG", "TRUE");
tree = xmlNewChild (doc->root, NULL, "DRY_RUN", "FALSE");
tree = xmlNewChild (doc->root, NULL, "VERBOSE", "TRUE");
tree = xmlNewChild (doc->root, NULL, "SILENT", "FALSE");
tree = xmlNewChild (doc->root, NULL, "DEPEND", "FALSE");
tree = xmlNewChild (doc->root, NULL, "UNINSTALL", "FALSE");
tree = xmlNewChild (doc->root, NULL, "UPDATE", "TRUE");
tree = xmlNewChild (doc->root, NULL, "PORT", "80");
tree = xmlNewChild (doc->root, NULL, "RPMRC_FILE", "/usr/lib/rpm/rpmrc");
tree = xmlNewChild (doc->root, NULL, "PKG_LIST_FILE", "/etc/eazel/services/package-list.xml");
tree = xmlNewChild (doc->root, NULL, "RPM_STORAGE_DIR", "/tmp/eazel-install");
tree = xmlNewChild (doc->root, NULL, "TMPDIR", "/tmp/eazel-install");
if (doc == NULL) {
fprintf (stderr, "***Error generating default configuration file !***\n");
xmlFreeDoc (doc);
exit (1);
}
tmp_str = g_strdup("/etc/eazel/services/eazel-services-config.xml");
xmlSaveFile (tmp_str, doc);
xmlFreeDoc (doc);
g_free (tmp_str);
return TRUE;
} /* end create_default_configuration_metafile */

View file

@ -34,6 +34,9 @@
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <dirent.h>
#include <sys/stat.h>
#include <gnome-xml/tree.h>
#include <gnome-xml/parser.h>
#include <rpm/rpmlib.h>
@ -100,5 +103,6 @@ gboolean uninstall_packages (InstallOptions* iopts);
void dump_install_options (InstallOptions* iopts);
void dump_package_list (PackageData* pkg);
void free_categories (GList* categories);
gboolean create_default_configuration_metafile (void);
#endif /* __EAZEL_INSTALL_LIB_H__ */

View file

@ -98,7 +98,7 @@ main (int argc, char* argv[]) {
USE_FTP = FALSE;
UNINSTALL_MODE = FALSE;
config_file = g_strdup ("/home/pepper/tmp/eazel-services-config.xml");
config_file = g_strdup ("/etc/eazel/services/eazel-services-config.xml");
/*
if (argc < 2) {
show_usage (1, "\n***You must specify the protocol!***\n");