summaryrefslogtreecommitdiffstats
path: root/urpme
diff options
context:
space:
mode:
Diffstat (limited to 'urpme')
-rw-r--r--urpme12
1 files changed, 8 insertions, 4 deletions
diff --git a/urpme b/urpme
index 7dfc1301..6653a514 100644
--- a/urpme
+++ b/urpme
@@ -32,7 +32,7 @@ use urpm::orphans;
$ENV{PATH} = "/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin";
delete @ENV{qw(ENV BASH_ENV IFS CDPATH)};
-our ($test, $parallel, $force);
+our ($test, $parallel, $force, $env);
my $yesexpr =
#-PO: Add here the keys which might be pressed in the "Yes"-case.
N("Yy");
@@ -69,7 +69,9 @@ my @cmdline_pkgs_to_remove = @ARGV;
my $state = {};
-if ($< && !$test) {
+if ($env) {
+ urpm::set_env($urpm, $env);
+} elsif ($< && !$test) {
$urpm->{fatal}(1, N("Only superuser is allowed to remove packages"));
}
@@ -83,7 +85,7 @@ unless ($test) {
}
#- just configure parallel mode if available.
-my $_urpmi_lock = urpm::lock::urpmi_db($urpm, '', wait => $options{wait_lock});
+my $_urpmi_lock = !$env && urpm::lock::urpmi_db($urpm, '', wait => $options{wait_lock});
urpm::media::configure($urpm,
synthesis => ($parallel ? 'none' : ''),
parallel => $parallel,
@@ -154,7 +156,7 @@ my $msg =
. (@orphans ? P("(orphan package)", "(orphan packages)", scalar(@orphans)) . "\n" .
add_leading_spaces(join("\n", sort @orphans) . "\n") : ());
-if ($urpm->{options}{auto}) {
+if ($urpm->{options}{auto} || $env) {
$test and print STDOUT $msg;
} elsif ($parallel || @toremove > @cmdline_pkgs_to_remove) {
print STDOUT $msg;
@@ -166,6 +168,8 @@ print $test ?
N("testing removal of %s", join(' ', sort @toremove)) :
N("removing %s", join(' ', sort @toremove)), "\n";
+exit 0 if $env;
+
my %remove_options = (
test => $test,
force => $force,