Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=fwife.git;a=commitdiff;h=03b49af0cca5c80655e430ca0b516015cfeb1ebd

commit 03b49af0cca5c80655e430ca0b516015cfeb1ebd
Author: Elentir <elen...@mailoo.org>
Date:   Thu Jan 21 23:43:34 2010 +0100

auto select of current/stable branch

* replace DEFINE
* fix issues with stable

diff --git a/src/fwife.h b/src/fwife.h
index c3f05b3..224a5f7 100644
--- a/src/fwife.h
+++ b/src/fwife.h
@@ -1,86 +1,80 @@
-/*
- *  fwife.h for Fwife
- *
- *  Copyright (c) 2005 by Miklos Vajna <vmik...@frugalware.org>
- *  Copyright (c) 2008, 2009 by Albar Boris <bori...@cegetel.net>
- *
- *  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.
- */
-
-#ifndef FWIFE_H_INCLUDED
-#define FWIFE_H_INCLUDED
-
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <libintl.h>
-#include "util.h"
-
-#define LOGDEV "/dev/tty4"
-#define LOGFILE "/var/log/fwife.log"
-#define SOURCEDIR "/mnt/source"
-#define TARGETDIR "/mnt/target"
-
-#define MKSWAP "/sbin/mkswap"
-#define SWAPON "/sbin/swapon"
-
-#define PACCONFPATH "/etc/pacman-g2/repos/"
-
-#ifndef STABLE
-#define PACCONF "frugalware-current"
-#else
-#define PACCONF "frugalware"
-#endif
-
-#define EXGRPSUFFIX "-extra"
-
-#define SHARED_LIB_EXT ".so"
-
-/* Structure of a plugins */
-
-typedef struct {
-       char *name;
-       char* (*desc)();
-       int priority;
-       GtkWidget* (*load_gtk_widget)();
-       GtkAssistantPageType type;
-       gboolean complete;
-       GtkWidget* (*load_help_widget)();
-       int (*prerun)(GList **config);
-       int (*run)(GList **config);
-       void *handle;
-} plugin_t;
-
-
-/* A structure for a plugin page */
-typedef struct {
-       GtkWidget *widget;
-       gint index;
-       const gchar *title;
-       GtkAssistantPageType type;
-       gboolean complete;
-} PageInfo;
-
-/* Functions to grant/deny next page access */
-void set_page_completed();
+/*
+ *  fwife.h for Fwife
+ *
+ *  Copyright (c) 2005 by Miklos Vajna <vmik...@frugalware.org>
+ *  Copyright (c) 2008, 2009, 2010 by Albar Boris <bori...@cegetel.net>
+ *
+ *  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.
+ */
+
+#ifndef FWIFE_H_INCLUDED
+#define FWIFE_H_INCLUDED
+
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <libintl.h>
+#include "util.h"
+
+#define LOGDEV "/dev/tty4"
+#define LOGFILE "/var/log/fwife.log"
+#define SOURCEDIR "/mnt/source"
+#define TARGETDIR "/mnt/target"
+
+#define MKSWAP "/sbin/mkswap"
+#define SWAPON "/sbin/swapon"
+
+#define PACCONFPATH "/etc/pacman-g2/repos/"
+
+#define EXGRPSUFFIX "-extra"
+
+#define SHARED_LIB_EXT ".so"
+
+/* Structure of a plugins */
+
+typedef struct {
+       char *name;
+       char* (*desc)();
+       int priority;
+       GtkWidget* (*load_gtk_widget)();
+       GtkAssistantPageType type;
+       gboolean complete;
+       GtkWidget* (*load_help_widget)();
+       int (*prerun)(GList **config);
+       int (*run)(GList **config);
+       void *handle;
+} plugin_t;
+
+
+/* A structure for a plugin page */
+typedef struct {
+       GtkWidget *widget;
+       gint index;
+       const gchar *title;
+       GtkAssistantPageType type;
+       gboolean complete;
+} PageInfo;
+
+/* Functions to grant/deny next page access */
+void set_page_completed();
void set_page_incompleted();

