Removed update gui.

This commit is contained in:
gyboth 2005-03-03 11:29:14 +00:00
parent e5a4d2a379
commit 4663d2312b
13 changed files with 0 additions and 1959 deletions

View File

@ -1,19 +0,0 @@
## Process this file with automake to produce Makefile.in
AM_CFLAGS = -Wall
INCLUDES = \
-DPACKAGE_DATA_DIR=\""$(datadir)"\" \
-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
@PACKAGE_CFLAGS@
bin_PROGRAMS = bygfoot-update-gui
bin_SCRIPTS = bygfoot-update
bygfoot_update_gui_SOURCES = \
bu_main.c \
bu_support.c bu_support.h \
bu_interface.c bu_interface.h \
bu_callbacks.c bu_callbacks.h bu_functions.h \
bu_functions.c bu_functions.h bu_interface.h bu_support.h bu_callbacks.h
bygfoot_update_gui_LDADD = @PACKAGE_LIBS@ $(INTLLIBS)

View File

@ -1,98 +0,0 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtk/gtk.h>
#include "bygfoot-update.h"
#include "bu_functions.h"
#include "bu_callbacks.h"
#include "bu_interface.h"
#include "bu_support.h"
void
on_button_packdir_fs_clicked (GtkButton *button,
gpointer user_data)
{
GtkWidget *fs = create_fileselection();
gtk_widget_show(fs);
status = STATUS_FS_PACK;
}
void
on_button_tempdir_fs_clicked (GtkButton *button,
gpointer user_data)
{
GtkWidget *fs = create_fileselection();
gtk_widget_show(fs);
status = STATUS_FS_TMP;
}
void
on_button_countrydir_fs_clicked (GtkButton *button,
gpointer user_data)
{
GtkWidget *fs = create_fileselection();
gtk_widget_show(fs);
status = STATUS_FS_COUNTRY;
}
void
on_button_ok_clicked (GtkButton *button,
gpointer user_data)
{
callback_update();
}
void
on_button_fs_ok_clicked (GtkButton *button,
gpointer user_data)
{
GtkWidget *fs = lookup_widget(GTK_WIDGET(button), "fileselection");
GtkWidget *entry = NULL;
if(status == STATUS_FS_PACK)
entry = lookup_widget(update_window, "entry_packdir");
else if(status == STATUS_FS_TMP)
entry = lookup_widget(update_window, "entry_tmpdir");
else if(status == STATUS_FS_COUNTRY)
entry = lookup_widget(update_window, "entry_countrydir");
gtk_entry_set_text(GTK_ENTRY(entry),
gtk_file_selection_get_filename(
GTK_FILE_SELECTION(fs)));
gtk_widget_destroy(fs);
status = STATUS_NORMAL;
}
void
on_button_fs_cancel_clicked (GtkButton *button,
gpointer user_data)
{
gtk_widget_destroy(lookup_widget(GTK_WIDGET(button), "fileselection"));
status = STATUS_NORMAL;
}
void
on_button_quit_clicked (GtkButton *button,
gpointer user_data)
{
gtk_widget_destroy(update_window);
gtk_main_quit();
}
void
on_button_version_clicked (GtkButton *button,
gpointer user_data)
{
update_download(TRUE);
}

View File

@ -1,34 +0,0 @@
#include <gtk/gtk.h>
void
on_button_packdir_fs_clicked (GtkButton *button,
gpointer user_data);
void
on_button_tempdir_fs_clicked (GtkButton *button,
gpointer user_data);
void
on_button_ok_clicked (GtkButton *button,
gpointer user_data);
void
on_button_fs_ok_clicked (GtkButton *button,
gpointer user_data);
void
on_button_fs_cancel_clicked (GtkButton *button,
gpointer user_data);
void
on_button_quit_clicked (GtkButton *button,
gpointer user_data);
void
on_button_countrydir_fs_clicked (GtkButton *button,
gpointer user_data);
void
on_button_version_clicked (GtkButton *button,
gpointer user_data);

View File

@ -1,133 +0,0 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtk/gtk.h>
#include "bygfoot-update.h"
#include "bu_functions.h"
#include "bu_callbacks.h"
#include "bu_interface.h"
#include "bu_support.h"
#include <string.h>
void
print_message(gchar *text)
{
GtkWidget *textview =
lookup_widget(update_window, "textview");
GtkTextBuffer *textbuffer =
gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
GtkTextIter iter;
gchar *converted = g_locale_to_utf8(text, -1, NULL, NULL, NULL);
if(converted != NULL)
{
gtk_text_buffer_get_start_iter(textbuffer, &iter);
gtk_text_buffer_insert(textbuffer, &iter, "\n\n", -1);
gtk_text_buffer_get_start_iter(textbuffer, &iter);
gtk_text_buffer_insert(textbuffer, &iter, converted, -1);
g_free(converted);
}
}
void
update_download(gboolean get_version)
{
GtkWidget *optionmenu_format =
lookup_widget(update_window, "optionmenu_format");
GtkWidget *entry_tmpdir =
lookup_widget(update_window, "entry_tmpdir");
GtkWidget *optionmenu_type =
lookup_widget(update_window, "optionmenu_type");
gint exit;
gchar *output = NULL;
gchar type[SMALL], format[SMALL];
gchar *formats[5] = {"rpm", "bin", "src", "deb", "srpm"};
gchar swtch[SMALL];
if(gtk_option_menu_get_history(GTK_OPTION_MENU(optionmenu_type)) == 0)
strcpy(type, "stable");
else
strcpy(type, "unstable");
strcpy(format, formats[gtk_option_menu_get_history(GTK_OPTION_MENU(optionmenu_format))]);
if(get_version)
strcpy(swtch, "-V");
else
strcpy(swtch, "-n");
g_string_printf(command_line, "%s %s -t %s -T %s -f %s",
update_script->str, swtch, gtk_entry_get_text(GTK_ENTRY(entry_tmpdir)),
type, format);
if(!get_version)
return;
printf("comml +%s+\n", command_line->str);
g_spawn_command_line_sync(command_line->str, &output, NULL, &exit, NULL);
if(output != NULL)
{
print_message(output);
g_free(output);
}
}
void
update_src(void)
{
GtkWidget *entry_packdir =
lookup_widget(update_window, "entry_packdir");
GtkWidget *entry_tmpdir =
lookup_widget(update_window, "entry_tmpdir");
GtkWidget *checkbutton_recompile =
lookup_widget(update_window, "checkbutton_recompile");
gchar buf[SMALL];
sprintf(buf, "%s -p %s -t %s -a", update_script->str,
gtk_entry_get_text(GTK_ENTRY(entry_packdir)),
gtk_entry_get_text(GTK_ENTRY(entry_tmpdir)));
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_recompile)))
strcat(buf, " -r");
else
strcat(buf, " -R");
g_string_printf(command_line, "%s", buf);
}
void
callback_update(void)
{
GtkWidget *entry_countrydir =
lookup_widget(update_window, "entry_countrydir");
GtkWidget *radiobutton_src =
lookup_widget(update_window, "radiobutton_src");
GtkWidget *radiobutton_country =
lookup_widget(update_window, "radiobutton_country");
gint exit;
gchar *output = NULL;
if(gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(radiobutton_src)))
update_src();
else if(gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(radiobutton_country)))
g_string_printf(command_line, "%s -c -C %s", update_script->str,
gtk_entry_get_text(GTK_ENTRY(entry_countrydir)));
else
update_download(FALSE);
printf("comml +%s+\n", command_line->str);
g_spawn_command_line_sync(command_line->str, &output, NULL, &exit, NULL);
if(output != NULL)
{
print_message(output);
g_free(output);
}
}

