summaryrefslogtreecommitdiffstats
path: root/urpmi
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2004-02-09 18:14:39 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2004-02-09 18:14:39 +0000
commit0130f5d402e27dc0c91390065aaba3baf6c5d151 (patch)
tree238e664c2b0ac6ec727f7f94df92d86b4b5e0585 /urpmi
parent3eea4cf47d64c4edd12e7fcd1b9c1b9fd8b4ff44 (diff)
downloadurpmi-0130f5d402e27dc0c91390065aaba3baf6c5d151.tar
urpmi-0130f5d402e27dc0c91390065aaba3baf6c5d151.tar.gz
urpmi-0130f5d402e27dc0c91390065aaba3baf6c5d151.tar.bz2
urpmi-0130f5d402e27dc0c91390065aaba3baf6c5d151.tar.xz
urpmi-0130f5d402e27dc0c91390065aaba3baf6c5d151.zip
gurpmi: handle case where user clicked on a src.rpm, suggest
user is misleaded, allow to do nothing, really install, or save on disk
Diffstat (limited to 'urpmi')
-rwxr-xr-xurpmi32
1 files changed, 29 insertions, 3 deletions
diff --git a/urpmi b/urpmi
index c2a0216b..88507f35 100755
--- a/urpmi
+++ b/urpmi
@@ -140,9 +140,10 @@ usage:
sub to_utf8 { Locale::gettext::iconv($_[0], undef, "UTF-8") }
sub gmessage {
my ($msg, %params) = @_;
- my $ok = to_utf8(N("Ok"));
- my $cancel = to_utf8(N("Cancel"));
- my $buttons = ($params{ok_only} ? "$ok:0" : "$ok:0,$cancel:2") . $params{add_buttons};
+ my $ok = to_utf8($params{ok} || N("Ok"));
+ my $cancel = to_utf8($params{cancel} || N("Cancel"));
+ my $buttons = $params{ok_only} ? "$ok:0" : "$ok:0,$cancel:2";
+ $params{add_buttons} and $buttons .= ",$params{add_buttons}";
$msg = to_utf8($msg);
`gmessage -default "$ok" -buttons "$buttons" "$msg"`;
}
@@ -254,6 +255,31 @@ if ($install_src) {
@names = ();
}
+if ($X && @src_files == 1 && @files == 0 && @names == 0 && @src_names == 0 && !$force) {
+ gmessage(
+N("You have selected a source package:
+
+%s
+
+You probably didn't want to install it on your computer (installing it
+would allow you to make modifications to its sourcecode then compile it).
+
+What would you like to do?", $src_files[0]),
+ ok => N("Do nothing"),
+ cancel => N("Yes\\, really install it"),
+ add_buttons => N("Save file") . ':1');
+ my $rc = $? >> 8;
+ if ($rc == 0) {
+ exit(1);
+ } elsif ($rc == 1) {
+ my $msg = N("Choose location to save file");
+ my $location = `gfilechooser "$msg"`;
+ if (!$? && $msg) {
+ exec 'mv', '-f', $src_files[0], $location;
+ }
+ }
+}
+
#- question to describe what user who clicked on a rpm in file explorer is really doing
if ($X && @files == 1 && @names == 0 && $verbose >= 0) {
gmessage(