rpms/s390utils/devel s390-tools-1.5.3-automenu.patch, NONE, 1.1 s390utils.spec, 1.45, 1.46 s390-tools-1.5.0-automenu.patch, 1.1, NONE

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Tue Sep 12 16:24:43 UTC 2006


Author: pknirsch

Update of /cvs/dist/rpms/s390utils/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv25472

Modified Files:
	s390utils.spec 
Added Files:
	s390-tools-1.5.3-automenu.patch 
Removed Files:
	s390-tools-1.5.0-automenu.patch 
Log Message:
- Added libsysfs requirement (#201863)
- Fixed zipl problem with missing default target for automenus (#202086)


s390-tools-1.5.3-automenu.patch:
 man/zipl.8 |    7 +++
 src/job.c  |  138 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 src/scan.c |    4 -
 src/zipl.c |    1 
 4 files changed, 144 insertions(+), 6 deletions(-)

--- NEW FILE s390-tools-1.5.3-automenu.patch ---
--- s390-tools-1.5.3/zipl/man/zipl.8.automenu	2004-10-06 10:11:14.000000000 +0200
+++ s390-tools-1.5.3/zipl/man/zipl.8	2006-09-12 18:13:59.000000000 +0200
@@ -217,6 +217,13 @@
 Note that when working with tapes, the current device position will be changed
 even when specifying this option.
 
+.TP
+.BR "\-x" " or " "\-\-no-automenu"
+Disables the automatic creation of a multiboot menu. Specifying a menu with the
+"-m <MENU>" option or a section disables this feature, too. This option was
+added for compatibility with previous versions of the multiboot version of
+zipl.
+
 .SH EXAMPLE
 1. Scenario: prepare disk for booting a Linux kernel image using the
 following parameters:
--- s390-tools-1.5.3/zipl/src/job.c.automenu	2004-10-06 10:11:14.000000000 +0200
+++ s390-tools-1.5.3/zipl/src/job.c	2006-09-12 18:22:21.000000000 +0200
@@ -42,13 +42,14 @@
 	{ "version",		no_argument,		NULL, 'v'},
 	{ "verbose",		no_argument,		NULL, 'V'},
 	{ "add-files",		no_argument,		NULL, 'a'},
+	{ "no-automenu",	no_argument,		NULL, 'x'},
 	{ "tape",		required_argument,	NULL, 'T'},
 	{ "dry-run",		no_argument,		NULL, '0'},
 	{ NULL,			0,			NULL, 0 }
 };
 
 /* Command line option abbreviations */
-static const char option_string[] = "-c:t:i:r:p:P:d:D:s:m:hHnVvaT:";
+static const char option_string[] = "-c:t:i:r:p:P:d:D:s:m:hHnVvaxT:";
 
 struct command_line {
 	char* data[SCAN_KEYWORD_NUM];
@@ -60,10 +61,13 @@
 	int version;
 	int verbose;
 	int add_files;
+	int automenu;
 	int dry_run;
 	enum scan_section_type type;
 };
 
+/* Global variable for default boot target. Ugly but necessary... */
+static char *default_target;
 
 static int
 store_option(struct command_line* cmdline, enum scan_keyword_id keyword,
@@ -89,6 +93,7 @@
 	int i;
 
 	memset((void *) &cmdline, 0, sizeof(struct command_line));
+	cmdline.automenu = 1;
 	cmdline.type = section_invalid;
 	/* Turn off standard option parser errors - we have our own */
 	opterr = 0;
@@ -176,6 +181,9 @@
 		case '0':
 			cmdline.dry_run = 1;
 			break;
+		case 'x':
+			cmdline.automenu = 0;
+			break;
 		case 1:
 			/* Non-option is interpreted as section name */
 			if (cmdline.section != NULL) {
@@ -221,6 +229,9 @@
 	if (cmdline.help || cmdline.version) {
 		/* Always accept --help and --version */
 	} else if ((cmdline.menu != NULL) || (cmdline.section != NULL)) {
+		/* If either menu or section has been selected disable
+		   automenu generation */
+		cmdline.automenu = 0;
 		/* Config file mode */
 		if ((cmdline.menu != NULL) && (cmdline.section != NULL)) {
 			error_reason("Option 'menu' cannot be used when "
@@ -759,7 +770,14 @@
 		/* IPL job */
 		job->id = job_ipl;
 		/* Fill in name of bootmap directory */
-		job->bootmap_dir = misc_strdup(data[(int) scan_keyword_target]);
+		if (data[(int) scan_keyword_target] == NULL)
+			if (default_target == NULL) {
+				error_text("Unable to find default section in your config file.");
+				break;
+			}
+			job->bootmap_dir = misc_strdup(default_target);
+		else
+			job->bootmap_dir = misc_strdup(data[(int) scan_keyword_target]);
 		if (job->bootmap_dir == NULL)
 			return -1;
 		/* Fill in name and address of image file */
@@ -1008,6 +1026,8 @@
 		if (temp_job == NULL)
 			return -1;
 		memset((void *) temp_job, 0, sizeof(struct job_data));
+		if (data[(int) scan_keyword_target] == NULL)
+			data[(int) scan_keyword_target] = misc_strdup(job->bootmap_dir);
 		rc = get_job_from_section_data(data, temp_job,
 					job->data.menu.entry[current].name);
 		if (rc) {
@@ -1174,10 +1194,109 @@
 }
 
 
+/* Create a fake menu to simulate the old s390utils-1.1.7 multiboot
+ * behaviour. */
+static struct scan_token *
+create_fake_menu(struct scan_token *scan)
+{
+	int i, j, pos, numsec, size, defaultpos;
+	char *name;
+	char *target;
+	char *seclist[1024];
+	char *defaultsection;
+	char buf[1024];
+	struct scan_token *tmp;
+
+	/* Count # of sections */
+	numsec = 0;
+	name = NULL;
+	target = NULL;
+	for (i = 0; (int) scan[i].id != 0; i++) {
+		if (scan[i].id == scan_id_section_heading) {
+			name = scan[i].content.section.name;
+			if (strcmp(DEFAULTBOOT_SECTION, name))
+				seclist[numsec++] = name;
+		}
+		if (scan[i].id == scan_id_keyword_assignment &&
+		    (scan[i].content.keyword.keyword == scan_keyword_dumpto ||
+		     scan[i].content.keyword.keyword == scan_keyword_dumptofs)) {
+			numsec--;
+			continue;
+		}
+		if (scan[i].id == scan_id_keyword_assignment &&
+		    scan[i].content.keyword.keyword == scan_keyword_target &&
+		    !strcmp(DEFAULTBOOT_SECTION, name))
+			target = scan[i].content.keyword.value;
+	}
+	get_default_section(scan, &defaultsection, &j);
+
+	if (defaultsection == NULL) {
+		error_text("Unable to find default section in your config file.");
+		return NULL;
+	}
+
+	if (target == NULL) {
+		error_text("Keyword target is missing in default section.");
+		return NULL;
+	}
+
+	default_target = misc_strdup(target);
+
+	size = i+6+numsec;
+	tmp = (struct scan_token *) misc_malloc(size * sizeof(struct scan_token));
+	if (tmp == NULL) {
+		error_text("Couldn't allocate memory for menu entries");
+		return NULL;
+	}
+
+	memset(tmp, 0, size * sizeof(struct scan_token));
+	memcpy(tmp, scan, i * sizeof(struct scan_token)); 
+	free(scan);
+	scan = tmp;
+
+	defaultpos = 0;
+	for (j = 0; j < numsec; j++) {
+		if (!strcmp(defaultsection, seclist[j]))
+			defaultpos = j+1;
+	}
+
+	snprintf(buf, 1024, "%d", defaultpos);
+
+	scan[i].id = scan_id_menu_heading;
+	scan[i].line = i;
+	scan[i++].content.menu.name = misc_strdup("rh-automatic-menu");
+	scan[i].id = scan_id_keyword_assignment;
+	scan[i].line = i;
+	scan[i].content.keyword.keyword = scan_keyword_target;
+	scan[i++].content.keyword.value = misc_strdup(target);
+	scan[i].id = scan_id_keyword_assignment;
+	scan[i].line = i;
+	scan[i].content.keyword.keyword = scan_keyword_default;
+	scan[i++].content.keyword.value = misc_strdup(buf);
+	scan[i].id = scan_id_keyword_assignment;
+	scan[i].line = i;
+	scan[i].content.keyword.keyword = scan_keyword_prompt;
+	scan[i++].content.keyword.value = misc_strdup("1");
+	scan[i].id = scan_id_keyword_assignment;
+	scan[i].line = i;
+	scan[i].content.keyword.keyword = scan_keyword_timeout;
+	scan[i++].content.keyword.value = misc_strdup("15");
+
+	pos = i;
+	for (i = 0; i<numsec; i++) {
+		scan[pos].id = scan_id_number_assignment;
+		scan[pos].line = pos;
+		scan[pos].content.number.number = i+1;
+		scan[pos++].content.number.value = misc_strdup(seclist[i]);
+	}
+
+	return scan;
+}
+
 static int
 get_job_from_config_file(struct command_line* cmdline, struct job_data* job)
 {
-	struct scan_token* scan;
+	struct scan_token* scan, *nscan;
 	char* filename;
 	char* source;
 	int rc;
@@ -1209,9 +1328,20 @@
 		scan_free(scan);
 		return rc;
 	}
+
+	nscan = create_fake_menu(scan);
+	if (nscan == NULL) {
+		scan_free(scan);
+		return -1;
+	}
+	scan = nscan;
+
 	/* Get job from config file data */
-	if (cmdline->menu != NULL)
+	if (cmdline->menu != NULL || cmdline->automenu) {
+		if (cmdline->automenu)
+			cmdline->menu = misc_strdup("rh-automatic-menu");
 		rc = get_menu_job(scan, cmdline->menu, job);
+	}
 	else {
 		rc = get_section_job(scan, cmdline->section, job,
 				cmdline->data[(int) scan_keyword_parameters]);
--- s390-tools-1.5.3/zipl/src/zipl.c.automenu	2004-11-22 14:05:21.000000000 +0100
+++ s390-tools-1.5.3/zipl/src/zipl.c	2006-09-12 18:13:59.000000000 +0200
@@ -73,6 +73,7 @@
 "-n, --noninteractive            Answer all confirmation questions with 'yes'",
 "-V, --verbose                   Provide more verbose output",
 "-a, --add-files                 Add all referenced files to bootmap file",
+"-x, --no-automenu               Don't autogenerate multiboot menu",
 "    --dry-run                   Simulate run but don't modify IPL records",
 ""
 };
--- s390-tools-1.5.3/zipl/src/scan.c.automenu	2004-07-20 15:09:21.000000000 +0200
+++ s390-tools-1.5.3/zipl/src/scan.c	2006-09-12 18:13:59.000000000 +0200
@@ -33,9 +33,9 @@
  *			     rs                                 enu
  */
 /* defaultboot	*/
-	{opt, inv, inv, inv, inv, inv, inv, inv, inv, inv, inv, opt, inv},
+	{opt, inv, inv, inv, inv, inv, inv, inv, req, inv, inv, opt, inv},
 /* ipl		*/
-	{inv, inv, inv, req, opt, opt, opt, inv, req, inv, inv, inv, inv},
+	{inv, inv, inv, req, opt, opt, opt, inv, opt, inv, inv, inv, inv},
 /* segment load */
 	{inv, inv, inv, inv, inv, inv, inv, req, req, inv, inv, inv, inv},
 /* part dump	*/


Index: s390utils.spec
===================================================================
RCS file: /cvs/dist/rpms/s390utils/devel/s390utils.spec,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- s390utils.spec	10 Aug 2006 13:02:30 -0000	1.45
+++ s390utils.spec	12 Sep 2006 16:24:41 -0000	1.46
@@ -3,7 +3,7 @@
 Summary: Linux/390 specific utilities.
 Name: s390utils
 Version: 1.5.3
-Release: 8
+Release: 9
 Epoch: 2
 License: GPL
 Group: System Environment/Base
@@ -17,7 +17,7 @@
 Patch2: s390-tools-1.5.0-fdasd-raid.patch
 Patch3: s390-tools-1.5.0-fmtpercentage.patch
 Patch4: s390-tools-1.5.0-subdirs.patch
-Patch5: s390-tools-1.5.0-automenu.patch
+Patch5: s390-tools-1.5.3-automenu.patch
 Patch6: s390-tools-1.5.0-rhconf.patch
 Patch7: s390-tools-1.3.1-kernheader.patch
 Patch8: s390-tools-1.3.2-warnings.patch
@@ -25,7 +25,7 @@
 Patch20: cmsfs-1.1.8-kernel26.patch
 Patch40: src_vipa-2.0.3.-asm.patch
 BuildRoot: /var/tmp/%{name}-root
-Requires: sysfsutils
+Requires: sysfsutils libsysfs
 BuildRequires: libsysfs-devel indent zlib-devel net-snmp-devel
 #ExclusiveArch: s390 s390x
 %define _sbindir /sbin
@@ -154,6 +154,10 @@
 %{_mandir}/man8/*
 
 %changelog
+* Tue Sep 12 2006 Phil Knirsch <pknirsch at redhat.com> 2:1.5.3-9
+- Added libsysfs requirement (#201863)
+- Fixed zipl problem with missing default target for automenus (#202086)
+
 * Thu Aug 10 2006 Phil Knirsch <pknirsch at redhat.com> 2:1.5.3-8
 - Added missing sysfsutils requirement for lszfcp (#201863)
 


--- s390-tools-1.5.0-automenu.patch DELETED ---




More information about the fedora-cvs-commits mailing list