View File

@ -1,14 +0,0 @@
void
print_message(gchar *text);
void
callback_update(void);
void
update_src(void);
void
update_countries(void);
void
update_download(gboolean get_version);

View File

@ -1,576 +0,0 @@
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include "bu_callbacks.h"
#include "bu_interface.h"
#include "bu_support.h"
#define GLADE_HOOKUP_OBJECT(component,widget,name) \
g_object_set_data_full (G_OBJECT (component), name, \
gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
g_object_set_data (G_OBJECT (component), name, widget)
GtkWidget*
create_update_window (void)
{
GtkWidget *update_window;
GtkWidget *vbox1;
GtkWidget *scrolledwindow1;
GtkWidget *textview;
GtkWidget *hseparator1;
GtkWidget *vbox2;
GtkWidget *hbox15;
GtkWidget *radiobutton_src;
GSList *radiobutton_src_group = NULL;
GtkWidget *checkbutton_recompile;
GtkWidget *hseparator4;
GtkWidget *hbox12;
GtkWidget *radiobutton_country;
GtkWidget *hseparator5;
GtkWidget *hbox16;
GtkWidget *radiobutton_download;
GtkWidget *button_version;
GtkWidget *alignment9;
GtkWidget *hbox17;
GtkWidget *image9;
GtkWidget *label14;
GtkWidget *vbox3;
GtkWidget *label12;
GtkWidget *optionmenu_type;
GtkWidget *menu1;
GtkWidget *stable1;
GtkWidget *unstable1;
GtkWidget *vbox4;
GtkWidget *label13;
GtkWidget *optionmenu_format;
GtkWidget *menu2;
GtkWidget *rpm1;
GtkWidget *binary1;
GtkWidget *source1;
GtkWidget *deb1;
GtkWidget *srpm1;
GtkWidget *hseparator3;
GtkWidget *label1;
GtkWidget *hbox2;
GtkWidget *entry_packdir;
GtkWidget *button_packdir_fs;
GtkWidget *alignment1;
GtkWidget *hbox5;
GtkWidget *image1;
GtkWidget *label3;
GtkWidget *label2;
GtkWidget *hbox3;
GtkWidget *entry_tmpdir;
GtkWidget *button_tempdir_fs;
GtkWidget *alignment3;
GtkWidget *hbox7;
GtkWidget *image3;
GtkWidget *label5;
GtkWidget *label11;
GtkWidget *hbox13;
GtkWidget *entry_countrydir;
GtkWidget *button_countrydir_fs;
GtkWidget *alignment8;
GtkWidget *hbox14;
GtkWidget *image8;
GtkWidget *label10;
GtkWidget *hseparator2;
GtkWidget *hbox4;
GtkWidget *button_ok;
GtkWidget *alignment4;
GtkWidget *hbox8;
GtkWidget *image4;
GtkWidget *label6;
GtkWidget *button_quit;
GtkWidget *alignment7;
GtkWidget *hbox11;
GtkWidget *image7;
GtkWidget *label9;
GtkAccelGroup *accel_group;
GtkTooltips *tooltips;
tooltips = gtk_tooltips_new ();
accel_group = gtk_accel_group_new ();
update_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width (GTK_CONTAINER (update_window), 5);
gtk_window_set_title (GTK_WINDOW (update_window), _("Bygfoot Online Update Frontend"));
gtk_window_set_position (GTK_WINDOW (update_window), GTK_WIN_POS_CENTER);
gtk_window_set_default_size (GTK_WINDOW (update_window), 400, 550);
vbox1 = gtk_vbox_new (FALSE, 0);
gtk_widget_show (vbox1);
gtk_container_add (GTK_CONTAINER (update_window), vbox1);
scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_show (scrolledwindow1);
gtk_box_pack_start (GTK_BOX (vbox1), scrolledwindow1, TRUE, TRUE, 0);
textview = gtk_text_view_new ();
gtk_widget_show (textview);
gtk_container_add (GTK_CONTAINER (scrolledwindow1), textview);
gtk_container_set_border_width (GTK_CONTAINER (textview), 2);
gtk_text_view_set_editable (GTK_TEXT_VIEW (textview), FALSE);
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (textview), GTK_WRAP_WORD);
hseparator1 = gtk_hseparator_new ();
gtk_widget_show (hseparator1);
gtk_box_pack_start (GTK_BOX (vbox1), hseparator1, FALSE, TRUE, 0);
gtk_widget_set_size_request (hseparator1, 1, 10);
vbox2 = gtk_vbox_new (FALSE, 0);
gtk_widget_show (vbox2);
gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, TRUE, 0);
hbox15 = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox15);
gtk_box_pack_start (GTK_BOX (vbox2), hbox15, TRUE, TRUE, 0);
radiobutton_src = gtk_radio_button_new_with_mnemonic (NULL, _("Update source package"));
gtk_widget_show (radiobutton_src);
gtk_box_pack_start (GTK_BOX (hbox15), radiobutton_src, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, radiobutton_src, _("Update your Bygfoot source package using patches"), NULL);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_src), radiobutton_src_group);
radiobutton_src_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_src));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radiobutton_src), TRUE);
checkbutton_recompile = gtk_check_button_new_with_mnemonic (_("Run './configure && make' after updating"));
gtk_widget_show (checkbutton_recompile);
gtk_box_pack_start (GTK_BOX (hbox15), checkbutton_recompile, FALSE, FALSE, 0);
hseparator4 = gtk_hseparator_new ();
gtk_widget_show (hseparator4);
gtk_box_pack_start (GTK_BOX (vbox2), hseparator4, FALSE, TRUE, 0);
gtk_widget_set_size_request (hseparator4, 1, 10);
hbox12 = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox12);
gtk_box_pack_start (GTK_BOX (vbox2), hbox12, TRUE, TRUE, 0);
radiobutton_country = gtk_radio_button_new_with_mnemonic (NULL, _("Download team names"));
gtk_widget_show (radiobutton_country);
gtk_box_pack_start (GTK_BOX (hbox12), radiobutton_country, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, radiobutton_country, _("Download official team names (Real Madrid instead of R. Madrid etc.)"), NULL);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_country), radiobutton_src_group);
radiobutton_src_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_country));
hseparator5 = gtk_hseparator_new ();
gtk_widget_show (hseparator5);
gtk_box_pack_start (GTK_BOX (vbox2), hseparator5, FALSE, TRUE, 0);
gtk_widget_set_size_request (hseparator5, 1, 10);
hbox16 = gtk_hbox_new (FALSE, 4);
gtk_widget_show (hbox16);
gtk_box_pack_start (GTK_BOX (vbox2), hbox16, TRUE, TRUE, 0);
radiobutton_download = gtk_radio_button_new_with_mnemonic (NULL, _("DL complete package"));
gtk_widget_show (radiobutton_download);
gtk_box_pack_start (GTK_BOX (hbox16), radiobutton_download, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, radiobutton_download, _("Download a complete Bygfoot package from the website. The file will be stored in the temporary directory."), NULL);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_download), radiobutton_src_group);
radiobutton_src_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_download));
button_version = gtk_button_new ();
gtk_widget_show (button_version);
gtk_box_pack_start (GTK_BOX (hbox16), button_version, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, button_version, _("Fetch the version number of the package on the server. You won't want to download the package you already have, after all."), NULL);
alignment9 = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_widget_show (alignment9);
gtk_container_add (GTK_CONTAINER (button_version), alignment9);
hbox17 = gtk_hbox_new (FALSE, 2);
gtk_widget_show (hbox17);
gtk_container_add (GTK_CONTAINER (alignment9), hbox17);
image9 = gtk_image_new_from_stock ("gtk-dialog-question", GTK_ICON_SIZE_BUTTON);
gtk_widget_show (image9);
gtk_box_pack_start (GTK_BOX (hbox17), image9, FALSE, FALSE, 0);
label14 = gtk_label_new_with_mnemonic (_("Version"));
gtk_widget_show (label14);
gtk_box_pack_start (GTK_BOX (hbox17), label14, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label14), GTK_JUSTIFY_LEFT);
vbox3 = gtk_vbox_new (FALSE, 0);
gtk_widget_show (vbox3);
gtk_box_pack_start (GTK_BOX (hbox16), vbox3, TRUE, TRUE, 0);
label12 = gtk_label_new (_("Type"));
gtk_widget_show (label12);
gtk_box_pack_start (GTK_BOX (vbox3), label12, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label12), GTK_JUSTIFY_LEFT);
optionmenu_type = gtk_option_menu_new ();
gtk_widget_show (optionmenu_type);
gtk_box_pack_start (GTK_BOX (vbox3), optionmenu_type, FALSE, FALSE, 0);
menu1 = gtk_menu_new ();
stable1 = gtk_menu_item_new_with_mnemonic (_("Stable"));
gtk_widget_show (stable1);
gtk_container_add (GTK_CONTAINER (menu1), stable1);
unstable1 = gtk_menu_item_new_with_mnemonic (_("Unstable"));
gtk_widget_show (unstable1);
gtk_container_add (GTK_CONTAINER (menu1), unstable1);
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu_type), menu1);
vbox4 = gtk_vbox_new (FALSE, 0);
gtk_widget_show (vbox4);
gtk_box_pack_start (GTK_BOX (hbox16), vbox4, TRUE, TRUE, 0);
label13 = gtk_label_new (_("Format"));
gtk_widget_show (label13);
gtk_box_pack_start (GTK_BOX (vbox4), label13, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label13), GTK_JUSTIFY_LEFT);
optionmenu_format = gtk_option_menu_new ();
gtk_widget_show (optionmenu_format);
gtk_box_pack_start (GTK_BOX (vbox4), optionmenu_format, FALSE, FALSE, 0);
menu2 = gtk_menu_new ();
rpm1 = gtk_menu_item_new_with_mnemonic (_("Rpm"));
gtk_widget_show (rpm1);
gtk_container_add (GTK_CONTAINER (menu2), rpm1);
binary1 = gtk_menu_item_new_with_mnemonic (_("Binary"));
gtk_widget_show (binary1);
gtk_container_add (GTK_CONTAINER (menu2), binary1);
source1 = gtk_menu_item_new_with_mnemonic (_("Source"));
gtk_widget_show (source1);
gtk_container_add (GTK_CONTAINER (menu2), source1);
deb1 = gtk_menu_item_new_with_mnemonic (_("Deb"));
gtk_widget_show (deb1);
gtk_container_add (GTK_CONTAINER (menu2), deb1);
srpm1 = gtk_menu_item_new_with_mnemonic (_("Srpm"));
gtk_widget_show (srpm1);
gtk_container_add (GTK_CONTAINER (menu2), srpm1);
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu_format), menu2);
hseparator3 = gtk_hseparator_new ();
gtk_widget_show (hseparator3);
gtk_box_pack_start (GTK_BOX (vbox1), hseparator3, FALSE, TRUE, 0);
gtk_widget_set_size_request (hseparator3, 1, 10);
label1 = gtk_label_new (_("Your Bygfoot source package directory"));
gtk_widget_show (label1);
gtk_box_pack_start (GTK_BOX (vbox1), label1, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);
gtk_misc_set_padding (GTK_MISC (label1), 0, 5);
hbox2 = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox2);
gtk_box_pack_start (GTK_BOX (vbox1), hbox2, FALSE, FALSE, 0);
entry_packdir = gtk_entry_new ();
gtk_widget_show (entry_packdir);
gtk_box_pack_start (GTK_BOX (hbox2), entry_packdir, TRUE, TRUE, 0);
button_packdir_fs = gtk_button_new ();
gtk_widget_show (button_packdir_fs);
gtk_box_pack_start (GTK_BOX (hbox2), button_packdir_fs, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, button_packdir_fs, _("Select a directory"), NULL);
alignment1 = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_widget_show (alignment1);
gtk_container_add (GTK_CONTAINER (button_packdir_fs), alignment1);
hbox5 = gtk_hbox_new (FALSE, 2);
gtk_widget_show (hbox5);
gtk_container_add (GTK_CONTAINER (alignment1), hbox5);
image1 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_BUTTON);
gtk_widget_show (image1);
gtk_box_pack_start (GTK_BOX (hbox5), image1, FALSE, FALSE, 0);
label3 = gtk_label_new_with_mnemonic (_("..."));
gtk_widget_show (label3);
gtk_box_pack_start (GTK_BOX (hbox5), label3, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_LEFT);
label2 = gtk_label_new (_("A temporary directory I can use (read/write)"));
gtk_widget_show (label2);
gtk_box_pack_start (GTK_BOX (vbox1), label2, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);
gtk_misc_set_padding (GTK_MISC (label2), 0, 5);
hbox3 = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox3);
gtk_box_pack_start (GTK_BOX (vbox1), hbox3, FALSE, FALSE, 0);
entry_tmpdir = gtk_entry_new ();
gtk_widget_show (entry_tmpdir);
gtk_box_pack_start (GTK_BOX (hbox3), entry_tmpdir, TRUE, TRUE, 0);
button_tempdir_fs = gtk_button_new ();
gtk_widget_show (button_tempdir_fs);
gtk_box_pack_start (GTK_BOX (hbox3), button_tempdir_fs, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, button_tempdir_fs, _("Select a directory"), NULL);
alignment3 = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_widget_show (alignment3);
gtk_container_add (GTK_CONTAINER (button_tempdir_fs), alignment3);
hbox7 = gtk_hbox_new (FALSE, 2);
gtk_widget_show (hbox7);
gtk_container_add (GTK_CONTAINER (alignment3), hbox7);
image3 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_BUTTON);
gtk_widget_show (image3);
gtk_box_pack_start (GTK_BOX (hbox7), image3, FALSE, FALSE, 0);
label5 = gtk_label_new_with_mnemonic (_("..."));
gtk_widget_show (label5);
gtk_box_pack_start (GTK_BOX (hbox7), label5, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label5), GTK_JUSTIFY_LEFT);
label11 = gtk_label_new (_("Team names destination directory (default recommended)"));
gtk_widget_show (label11);
gtk_box_pack_start (GTK_BOX (vbox1), label11, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label11), GTK_JUSTIFY_LEFT);
gtk_misc_set_padding (GTK_MISC (label11), 0, 5);
hbox13 = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox13);
gtk_box_pack_start (GTK_BOX (vbox1), hbox13, FALSE, TRUE, 0);
entry_countrydir = gtk_entry_new ();
gtk_widget_show (entry_countrydir);
gtk_box_pack_start (GTK_BOX (hbox13), entry_countrydir, TRUE, TRUE, 0);
button_countrydir_fs = gtk_button_new ();
gtk_widget_show (button_countrydir_fs);
gtk_box_pack_start (GTK_BOX (hbox13), button_countrydir_fs, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, button_countrydir_fs, _("Select a directory"), NULL);
alignment8 = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_widget_show (alignment8);
gtk_container_add (GTK_CONTAINER (button_countrydir_fs), alignment8);
hbox14 = gtk_hbox_new (FALSE, 2);
gtk_widget_show (hbox14);
gtk_container_add (GTK_CONTAINER (alignment8), hbox14);
image8 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_BUTTON);
gtk_widget_show (image8);
gtk_box_pack_start (GTK_BOX (hbox14), image8, FALSE, FALSE, 0);
label10 = gtk_label_new_with_mnemonic (_("..."));
gtk_widget_show (label10);
gtk_box_pack_start (GTK_BOX (hbox14), label10, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label10), GTK_JUSTIFY_LEFT);
hseparator2 = gtk_hseparator_new ();
gtk_widget_show (hseparator2);
gtk_box_pack_start (GTK_BOX (vbox1), hseparator2, FALSE, TRUE, 0);
gtk_widget_set_size_request (hseparator2, 1, 10);
hbox4 = gtk_hbox_new (FALSE, 5);
gtk_widget_show (hbox4);
gtk_box_pack_start (GTK_BOX (vbox1), hbox4, FALSE, FALSE, 0);
button_ok = gtk_button_new ();
gtk_widget_show (button_ok);
gtk_box_pack_start (GTK_BOX (hbox4), button_ok, TRUE, TRUE, 0);
alignment4 = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_widget_show (alignment4);
gtk_container_add (GTK_CONTAINER (button_ok), alignment4);
hbox8 = gtk_hbox_new (FALSE, 2);
gtk_widget_show (hbox8);
gtk_container_add (GTK_CONTAINER (alignment4), hbox8);
image4 = gtk_image_new_from_stock ("gtk-apply", GTK_ICON_SIZE_BUTTON);
gtk_widget_show (image4);
gtk_box_pack_start (GTK_BOX (hbox8), image4, FALSE, FALSE, 0);
label6 = gtk_label_new_with_mnemonic (_("OK"));
gtk_widget_show (label6);
gtk_box_pack_start (GTK_BOX (hbox8), label6, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label6), GTK_JUSTIFY_LEFT);
button_quit = gtk_button_new ();
gtk_widget_show (button_quit);
gtk_box_pack_start (GTK_BOX (hbox4), button_quit, TRUE, TRUE, 0);
gtk_widget_add_accelerator (button_quit, "clicked", accel_group,
GDK_Escape, 0,
GTK_ACCEL_VISIBLE);
alignment7 = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_widget_show (alignment7);
gtk_container_add (GTK_CONTAINER (button_quit), alignment7);
hbox11 = gtk_hbox_new (FALSE, 2);
gtk_widget_show (hbox11);
gtk_container_add (GTK_CONTAINER (alignment7), hbox11);
image7 = gtk_image_new_from_stock ("gtk-quit", GTK_ICON_SIZE_BUTTON);
gtk_widget_show (image7);
gtk_box_pack_start (GTK_BOX (hbox11), image7, FALSE, FALSE, 0);
label9 = gtk_label_new_with_mnemonic (_("Quit"));
gtk_widget_show (label9);
gtk_box_pack_start (GTK_BOX (hbox11), label9, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label9), GTK_JUSTIFY_LEFT);
g_signal_connect ((gpointer) update_window, "delete_event",
G_CALLBACK (on_button_quit_clicked),
NULL);
g_signal_connect ((gpointer) button_version, "clicked",
G_CALLBACK (on_button_version_clicked),
NULL);
g_signal_connect ((gpointer) button_packdir_fs, "clicked",
G_CALLBACK (on_button_packdir_fs_clicked),
NULL);
g_signal_connect ((gpointer) button_tempdir_fs, "clicked",
G_CALLBACK (on_button_tempdir_fs_clicked),
NULL);
g_signal_connect ((gpointer) button_countrydir_fs, "clicked",
G_CALLBACK (on_button_countrydir_fs_clicked),
NULL);
g_signal_connect ((gpointer) button_ok, "clicked",
G_CALLBACK (on_button_ok_clicked),
NULL);
g_signal_connect ((gpointer) button_quit, "clicked",
G_CALLBACK (on_button_quit_clicked),
NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
GLADE_HOOKUP_OBJECT_NO_REF (update_window, update_window, "update_window");
GLADE_HOOKUP_OBJECT (update_window, vbox1, "vbox1");
GLADE_HOOKUP_OBJECT (update_window, scrolledwindow1, "scrolledwindow1");
GLADE_HOOKUP_OBJECT (update_window, textview, "textview");
GLADE_HOOKUP_OBJECT (update_window, hseparator1, "hseparator1");
GLADE_HOOKUP_OBJECT (update_window, vbox2, "vbox2");
GLADE_HOOKUP_OBJECT (update_window, hbox15, "hbox15");
GLADE_HOOKUP_OBJECT (update_window, radiobutton_src, "radiobutton_src");
GLADE_HOOKUP_OBJECT (update_window, checkbutton_recompile, "checkbutton_recompile");
GLADE_HOOKUP_OBJECT (update_window, hseparator4, "hseparator4");
GLADE_HOOKUP_OBJECT (update_window, hbox12, "hbox12");
GLADE_HOOKUP_OBJECT (update_window, radiobutton_country, "radiobutton_country");
GLADE_HOOKUP_OBJECT (update_window, hseparator5, "hseparator5");
GLADE_HOOKUP_OBJECT (update_window, hbox16, "hbox16");
GLADE_HOOKUP_OBJECT (update_window, radiobutton_download, "radiobutton_download");
GLADE_HOOKUP_OBJECT (update_window, button_version, "button_version");
GLADE_HOOKUP_OBJECT (update_window, alignment9, "alignment9");
GLADE_HOOKUP_OBJECT (update_window, hbox17, "hbox17");
GLADE_HOOKUP_OBJECT (update_window, image9, "image9");
GLADE_HOOKUP_OBJECT (update_window, label14, "label14");
GLADE_HOOKUP_OBJECT (update_window, vbox3, "vbox3");
GLADE_HOOKUP_OBJECT (update_window, label12, "label12");
GLADE_HOOKUP_OBJECT (update_window, optionmenu_type, "optionmenu_type");
GLADE_HOOKUP_OBJECT (update_window, menu1, "menu1");
GLADE_HOOKUP_OBJECT (update_window, stable1, "stable1");
GLADE_HOOKUP_OBJECT (update_window, unstable1, "unstable1");
GLADE_HOOKUP_OBJECT (update_window, vbox4, "vbox4");
GLADE_HOOKUP_OBJECT (update_window, label13, "label13");
GLADE_HOOKUP_OBJECT (update_window, optionmenu_format, "optionmenu_format");
GLADE_HOOKUP_OBJECT (update_window, menu2, "menu2");
GLADE_HOOKUP_OBJECT (update_window, rpm1, "rpm1");
GLADE_HOOKUP_OBJECT (update_window, binary1, "binary1");
GLADE_HOOKUP_OBJECT (update_window, source1, "source1");
GLADE_HOOKUP_OBJECT (update_window, deb1, "deb1");
GLADE_HOOKUP_OBJECT (update_window, srpm1, "srpm1");
GLADE_HOOKUP_OBJECT (update_window, hseparator3, "hseparator3");
GLADE_HOOKUP_OBJECT (update_window, label1, "label1");
GLADE_HOOKUP_OBJECT (update_window, hbox2, "hbox2");
GLADE_HOOKUP_OBJECT (update_window, entry_packdir, "entry_packdir");
GLADE_HOOKUP_OBJECT (update_window, button_packdir_fs, "button_packdir_fs");
GLADE_HOOKUP_OBJECT (update_window, alignment1, "alignment1");
GLADE_HOOKUP_OBJECT (update_window, hbox5, "hbox5");
GLADE_HOOKUP_OBJECT (update_window, image1, "image1");
GLADE_HOOKUP_OBJECT (update_window, label3, "label3");
GLADE_HOOKUP_OBJECT (update_window, label2, "label2");
GLADE_HOOKUP_OBJECT (update_window, hbox3, "hbox3");
GLADE_HOOKUP_OBJECT (update_window, entry_tmpdir, "entry_tmpdir");
GLADE_HOOKUP_OBJECT (update_window, button_tempdir_fs, "button_tempdir_fs");
GLADE_HOOKUP_OBJECT (update_window, alignment3, "alignment3");
GLADE_HOOKUP_OBJECT (update_window, hbox7, "hbox7");
GLADE_HOOKUP_OBJECT (update_window, image3, "image3");
GLADE_HOOKUP_OBJECT (update_window, label5, "label5");
GLADE_HOOKUP_OBJECT (update_window, label11, "label11");
GLADE_HOOKUP_OBJECT (update_window, hbox13, "hbox13");
GLADE_HOOKUP_OBJECT (update_window, entry_countrydir, "entry_countrydir");
GLADE_HOOKUP_OBJECT (update_window, button_countrydir_fs, "button_countrydir_fs");
GLADE_HOOKUP_OBJECT (update_window, alignment8, "alignment8");
GLADE_HOOKUP_OBJECT (update_window, hbox14, "hbox14");
GLADE_HOOKUP_OBJECT (update_window, image8, "image8");
GLADE_HOOKUP_OBJECT (update_window, label10, "label10");
GLADE_HOOKUP_OBJECT (update_window, hseparator2, "hseparator2");
GLADE_HOOKUP_OBJECT (update_window, hbox4, "hbox4");
GLADE_HOOKUP_OBJECT (update_window, button_ok, "button_ok");
GLADE_HOOKUP_OBJECT (update_window, alignment4, "alignment4");
GLADE_HOOKUP_OBJECT (update_window, hbox8, "hbox8");
GLADE_HOOKUP_OBJECT (update_window, image4, "image4");
GLADE_HOOKUP_OBJECT (update_window, label6, "label6");
GLADE_HOOKUP_OBJECT (update_window, button_quit, "button_quit");
GLADE_HOOKUP_OBJECT (update_window, alignment7, "alignment7");
GLADE_HOOKUP_OBJECT (update_window, hbox11, "hbox11");
GLADE_HOOKUP_OBJECT (update_window, image7, "image7");
GLADE_HOOKUP_OBJECT (update_window, label9, "label9");
GLADE_HOOKUP_OBJECT_NO_REF (update_window, tooltips, "tooltips");
gtk_window_add_accel_group (GTK_WINDOW (update_window), accel_group);
return update_window;
}
GtkWidget*
create_fileselection (void)
{
GtkWidget *fileselection;
GtkWidget *button_fs_ok;
GtkWidget *button_fs_cancel;
fileselection = gtk_file_selection_new (_("Datei auswählen"));
gtk_container_set_border_width (GTK_CONTAINER (fileselection), 10);
gtk_window_set_position (GTK_WINDOW (fileselection), GTK_WIN_POS_CENTER);
button_fs_ok = GTK_FILE_SELECTION (fileselection)->ok_button;
gtk_widget_show (button_fs_ok);
GTK_WIDGET_SET_FLAGS (button_fs_ok, GTK_CAN_DEFAULT);
button_fs_cancel = GTK_FILE_SELECTION (fileselection)->cancel_button;
gtk_widget_show (button_fs_cancel);
GTK_WIDGET_SET_FLAGS (button_fs_cancel, GTK_CAN_DEFAULT);
g_signal_connect ((gpointer) button_fs_ok, "clicked",
G_CALLBACK (on_button_fs_ok_clicked),
NULL);
g_signal_connect ((gpointer) button_fs_cancel, "clicked",
G_CALLBACK (on_button_fs_cancel_clicked),
NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
GLADE_HOOKUP_OBJECT_NO_REF (fileselection, fileselection, "fileselection");
GLADE_HOOKUP_OBJECT_NO_REF (fileselection, button_fs_ok, "button_fs_ok");
GLADE_HOOKUP_OBJECT_NO_REF (fileselection, button_fs_cancel, "button_fs_cancel");
return fileselection;
}

View File

@ -1,6 +0,0 @@
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
GtkWidget* create_update_window (void);
GtkWidget* create_fileselection (void);

View File

@ -1,85 +0,0 @@
/*
* Initial main.c file generated by Glade. Edit as required.
* Glade will not overwrite this file.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtk/gtk.h>
#include "bygfoot-update.h"
#include "bu_interface.h"
#include "bu_support.h"
#include "bu_functions.h"
void
bu_init(void)
{
GtkWidget *textview =
lookup_widget(update_window, "textview");
GtkTextBuffer *textbuffer =
gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
GtkWidget *entry_packdir =
lookup_widget(update_window, "entry_packdir");
GtkWidget *entry_tmpdir =
lookup_widget(update_window, "entry_tmpdir");
GtkWidget *entry_countrydir =
lookup_widget(update_window, "entry_countrydir");
GString *text =
g_string_new("");
gchar buf[SMALL];
g_string_printf(text, "NOTE: This GUI uses the 'bygfoot-update' shell script to manage things, an since mixing the shell and the GUI is a rather messy thing, I recommend you use the script itself to manage your updates.\n\n");
g_string_append_printf(text, "NOTE 2: If the program hangs for a long while, the reason could be that wget can't establish connection to the website. Check http://bygfoot.sourceforge.net to find out.\n");
gtk_text_buffer_insert_at_cursor(textbuffer,
text->str, -1);
g_string_free(text, TRUE);
sprintf(buf, "%s", getenv("PWD"));
gtk_entry_set_text(GTK_ENTRY(entry_packdir), buf);
gtk_entry_set_text(GTK_ENTRY(entry_tmpdir), "/tmp");
sprintf(buf, "%s/.bygfoot/text_files", getenv("HOME"));
gtk_entry_set_text(GTK_ENTRY(entry_countrydir), buf);
gtk_widget_show(update_window);
status = STATUS_NORMAL;
}
gint
main (gint argc, gchar *argv[])
{
#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
#endif
update_script = g_string_new("");
command_line = g_string_new("");
if(g_file_test("./bygfoot-update", G_FILE_TEST_EXISTS))
g_string_printf(update_script, "%s/bygfoot-update", g_getenv("PWD"));
else
g_string_printf(update_script, "bygfoot-update");
gtk_set_locale ();
gtk_init (&argc, &argv);
update_window = create_update_window();
bu_init();
gtk_main ();
g_string_free(update_script, TRUE);
g_string_free(command_line, TRUE);
return 0;
}

View File

@ -1,144 +0,0 @@
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <gtk/gtk.h>
#include "bu_support.h"
GtkWidget*
lookup_widget (GtkWidget *widget,
const gchar *widget_name)
{
GtkWidget *parent, *found_widget;
for (;;)
{
if (GTK_IS_MENU (widget))
parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
else
parent = widget->parent;
if (!parent)
parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey");
if (parent == NULL)
break;
widget = parent;
}
found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
widget_name);
if (!found_widget)
g_warning ("Widget not found: %s", widget_name);
return found_widget;
}
static GList *pixmaps_directories = NULL;
/* Use this function to set the directory containing installed pixmaps. */
void
add_pixmap_directory (const gchar *directory)
{
pixmaps_directories = g_list_prepend (pixmaps_directories,
g_strdup (directory));
}
/* This is an internally used function to find pixmap files. */
static gchar*
find_pixmap_file (const gchar *filename)
{
GList *elem;
/* We step through each of the pixmaps directory to find it. */
elem = pixmaps_directories;
while (elem)
{
gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data,
G_DIR_SEPARATOR_S, filename);
if (g_file_test (pathname, G_FILE_TEST_EXISTS))
return pathname;
g_free (pathname);
elem = elem->next;
}
return NULL;
}
/* This is an internally used function to create pixmaps. */
GtkWidget*
create_pixmap (GtkWidget *widget,
const gchar *filename)
{
gchar *pathname = NULL;
GtkWidget *pixmap;
if (!filename || !filename[0])
return gtk_image_new ();
pathname = find_pixmap_file (filename);
if (!pathname)
{
g_warning (_("Couldn't find pixmap file: %s"), filename);
return gtk_image_new ();
}
pixmap = gtk_image_new_from_file (pathname);
g_free (pathname);
return pixmap;
}
/* This is an internally used function to create pixmaps. */
GdkPixbuf*
create_pixbuf (const gchar *filename)
{
gchar *pathname = NULL;
GdkPixbuf *pixbuf;
GError *error = NULL;
if (!filename || !filename[0])
return NULL;
pathname = find_pixmap_file (filename);
if (!pathname)
{
g_warning (_("Couldn't find pixmap file: %s"), filename);
return NULL;
}
pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
if (!pixbuf)
{
fprintf (stderr, "Failed to load pixbuf file: %s: %s\n",
pathname, error->message);
g_error_free (error);
}
g_free (pathname);
return pixbuf;
}
/* This is used to set ATK action descriptions. */
void
glade_set_atk_action_description (AtkAction *action,
const gchar *action_name,
const gchar *description)
{
gint n_actions, i;
n_actions = atk_action_get_n_actions (action);
for (i = 0; i < n_actions; i++)
{
if (!strcmp (atk_action_get_name (action, i), action_name))
atk_action_set_description (action, i, description);
}
}

