summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2006-03-03 17:03:16 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2006-03-03 17:03:16 +0000
commit17a223e79f0b4b948e876f558fe4d1da2b44b46d (patch)
tree3b7fed2492c7d12a972b276fa8a212eb3346168c
parentaea6ca1de499e91e990648883b997a00bacb2b07 (diff)
downloadurpmi-17a223e79f0b4b948e876f558fe4d1da2b44b46d.tar
urpmi-17a223e79f0b4b948e876f558fe4d1da2b44b46d.tar.gz
urpmi-17a223e79f0b4b948e876f558fe4d1da2b44b46d.tar.bz2
urpmi-17a223e79f0b4b948e876f558fe4d1da2b44b46d.tar.xz
urpmi-17a223e79f0b4b948e876f558fe4d1da2b44b46d.zip
Add --auto-select option in gurpmi first (non-root) half
-rw-r--r--gurpmi17
-rw-r--r--gurpmi.pm9
2 files changed, 19 insertions, 7 deletions
diff --git a/gurpmi b/gurpmi
index d92c45d0..0b92b3ac 100644
--- a/gurpmi
+++ b/gurpmi
@@ -1,7 +1,7 @@
#!/usr/bin/perl
#- Copyright (C) 2005 MandrakeSoft SA
-#- Copyright (C) 2005 Mandriva SA
+#- Copyright (C) 2005, 2006 Mandriva SA
use strict;
use warnings;
@@ -50,9 +50,15 @@ foreach (@all_rpms) {
/\.src\.rpm$/ ? push(@$srpms, $_) : push(@$rpms, $_);
}
+sub proceed {
+ #- we need to switch to root if we're not already (via consolehelper)
+ #- yes. hardcoded paths. safe.
+ exec $> ? '/usr/bin/gurpmi2' : '/usr/sbin/gurpmi2', @ARGV;
+}
+
#- Ask question: save or install ?
#- change depending on the number of rpms, and on the presence of srpms
-{
+if (@all_rpms + @gurpmi::names) {
my $msg = (
@$srpms > 0
? N("You have selected a source package:
@@ -81,6 +87,9 @@ You may prefer to just save it. What is your choice?", all_descriptions($rpms->[
Proceed?", all_descriptions(@all_rpms))
);
$mainbox->pack_start(new_label($msg), 1, 1, 0);
+} else {
+ #- we're doing an --auto-select, proceed without asking
+ proceed();
}
{ #- buttons
@@ -91,9 +100,7 @@ Proceed?", all_descriptions(@all_rpms))
$inst_button->signal_connect(clicked => sub {
#- performs installation.
quit();
- #- we need to switch to root if we're not already (via consolehelper)
- #- yes. hardcoded paths. safe.
- exec $> ? '/usr/bin/gurpmi2' : '/usr/sbin/gurpmi2', @ARGV;
+ proceed();
});
$save_button and $save_button->signal_connect(clicked => sub {
my $file_dialog = Gtk2::FileSelection->new(N("Choose location to save file"));
diff --git a/gurpmi.pm b/gurpmi.pm
index d312ae84..b00bb600 100644
--- a/gurpmi.pm
+++ b/gurpmi.pm
@@ -1,7 +1,7 @@
package gurpmi;
#- Copyright (C) 2005 MandrakeSoft SA
-#- Copyright (C) 2005 Mandriva SA
+#- Copyright (C) 2005, 2006 Mandriva SA
#- This is needed because text printed by Gtk2 will always be encoded
#- in UTF-8; we first check if LC_ALL is defined, because if it is,
@@ -30,6 +30,7 @@ gurpmi version $urpm::VERSION
Usage :
gurpmi <rpm> [ <rpm>... ]
Options :
+ --auto-select
--no-verify-rpm
USAGE
exit 0;
@@ -62,6 +63,10 @@ sub parse_command_line {
$options{'no-verify-rpm'} = 1;
next;
}
+ if ($_ eq '--auto-select') {
+ $options{'auto-select'} = 1;
+ next;
+ }
/^--?[hv?]/ and usage();
fatal(N("Unknown option %s", $_));
}
@@ -71,7 +76,7 @@ sub parse_command_line {
push @all_rpms, $_;
}
}
- @all_rpms + @names or fatal(N("No packages specified"));
+ $options{'auto-select'} || @all_rpms + @names or fatal(N("No packages specified"));
return @all_rpms;
}