summaryrefslogtreecommitdiffstats
path: root/lib/Sbuild/ChrootUnshare.pm
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/Sbuild/ChrootUnshare.pm7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Sbuild/ChrootUnshare.pm b/lib/Sbuild/ChrootUnshare.pm
index 8fb2350..81e90ca 100644
--- a/lib/Sbuild/ChrootUnshare.pm
+++ b/lib/Sbuild/ChrootUnshare.pm
@@ -306,7 +306,7 @@ sub _get_exec_argv {
}
return (
- 'env', 'PATH=' . $self->get_conf('PATH'),
+ 'env', 'PATH=' . $self->get_conf('PATH'), "USER=$user", "LOGNAME=$user",
get_unshare_cmd({UNSHARE_FLAGS => $unshare, FORK => 1, IDMAP => $self->get('Uid Gid Map'), LINUX32 => $linux32}), 'sh', '-c', "
rootdir=\"\$1\"; shift;
user=\"\$1\"; shift;
@@ -318,7 +318,7 @@ sub _get_exec_argv {
shift; shift;
done;
hostname sbuild;
- echo \"127.0.0.1 localhost\\n127.0.1.1 sbuild\" > \"\$rootdir/etc/hosts\";
+ echo \"127.0.0.1 localhost\\n127.0.1.1 sbuild\\n::1 localhost ip6-localhost ip6-loopback\" > \"\$rootdir/etc/hosts\";
$network_setup
mkdir -p \"\$rootdir/dev\";
for f in null zero full random urandom tty console; do
@@ -337,9 +337,10 @@ sub _get_exec_argv {
mount -t tmpfs tmpfs \"\$rootdir/dev/shm\";
mkdir -p \"\$rootdir/sys\";
mount -o rbind /sys \"\$rootdir/sys\";
+ mount -t tmpfs tmpfs \"\$rootdir/sys/kernel\" -o mode=0000,size=4k,ro;
mkdir -p \"\$rootdir/proc\";
mount -t proc proc \"\$rootdir/proc\";
- exec /usr/sbin/chroot \"\$rootdir\" $init /sbin/runuser -u \"\$user\" -- sh -c \"cd \\\"\\\$1\\\" && shift && \\\"\\\$@\\\"\" -- \"\$dir\" \"\$@\";
+ exec /usr/sbin/chroot \"\$rootdir\" $init /sbin/runuser -p -u \"\$user\" -- sh -c \"cd \\\"\\\$1\\\" && shift && \\\"\\\$@\\\"\" -- \"\$dir\" \"\$@\";
", '--', $self->get('Session ID'), $user, $dir, @bind_mounts, '--'
);
}