View File

@ -1,67 +0,0 @@
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtk/gtk.h>
/*
* Standard gettext macros.
*/
#ifdef ENABLE_NLS
# include <libintl.h>
# undef _
# define _(String) dgettext (PACKAGE, String)
# ifdef gettext_noop
# define N_(String) gettext_noop (String)
# else
# define N_(String) (String)
# endif
#else
# define textdomain(String) (String)
# define gettext(String) (String)
# define dgettext(Domain,Message) (Message)
# define dcgettext(Domain,Message,Type) (Message)
# define bindtextdomain(Domain,Directory) (Domain)
# define _(String) (String)
# define N_(String) (String)
#endif
/*
* Public Functions.
*/
/*
* This function returns a widget in a component created by Glade.
* Call it with the toplevel widget in the component (i.e. a window/dialog),
* or alternatively any widget in the component, and the name of the widget
* you want returned.
*/
GtkWidget* lookup_widget (GtkWidget *widget,
const gchar *widget_name);
/* Use this function to set the directory containing installed pixmaps. */
void add_pixmap_directory (const gchar *directory);
/*
* Private Functions.
*/
/* This is used to create the pixmaps used in the interface. */
GtkWidget* create_pixmap (GtkWidget *widget,
const gchar *filename);
/* This is used to create the pixbufs used in the interface. */
GdkPixbuf* create_pixbuf (const gchar *filename);
/* This is used to set ATK action descriptions. */
void glade_set_atk_action_description (AtkAction *action,
const gchar *action_name,
const gchar *description);