/* Force fwife to quit */
-void fwife_exit();
-
-/* Go to next plugin in special case */
+void fwife_exit();
+
+/* Go to next plugin in special case */
int skip_to_next_plugin();
-
-#endif /* FWIFE_H_INCLUDED */
+
+#endif /* FWIFE_H_INCLUDED */
diff --git a/src/plugins/configsource.c b/src/plugins/configsource.c
index 3e0843f..7f0cd8b 100644
--- a/src/plugins/configsource.c
+++ b/src/plugins/configsource.c
@@ -2,7 +2,7 @@
*  configsource.c for Fwife
*
*  Copyright (c) 2005 by Miklos Vajna <vmik...@frugalware.org>
- *  Copyright (c) 2008, 2009 by Albar Boris <bori...@cegetel.net>
+ *  Copyright (c) 2008, 2009, 2010 by Albar Boris <bori...@cegetel.net>
*
*  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
@@ -52,6 +52,7 @@
static GList *mirrorlist = NULL;

static GtkWidget *viewserver = NULL;
+static char *PACCONF = NULL;

extern GtkWidget *assistant;

@@ -315,6 +316,9 @@ int prerun(GList **config)
char *fn, *testurl;
int i;

+       // get the branch used
+       PACCONF = data_get(*config, "pacconf");
+
while(run_net_config(config) == -1) {}

if(mirrorlist == NULL) {
diff --git a/src/plugins/greet.c b/src/plugins/greet.c
index b46ab41..255d54d 100644
--- a/src/plugins/greet.c
+++ b/src/plugins/greet.c
@@ -1,7 +1,7 @@
/*
*  greet.c for Fwife
*
- *  Copyright (c) 2008, 2009 by Albar Boris <bori...@cegetel.net>
+ *  Copyright (c) 2008, 2009, 2010 by Albar Boris <bori...@cegetel.net>
*
*  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
@@ -25,9 +25,12 @@

#include <stdio.h>
#include <gtk/gtk.h>
+#include <pacman.h>

#include "common.h"

+static char *PACCONF = NULL;
+
plugin_t plugin =
{
"greet",
@@ -63,7 +66,33 @@ GtkWidget *load_gtk_widget()
return widget;
}

+void cb_db_register(char *section, PM_DB *db)
+{
+       // the first repo find is used
+       if(!strcmp(section, "frugalware-current") || !strcmp(section, 
"frugalware"))
+               PACCONF = strdup(section);
+}
+
int run(GList **config)
{
+       // find the fw branch that'll be used
+       pacman_release();
+       if(pacman_initialize("/") == -1)
+               return -1;
+
+       if (pacman_parse_config("/etc/pacman-g2.conf", cb_db_register, "") == 
-1) {
+               LOG("Failed to parse pacman-g2 configuration file (%s)", 
pacman_strerror(pm_errno));
+               return(-1);
+       }
+
+       pacman_release();
+
+       if(PACCONF == NULL) {
+               LOG("No usable pacman-g2 database for installation");
+               return -1;
+       }
+
+       data_put(config, "pacconf", PACCONF);
+
return 0;
}
diff --git a/src/plugins/select.c b/src/plugins/select.c
index 4666599..02354d9 100644
--- a/src/plugins/select.c
+++ b/src/plugins/select.c
@@ -2,7 +2,7 @@
*  select.c for Fwife
*
*  Copyright (c) 2005 by Miklos Vajna <vmik...@frugalware.org>
- *  Copyright (c) 2008, 2009 by Albar Boris <bori...@cegetel.net>
+ *  Copyright (c) 2008, 2009, 2010 by Albar Boris <bori...@cegetel.net>
*
*  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
@@ -53,6 +53,8 @@ static GList *allpackets = NULL;
static GList *packets_current = NULL;
static GList *cats = NULL;

+static char *PACCONF = NULL;
+
enum
{
USE_COLUMN,
@@ -1138,6 +1140,9 @@ int prerun(GList **config)
gtk_widget_hide(basicmode);
gtk_widget_hide(expertmode);

+       // get the branch used
+       PACCONF = data_get(*config, "pacconf");
+
//* if previous loaded (previous button used) do nothing *//
if(syncs == NULL && allpackets == NULL && cats == NULL)
{
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to