# --- T2-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# 
# T2 SDE: package/.../mine/gasgui-any-archiver.patch
# Copyright (C) 2005 - 2006 The T2 SDE Project
# 
# More information can be found in the files COPYING and README.
# 
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or 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.
# --- T2-COPYRIGHT-NOTE-END ---


Likewise allow handling of any compressed tarball.

  - Rene Rebe <rene@exactcode.de>

--- mine-0.23/gasgui.c	2005-03-23 09:51:06.000000000 +0100
+++ mine-0.23-patched/gasgui.c	2005-12-18 19:17:08.000000000 +0100
@@ -39,6 +39,8 @@
 char * sourcedir = "/mnt/cdrom0";
 char * sourceopt = "ro";
 
+char * sourcefmt = "tar.bz2";
+
 char * mine_command = "mine";
 char * mine_fopt = "";
 
@@ -68,6 +70,7 @@
 "  -D		Read package db and dump the memory DB as tree (debug).\n"
 "  -T		Don't really execute 'mine', print commands instead (debug).\n"
 "  -F		Start mine with the '-f' option (used by install scripts).\n"
+"  -S		Source format, e.g. tar.bz2, tar.gz or gem\n"
 "\n"
 	);
 }
@@ -110,27 +113,27 @@
 	char command[1024];
 
 	while ( !strncmp(sourcedir, "http://", 7) || !strncmp(sourcedir, "ftp://", 6) ) {
-		snprintf(gemfile, 1024, "%s/%s-%s.gem",
-		         targetdir, p->name, p->version);
+		snprintf(gemfile, 1024, "%s/%s-%s.%s",
+		         targetdir, p->name, p->version, sourcefmt);
 
-		snprintf(command, 1024, "wget -O '%s' -q '%s/%s/pkgs/%s-%s.gem'",
-		         gemfile, sourcedir, config, p->name, p->version);
+		snprintf(command, 1024, "wget -O '%s' -q '%s/%s/pkgs/%s-%s.%s'",
+		         gemfile, sourcedir, config, p->name, p->version, sourcefmt);
 		system(command);
 		snprintf(command, 1024, "test -s '%s' || rm -f %s", gemfile, gemfile);
 		system(command);
 		if ( !access(gemfile, F_OK) ) return gemfile;
 
-		snprintf(command, 1024, "wget -O '%s' -q '%s/%s/pkgs/%s.gem'",
-		         gemfile, sourcedir, config, p->name);
+		snprintf(command, 1024, "wget -O '%s' -q '%s/%s/pkgs/%s.%s'",
+		         gemfile, sourcedir, config, p->name, sourcefmt);
 		system(command);
 		snprintf(command, 1024, "test -s '%s' || rm -f %s", gemfile, gemfile);
 		system(command);
 		if ( !access(gemfile, F_OK) ) return gemfile;
 
-		printf("Can't find: %s/%s/pkgs/%s-%s.gem\n",
-			sourcedir, config, p->name, p->version);
-		printf("Can't find: %s/%s/pkgs/%s.gem\n",
-			sourcedir, config, p->name);
+		printf("Can't find: %s/%s/pkgs/%s-%s.%s\n",
+			sourcedir, config, p->name, p->version, sourcefmt);
+		printf("Can't find: %s/%s/pkgs/%s.%s\n",
+			sourcedir, config, p->name, sourcefmt);
 		printf("Not found on webserver: %s\n\n", p->name);
 		while (1) {
 			printf("Skip or Retry (default=Retry) > ");
@@ -143,12 +146,12 @@
 	}
 
 	while (1) {
-		snprintf(gemfile, 1024, "%s/%s/pkgs/%s-%s.gem",
-			sourcedir, config, p->name, p->version);
+		snprintf(gemfile, 1024, "%s/%s/pkgs/%s-%s.%s",
+			sourcedir, config, p->name, p->version, sourcefmt);
 		if ( !access(gemfile, F_OK) ) return gemfile;
 
-		snprintf(gemfile, 1024, "%s/%s/pkgs/%s.gem",
-			sourcedir, config, p->name);
+		snprintf(gemfile, 1024, "%s/%s/pkgs/%s.%s",
+			sourcedir, config, p->name, sourcefmt);
 		if ( !access(gemfile, F_OK) ) return gemfile;
 
 		/* looks like there are sometimes races with asyncrounously running mine subprocesses or something
@@ -156,10 +159,10 @@
 		snprintf(command, 1024, "umount -v %s &> /dev/null || { sleep 1; umount -v %s; }", sourcedir, sourcedir);
 		system(command);
 
-		printf("Can't find: %s/%s/pkgs/%s-%s.gem\n",
-			sourcedir, config, p->name, p->version);
-		printf("Can't find: %s/%s/pkgs/%s.gem\n",
-			sourcedir, config, p->name);
+		printf("Can't find: %s/%s/pkgs/%s-%s.%s\n",
+			sourcedir, config, p->name, p->version, sourcefmt);
+		printf("Can't find: %s/%s/pkgs/%s.%s\n",
+			sourcedir, config, p->name, sourcefmt);
 		printf("Not found on current disk: %s\n\n", p->name);
 		printf("Please insert Disk #%d and press ENTER.\n\n",
 		       p->disk_number);
@@ -174,12 +177,12 @@
 				eject_disk ();
 		}
 
-		snprintf(gemfile, 1024, "%s/%s/pkgs/%s-%s.gem",
-			sourcedir, config, p->name, p->version);
+		snprintf(gemfile, 1024, "%s/%s/pkgs/%s-%s.%s",
+			sourcedir, config, p->name, p->version, sourcefmt);
 		if ( !access(gemfile, F_OK) ) return gemfile;
 
-		snprintf(gemfile, 1024, "%s/%s/pkgs/%s.gem",
-			sourcedir, config, p->name);
+		snprintf(gemfile, 1024, "%s/%s/pkgs/%s.%s",
+			sourcedir, config, p->name, sourcefmt);
 		if ( !access(gemfile, F_OK) ) return gemfile;
 
 		snprintf(command, 1024, "mount -v -o %s %s %s",
@@ -237,7 +240,7 @@
 	struct package *p;
 	int opt, disk;
 
-	while ( (opt = getopt(argc, argv, "c:t:d:s:o:DTF")) != -1 ) {
+	while ( (opt = getopt(argc, argv, "c:t:d:s:o:S:DTF")) != -1 ) {
 		switch (opt) {
 			case 'c':
 				config = optarg;
@@ -263,6 +266,9 @@
 			case 'F':
 				mine_fopt = "-f";
 				break;
+			case 'S':
+				sourcefmt = optarg;
+				break;
 			default:
 				help();
 				return 0;