View File

@ -1,753 +0,0 @@
#!/bin/bash
####################################################
# Bygfoot Football Manager #
# AUTHOR: Gyozo Both (gyboth@bygfoot.com) #
# http://www.bygfoot.com #
####################################################
# Skript that updates src packages of the Bygfoot Football Manager
# using wget to retrieve patches from the homepage
# version number
version="0.8"
# the bygfoot release version the script is shipped with
relversion=VERSION
# the current release version on the server
packversion=
# exit codes
EXITOK=0
EXITNOPROG=1
EXITNOREV=2
EXITABORT=3
EXITWGETFAIL=4
EXITUSR=6
EXITNEWSCRIPT=7
EXITCOUNTRY=8
EXITPACKFORMAT=9
EXITDEBIAN=10
# variables
# a variable we sometimes read something into
tempvar=
# the directory containing the Bygfoot src package
packdir=
# a directory we can write to and read from
tmpdir=
# destination for the country files
countrydir=
# the Bygfoot package type, stable or unstable
type_stable=stable
type_unstable=unstable
type=
# the current revision number of the user's package
revnr=
# revision numbers fetched from the homepage
newrevnr=
# number of new revisions found
found=0
# the arguments for the script
args="$*"
# the package format the user wants to download
format_rpm=.i586.rpm
format_bin=-binary.tar.bz2
format_src=.tar.bz2
format_srpm=.src.rpm
format_deb=-1_i386.deb
format=
# which cvs version to get
cvs_version1=bygfoot-unstable
cvs_version2=bygfoot2-unstable
cvs_version=
# options
# whether all new patches should be applied automatically
apply_all=0
# whether we should skip some queries and assume standard values
auto=0
# whether we recompile automatically after patching
recompile=0
# whether we check for auxiliary programs and
# newer update script versions
check=1
# whether we just fetch the latest version number from
# the server
get_version=0
# operation modes
# source update
mode_src=0
# country file download
mode_country=1
# package download
mode_pack=2
# get cvs version
mode_cvs=3
mode=
# print a help text
function print_help()
{
cat <<END
Usage: bygfoot-update [OPTIONS]
Note: You can call bygfoot-update without any options.
MAIN OPTIONS:
-c|--country-files Download country files with official team names
and team definitions file
-n|--new-package Download the latest complete package
-u|--update Update your Bygfoot source package using patches
-b|--cvs Get CVS version
AUXILIARY OPTIONS:
Global:
-A|--auto Assume [y] for all prompts
-h|--help Print help and exit
-t|--temp-dir DIR Set temp directory to DIR
-v|--version Print version information and exit
Relevant for source update mode:
-a|--apply-all Apply all new patches without prompting
-p|--package-dir DIR Set source package directory to DIR
-r|--recompile Run './configure && make' after updating
-R|--no-recompile Don't recompile after updating
Relevant for country files mode:
-C|--country-dir DIR Set destination directory for the
country files and def file to DIR
Relevant for package download mode:
-f|--format FORMAT Set package format to FORMAT:
'src', 'rpm', 'srpm', 'bin' or 'deb.
Note that 'deb' isn't allowed for unstable
packages.
-t|--temp-dir DIR Set download destination directory
to DIR (same as temp directory)
-T|--type TYPE Download latest TYPE package, TYPE
being either 'stable' or 'unstable'.
-V|--get-version Fetch version number of the latest
release from the server and exit.
END
}
# print program version
function print_version()
{
cat <<END
bygfoot-update: A bash script keeping your Bygfoot Football Manager up-to-date.
Version $version.
See the file UPDATE for some more information.
Call bygfoot-update -h|--help for usage information.
END
}
# parse arguments
function parse_args()
{
TEMP=`getopt -o aAbcC:f:hnNp:rRt:T:uvV --long apply-all,auto,country-files,country-dir:,cvs,format:,\
help,new-package,no-check,package-dir:,recompile,no-recompile,temp-dir:,type:,update,version,get-version -- $*`
if [ $? != 0 ]; then
echo "** b-u: There was an error parsing the arguments."
echo "** b-u: The arguments will be ignored."
return
fi
eval set -- "$TEMP"
while true; do
case "$1" in
-a|--apply-all) apply_all=1; shift ;;
-A|--auto) auto=1; apply_all=1; shift ;;
-b|--cvs) mode=$mode_cvs; shift ;;
-c|--country-files) mode=$mode_country; shift ;;
-C|--country-dir) pushd $2 &> /dev/null; countrydir=$PWD; popd &> /dev/null; shift 2 ;;
-f|--format) set_format $2; shift 2 ;;
-h|--help) print_help; exit $EXITOK ;;
-n|--new-package) mode=$mode_pack; shift ;;
-N|--no-check) check=0; shift ;;
-p|--package-dir) pushd $2 &> /dev/null; packdir=$PWD; popd &> /dev/null; shift 2 ;;
-r|--recompile) recompile=1; shift ;;
-R|--no-recompile) recompile=-1; shift ;;
-t|--temp-dir) pushd $2 &> /dev/null; tmpdir=$PWD; popd &> /dev/null; shift 2 ;;
-T|--type) type=$2; shift 2 ;;
-u|--update) mode=$mode_src; shift ;;
-v|--version) print_version; exit $EXITOK ;;
-V|--get-version) mode=$mode_pack; get_version=1; shift ;;
--) shift; break ;;
esac
done
}
# clean up in the temp dir
function cleanup()
{
echo
echo "** b-u: Cleaning up in the temp directory."
rm -rfv $tmpdir/bygfoot-update
}
# wget something, exit if it doesn't work
function my_wget()
{
if ! wget -v $1; then
echo
echo "** b-u: wget failure."
cleanup
exit $EXITWGETFAIL
fi
}
# check for the programs needed
function check_progs()
{
if [ $check -eq 0 ]; then
return
fi
echo
for i in sed tar bzip2 wget patch; do
echo -n "** b-u: checking for $i... "
if $i --help &> /dev/null; then
echo "ok"
else
echo "failed"
echo "** b-u: Didn't find a working $i, maybe it's not in your PATH."
echo "** b-u: Failure."
exit $EXITNOPROG
fi
done
}
# get country files with official team names
function get_country_files()
{
echo
echo "** b-u: Fetching country files with official team names and"
echo "** b-u: team definitions file."
pushd $countrydir &>/dev/null
my_wget http://bygfoot.sourceforge.net/revisions/bygfoot-countries.tar.bz2
for i in country_* teams; do
mv -vf $i $i.old
done
tar xfjv bygfoot-countries.tar.bz2
rm -vf bygfoot-countries.tar.bz2
popd
exit $EXITCOUNTRY
echo "** b-u: done."
}
# get the paths for a temp directory and
# the location of the user's bygfoot src package
function get_paths()
{
if [ $mode -eq $mode_src ]; then
if [ -z $packdir ]; then
if [ $auto -eq 0 ]; then
echo
echo "** b-u: Enter the directory containing your current Bygfoot src"
echo "** b-u: package (e.g. (/home/john/compiled/bygfoot-1.6.1):"
echo "** b-u: [default: $PWD]"
read tempvar
if [ ! -z $tempvar ]; then
pushd $tempvar; packdir=$PWD; popd
else
packdir=$PWD
fi
else
packdir=$PWD
fi
echo
echo "** b-u: Package dir set to"
echo "** b-u: $packdir"
fi
fi
if [ $mode -ne $mode_country ]; then
if [ -z $tmpdir ]; then
if [ $auto -eq 0 ]; then
echo
echo "** b-u: Enter temp directory I can use"
echo "** b-u: (you need read/write permissions there): [/tmp]"
read tempvar
if [ ! -z $tempvar ]; then
pushd $tempvar; tmpdir=$PWD; popd
else
tmpdir=/tmp
fi
else
tmpdir=/tmp
fi
echo
echo "** b-u: Temp dir set to"
echo "** b-u: $tmpdir"
fi
fi
if [ $mode -eq $mode_country ]; then
if [ -z $countrydir ]; then
if [ $auto -eq 0 ]; then
echo
echo "** b-u: Enter the directory I should unpack the country files"
echo "** b-u: to (the default destination is strongly recommended):"
echo "** b-u: [$HOME/.bygfoot/text_files]"
read tempvar
if [ ! -z $tempvar ]; then
pushd $tempvar; countrydir=$PWD; popd
else
countrydir=$HOME/.bygfoot/text_files
fi
else
countrydir=$HOME/.bygfoot/text_files
fi
echo
echo "** b-u: Country dir set to"
echo "** b-u: $countrydir"
fi
fi
}
# find out revision number and type
function get_rev_type()
{
echo
if [ ! -e $packdir/revision_number ]; then
echo "** b-u: I couldn't find the file containing your current"
echo "** b-u: revision number and type ($packdir/revision_number)."
echo
echo "** b-u: Failure."
exit $EXITNOREV
fi
type=$(cat $packdir/revision_number | sed s/[0-9]*//g)
revnr=$(cat $packdir/revision_number | sed s/[a-z]*//g)
echo "** b-u: Your current revision is: $type $revnr."
}
function apply_rev()
{
echo
echo "** b-u: Applying patch revision_$type$newrevnr"
cd $packdir
if [ -e $newrevdir/prepatch ]; then
$newrevdir/prepatch
fi
patch -p1 < $newrevdir/patch*
if [ -e $newrevdir/postpatch ]; then
$newrevdir/postpatch
fi
cd $tmpdir/bygfoot-update
}
# fetch a revision archive from the homepage and
# patch the src package
function get_revision()
{
local newrevdir=$tmpdir/bygfoot-update/revision_$type$newrevnr
echo
echo "** b-u: Retrieving revision_$type$newrevnr.tar.bz2."
my_wget http://bygfoot.sourceforge.net/revisions/$type/revision_$type$newrevnr.tar.bz2
mkdir $newrevdir
cd $newrevdir
tar xfjv ../revision_$type$newrevnr.tar.bz2
echo
echo "** b-u: Here's the revision description:"
echo "##############"
cat README
echo "##############"
echo
if [ $apply_all -eq 0 ]; then
echo "** b-u: Would you like to apply the patch?"
echo "** b-u: (You can't apply newer ones if you don't apply"
echo "** b-u: this one because they depend on each other): ([y]es/(n)o/(a)ll)"
read tempvar
if [ ! -z $tempvar ]; then
if [ $tempvar = "a" ]; then
apply_all=1
elif [ $tempvar != "y" ]; then
echo
cleanup
echo "** b-u: User abort."
exit $EXITUSR
fi
fi
fi
apply_rev
}
# look for new revisions
function get_revs()
{
echo
cd $tmpdir
echo "** b-u: Cleaning up old update directories and creating a new one..."
rm -rfv bygfoot-update
mkdir -v bygfoot-update
cd bygfoot-update
echo
echo "** b-u: Fetching revision list..."
my_wget http://bygfoot.sourceforge.net/revisions/$type/revisions_$type
for i in $(cat revisions_$type); do
echo
newrevnr=$(echo $i | sed s/'[a-z_]*\([0-9]*\).*'/'\1'/g)
if [ $newrevnr -gt $revnr ]; then
found=$[found + 1]
get_revision
else
echo "** b-u: $i is older than your revision..."
fi
done
}
# clean up etc.
function update_end()
{
echo
cleanup
if [ $found -ge 1 ]; then
echo "** b-u: $found new revisions found."
echo "** b-u: Your new revision number should be $[revnr + found]."
echo "** b-u: Have a look at the files README, ChangeLog and"
echo "** b-u: ReleaseNotes to see the changes that were made."
echo
if [ $recompile -eq 0 -a $auto -eq 0 ]; then
echo "** b-u: Would you like me to execute 'configure && make' ? ([y]/n)"
read tempvar
if [ ! -z $tempvar ]; then
if [ $tempvar != "y" ]; then
echo
echo "** b-u: done."
exit $EXITOK
fi
fi
fi
if [ $recompile -ne -1 ]; then
cd $packdir
./configure && make
fi
else
echo "** b-u: No new revisions found. Your package seems"
echo "** b-u: to be up-to-date."
fi
echo
echo "** b-u: done."
exit $EXITOK
}
# set package format from a command line option
function set_format()
{
if [ $1 = "rpm" ]; then
format=$format_rpm
elif [ $1 = "srpm" ]; then
format=$format_srpm
elif [ $1 = "src" ]; then
format=$format_src
elif [ $1 = "bin" ]; then
format=$format_bin
elif [ $1 = "deb" ]; then
format=$format_deb
else
echo "** b-u: Unrecognized package format: $1"
echo "** b-u: Failure."
exit $EXITPACKFORMAT
fi
}
# ask for the package type (stable/unstable)
function get_type()
{
if [ ! -z $type ]; then
return
fi
if [ $auto -ne 1 ];then
echo
echo "** b-u: Please specify the package type you'd like to"
echo "** b-u: download ([s]table / (u)nstable):"
read tempvar
if [ -z $tempvar ]; then
type=$type_stable
return
fi
if [ $type="u" ]; then
type=$type_unstable
else
type=$type_stable
fi
else
type=$type_stable
fi
}
# get package format the user wants to download
function get_format()
{
if [ -z $format ]; then
if [ $auto -ne 1 -a $get_version -ne 1 ]; then
echo
echo "** b-u: Please specify the package format you'd like to download"
echo "** b-u: ([r]pm / (b)inary / (s)ource / (d)ebian / (S)ource rpm):"
read tempvar
if [ -z $tempvar ]; then
format=$format_rpm
return
fi
if [ $tempvar = "b" ]; then
format=$format_bin
elif [ $tempvar = "s" ]; then
format=$format_src
elif [ $tempvar = "S" ]; then
format=$format_srpm
elif [ $tempvar = "d" ]; then
format=$format_deb
else
format=$format_rpm
fi
else
format=$format_rpm
fi
fi
if [ $type = $type_unstable -a $format = $format_deb ]; then
echo
echo "** b-u: There are no unstable packages for Debian. Sorry."
echo "** b-u: Failure."
exit $EXITDEBIAN
fi
}
function get_latest_version()
{
echo
echo "** b-u: Fetching version number of the latest $type release."
pushd $tmpdir &> /dev/null
rm -rfv bygfoot-update
mkdir bygfoot-update
cd bygfoot-update
my_wget http://bygfoot.sourceforge.net/packages/$type/version
packversion=$(cat version)
echo
echo "** b-u: Latest $type version is $packversion."
echo "** b-u: Your version (as far as i know) is $relversion."
if [ $get_version -eq 1 ]; then
cleanup
exit $EXITOK
fi
echo "** b-u: Do you want me to download the package? [y] / (n)"
if [ $auto -eq 1 ]; then
return
fi
read tempvar
if [ ! -z $temp]; then
if [ $tempvar = "n" ]; then
cleanup
popd &> /dev/null
exit $EXITUSR
fi
fi
}
function get_new_package()
{
local separator=-
local file=
if [ $format = $format_rpm -o $format = $format_srpm ]; then
packversion=$(echo $packversion | sed s/'\([0-9]*\.[0-9]*\)\(\.\)\([0-9]*\)'/'\1-\3'/g)
fi
if [ $format = $format_deb ]; then
separator=_
fi
file=bygfoot$separator$packversion$format
my_wget http://bygfoot.sourceforge.net/packages/$type/$file
echo
echo "** b-u: You can find the package $file"
echo "** b-u: in the directory $PWD."
echo "** b-u: Done."
exit $EXITOK
}
# download a bygfoot package
function get_package()
{
get_type
get_format
get_latest_version
get_new_package
}
function get_mode()
{
if [ ! -z $mode ]; then
return
fi
if [ $auto -eq 1 ]; then
mode=$mode_src
return
fi
echo
echo "** b-u: What would you like to do?"
echo "** b-u: - [1] Update your Bygfoot source package using patches"
echo "** b-u: - (2) Download the latest Bygfoot release"
echo "** b-u: - (3) Get country file package with official team names"
echo "** b-u: - (4) Get CVS version (2+ MB 'cause it's not compressed)"
read tempvar
if [ -z $tempvar ]; then
mode=$mode_src
return
fi
if [ $tempvar -eq 2 ]; then
mode=$mode_pack
elif [ $tempvar -eq 3 ]; then
mode=$mode_country
elif [ $tempvar -eq 4 ]; then
mode=$mode_cvs
else
mode=$mode_src
fi
}
function get_cvs()
{
echo
echo "** b-u: Which CVS version would you like to download?"
echo "** b-u: - [1] 1.7 branch"
echo "** b-u: - (2) 1.9 branch"
read tempvar
if [ -z $tempvar ]; then
cvs_version=$cvs_version1
else
if [ $tempvar -eq 2 ]; then
cvs_version=$cvs_version2
else
cvs_version=$cvs_version1
fi
fi
echo
echo "** b-u: If you'd like to check out as a developer, enter your"
echo "** b-u: SourceForge.net username. Press RETURN to download anonymously."
read tempvar
if [ -z $tempvar ]; then
cvs_command="cvs -d:pserver:anonymous@cvs.sf.net:/cvsroot/bygfoot"
else
cvs_command="cvs -d:ext:$tempvar@cvs.sf.net:/cvsroot/bygfoot"
fi
cd $tmpdir
$cvs_command checkout $cvs_version
if [ $recompile -eq 0 -a $auto -eq 0 ]; then
echo "** b-u: Would you like me to execute 'autogen.sh && make' ? ([y]/n)"
read tempvar
if [ ! -z $tempvar ]; then
if [ $tempvar != "y" ]; then
echo
echo "** b-u: done."
exit $EXITOK
fi
fi
fi
if [ $recompile -ne -1 ]; then
cd $cvs_version
./autogen.sh && make
fi
exit $EXITOK
}
parse_args $*
print_version
check_progs
get_mode
get_paths
# what to do when user presses Ctrl-C
trap 'echo; cleanup; echo "** b-u: User abort." & exit $EXITABORT' 2
if [ $mode -eq $mode_country ]; then
get_country_files
elif [ $mode -eq $mode_pack ]; then
get_package
elif [ $mode -eq $mode_cvs ]; then
get_cvs
else
get_rev_type
get_revs
update_end
fi

Binary file not shown.

View File

@ -1,30 +0,0 @@
#ifndef BYGFOOT_UPDATE_H
#define BYGFOOT_UPDATE_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtk/gtk.h>
#include <stdio.h>
#include <stdlib.h>
#define SMALL 10000
#define BIG 1000000
gint status;
GtkWidget *update_window;
GString *update_script;
GString *command_line;
enum
{
STATUS_NORMAL = 0,
STATUS_FS_PACK,
STATUS_FS_TMP,
STATUS_FS_COUNTRY,
STATUS_END
};
#endif