summaryrefslogtreecommitdiffstats
path: root/_irpm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>1999-12-17 00:21:09 +0000
committerPascal Rigaux <pixel@mandriva.com>1999-12-17 00:21:09 +0000
commit2b6d115da4ba39a0b30eb6e014684d82101f3265 (patch)
tree7ead586efca6413473c0b880d976f3dc5d7f2849 /_irpm
parent8bc2804dffe993ded66f55ec4a6d13d9e8ed0bd7 (diff)
downloadurpmi-2b6d115da4ba39a0b30eb6e014684d82101f3265.tar
urpmi-2b6d115da4ba39a0b30eb6e014684d82101f3265.tar.gz
urpmi-2b6d115da4ba39a0b30eb6e014684d82101f3265.tar.bz2
urpmi-2b6d115da4ba39a0b30eb6e014684d82101f3265.tar.xz
urpmi-2b6d115da4ba39a0b30eb6e014684d82101f3265.zip
no_comment
Diffstat (limited to '_irpm')
-rwxr-xr-x_irpm73
1 files changed, 73 insertions, 0 deletions
diff --git a/_irpm b/_irpm
new file mode 100755
index 00000000..a51f69e3
--- /dev/null
+++ b/_irpm
@@ -0,0 +1,73 @@
+#!/usr/bin/perl
+
+$automatic = 0;
+$timeout = 15;
+
+$DIR = "/etc/urpmi";
+$BASE = "$DIR/autoirpm";
+$INSTALL_SCRIPT_REP = "$BASE.scripts";
+
+($lang) = ($ENV{LC_ALL} || $ENV{LANGUAGE} || $ENV{LC_MESSAGES} || $ENV{LANG}) =~ /(..)/;
+
+
+$rpm = shift @ARGV;
+print STDERR "autoirpm: ", i18n("installing"), " $rpm\n";
+
+`xtest`;
+$X = ($? == 0);
+
+my $pid;
+$SIG{ALRM} = sub { $pid and kill 9, $pid; not_found(); };
+alarm $timeout;
+
+if (!$automatic) {
+ $interactive_mesg = i18n("Automatic installation of packages...\nYou requested installation of package") . " $rpm\n" . i18n("Is it ok?");
+ if ($X) {
+ my $ok = i18n("Ok");
+ my $cancel = i18n("Cancel");
+ ($pid = fork) or exec "gmessage", "-default", $ok, "-buttons", "$ok:0,$cancel:2", $interactive_mesg;
+ wait();
+ $? and not_found();
+ } else {
+ use POSIX;
+ if (isatty(0)) {
+ print $interactive_mesg, " (y/n) ";
+ <STDIN> =~ /y/i or not_found();
+ } else {
+ # Arghhh not in automatic and no way to contact the user... dying
+ not_found();
+ }
+ }
+}
+alarm 0;
+
+$urpmi = !$automatic && $X ? "gurpmi" : "urpmi";
+fork or exec $urpmi, "--comment", $ARGV[0], $rpm; wait;
+
+# launch the initial prog
+(readlink $ARGV[0]) !~ /$INSTALL_SCRIPT_REP/ and exec @ARGV;
+
+not_found();
+
+sub not_found {
+ print STDERR "$rpm: command not found\n";
+ exit 127;
+}
+sub i18n { $I18N{$lang}->{$_[0]} || $_[0]; }
+
+
+BEGIN {
+
+%I18N = (
+
+'fr' => {
+"installing", "installation de",
+"Automatic installation of packages...\nYou requested installation of package" => "Installation automatique des packages...\nVous avez demandé l'installation du package",
+"Is it ok?" => "On continue ?",
+"Ok" => "Continuer",
+"Cancel" => "Annuler",
+},
+
+);
+
+}