aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xiurt_root_command3
-rw-r--r--lib/Iurt/Chroot.pm2
2 files changed, 3 insertions, 2 deletions
diff --git a/iurt_root_command b/iurt_root_command
index 90233a5..45894a5 100755
--- a/iurt_root_command
+++ b/iurt_root_command
@@ -382,5 +382,6 @@ sub umount {
sub useradd {
my ($_run, $dir, $username, $o_uid) = @_;
check_path_authorized($dir) or return;
- return !system('chroot', $dir, 'useradd', if_($o_uid, '-o', '--uid', $o_uid), $username);
+ return system('chroot', $dir, 'useradd', if_($o_uid, '-o', '--uid', $o_uid), $username) == 0
+ || system('chroot', $dir, 'id', $username) == 0;
}
diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm
index e23cf6f..e34f21d 100644
--- a/lib/Iurt/Chroot.pm
+++ b/lib/Iurt/Chroot.pm
@@ -183,7 +183,7 @@ sub add_local_user {
# if (system(qq|sudo chroot $chroot_tmp usermod -u $run->{uid} builder|)) {
if ($uid) {
- if (sudo($run, $config, "--useradd", $chroot_tmp, $luser, $uid) || system("$sudo chroot $chroot_tmp id $luser >/dev/null 2>&1")) {
+ if (!sudo($run, $config, "--useradd", $chroot_tmp, $luser, $uid)) {
plog('ERR', "ERROR: setting userid $uid to $luser in " .
"$chroot_tmp failed, checking the chroot");
check_build_chroot($run->{chroot_path}, $run->{chroot_tar}, $run,