aboutsummaryrefslogtreecommitdiffstats
path: root/iurt_root_command
diff options
context:
space:
mode:
authorOlivier Blin <blino@mageia.org>2010-11-04 11:48:37 +0000
committerOlivier Blin <blino@mageia.org>2010-11-04 11:48:37 +0000
commit2447c4aaeaf0eb4d45b732cdca4a40726628be78 (patch)
treedbf49713d1e5ec7e100a0482d839f9c1e3ff5641 /iurt_root_command
parentd3951f8abde875208ff11ed958196ba8059414e2 (diff)
downloadiurt-2447c4aaeaf0eb4d45b732cdca4a40726628be78.tar
iurt-2447c4aaeaf0eb4d45b732cdca4a40726628be78.tar.gz
iurt-2447c4aaeaf0eb4d45b732cdca4a40726628be78.tar.bz2
iurt-2447c4aaeaf0eb4d45b732cdca4a40726628be78.tar.xz
iurt-2447c4aaeaf0eb4d45b732cdca4a40726628be78.zip
extract check_urpmi_chroot_options
Diffstat (limited to 'iurt_root_command')
-rwxr-xr-xiurt_root_command15
1 files changed, 10 insertions, 5 deletions
diff --git a/iurt_root_command b/iurt_root_command
index ef90d5e..6de4785 100755
--- a/iurt_root_command
+++ b/iurt_root_command
@@ -405,13 +405,13 @@ sub useradd {
|| system('chroot', $dir, 'id', $username) == 0;
}
-sub urpmi {
- my ($_run, @options) = @_;
+sub check_urpmi_chroot_options {
+ my ($options) = @_;
# get all --something options
my %optvals;
my $current_opt;
- foreach (@options) {
+ foreach (@$options) {
if (/^--/) {
$current_opt = $_;
} else {
@@ -431,9 +431,14 @@ sub urpmi {
}
}
if (!$is_rooted) {
- plog('FAIL', "urpmi: must be rooted");
+ plog('FAIL', "urpmi commands must be rooted");
return;
}
- return !system('urpmi', @options);
+ return 1;
+}
+
+sub urpmi {
+ my ($_run, @options) = @_;
+ return check_urpmi_chroot_options(\@options) && !system('urpmi', @options);
}