From 200dd8ce09808393f6c5ce9e775255cef9169f29 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Fri, 3 Mar 2006 16:16:07 +0000 Subject: Add option --silent-success to automatically add media (Thierry Vignaud) --- gurpmi.addmedia | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/gurpmi.addmedia b/gurpmi.addmedia index 5d86109e..7a5691ca 100755 --- a/gurpmi.addmedia +++ b/gurpmi.addmedia @@ -32,7 +32,8 @@ where is one of http:/// with removable:// and [options] are from - --update create an update medium. + --update create an update medium. + --silent-success don't show popup window on success "; exit(0); }; @@ -44,6 +45,7 @@ use common; require_root_capability(); use rpmdrake; +use Getopt::Long; eval { require ugtk2; ugtk2->import(qw(:all)) }; if ($@) { @@ -59,7 +61,14 @@ if (@ARGV == 1 && $ARGV[0] =~ /\.urpmi-media$/) { $fromfile = 1; } -my $update = 0; +my ($update, $silent_success) = (0, 0); + +GetOptions( + 'update' => \$update, + 'silent-success' => \$silent_success, +); + +# compatibility with -update: if ($ARGV[0] =~ /^-?-update/) { $update = 1; shift @ARGV; @@ -84,7 +93,7 @@ my $urpm = urpm->new; $urpm->read_config; if (add_medium_and_check($urpm, { probe_with => !$with }, $name, $url, $with_hdlist, update => $update)) { interactive_msg('gurpmi.addmedia', - N("Successfully added medium `%s'.", $name)); + N("Successfully added medium `%s'.", $name)) if !$silent_success; myexit(0); } else { myexit(-1); -- cgit v1.2.1