All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] allow semodule -i to accept list of modules
@ 2007-01-08 21:43 Karl MacMillan
  2007-01-09  4:08 ` Joshua Brindle
  2007-01-09 16:17 ` Joshua Brindle
  0 siblings, 2 replies; 13+ messages in thread
From: Karl MacMillan @ 2007-01-08 21:43 UTC (permalink / raw)
  To: SELinux List

The following patch allows semodule to handle a list of modules for
installation (i.e., semodule -i *.pp now works).

Signed-off-by: Karl MacMillan <kmacmillan@mentalrootkit.com>

diff -r e37f9d8d6611 policycoreutils/semodule/semodule.c
--- a/policycoreutils/semodule/semodule.c	Mon Jan 08 15:00:14 2007 -0500
+++ b/policycoreutils/semodule/semodule.c	Mon Jan 08 16:37:23 2007 -0500
@@ -225,15 +225,6 @@ static void parse_command_line(int argc,
 			}
 		}
 	}
-	if (optind < argc) {
-		fprintf(stderr, "Extraneous arguments:  ");
-		while (optind < argc)
-			fprintf(stderr, "%s", argv[optind++]);
-		fprintf(stderr, "\n");
-		usage(argv[0]);
-		cleanup();
-		exit(1);
-	}
 	if ((build || reload) && num_commands) {
 		fprintf(stderr,
 			"build or reload should not be used with other commands\n");
@@ -244,6 +235,24 @@ static void parse_command_line(int argc,
 		fprintf(stderr, "At least one mode must be specified.\n");
 		usage(argv[0]);
 		exit(1);
+	}
+
+	if (optind < argc) {
+		/* if -i was the last command treat any remaining
+		 * arguments as modules to allow 'semodule -i *.pp' to
+		 * work as expected.
+		 */
+		if (commands[num_commands - 1].mode == INSTALL_M) {
+			while (optind < argc)
+				set_mode(INSTALL_M, argv[optind++]);
+		} else {
+			fprintf(stderr, "unknown additional arguments:\n");
+			while (optind < argc)
+				fprintf(stderr, " %s", argv[optind++]);
+			fprintf(stderr, "\n\n");
+			usage(argv[0]);
+			exit(1);
+		}
 	}
 }
 



--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2007-01-11 17:36 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-08 21:43 [PATCH] allow semodule -i to accept list of modules Karl MacMillan
2007-01-09  4:08 ` Joshua Brindle
2007-01-09 14:34   ` Karl MacMillan
2007-01-09 15:10     ` Joshua Brindle
2007-01-09 15:27       ` Karl MacMillan
2007-01-09 16:17 ` Joshua Brindle
2007-01-09 20:17   ` Stephen Smalley
2007-01-09 20:43     ` Stephen Smalley
2007-01-09 21:52       ` Karl MacMillan
2007-01-10 13:46         ` Stephen Smalley
2007-01-11 17:36           ` Stephen Smalley
2007-01-09 21:53       ` Joshua Brindle
2007-01-10 13:29         ` Stephen Smalley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.