Compare commits
2 commits
a0133a6393
...
825ad0bf73
Author | SHA1 | Date | |
---|---|---|---|
825ad0bf73 | |||
090ce862c7 |
29 changed files with 41 additions and 40 deletions
19
mmdebstrap
19
mmdebstrap
|
@ -963,6 +963,16 @@ sub run_dpkg_progress {
|
||||||
sub run_apt_progress {
|
sub run_apt_progress {
|
||||||
my $options = shift;
|
my $options = shift;
|
||||||
my @debs = @{ $options->{PKGS} // [] };
|
my @debs = @{ $options->{PKGS} // [] };
|
||||||
|
|
||||||
|
if ($verbosity_level >= 3) {
|
||||||
|
my @apt_debug_opts = qw(
|
||||||
|
-oDebug::pkgProblemResolver=true
|
||||||
|
-oDebug::pkgDepCache::Marker=1
|
||||||
|
-oDebug::pkgDepCache::AutoInstall=1
|
||||||
|
);
|
||||||
|
push @{ $options->{ARGV} }, @apt_debug_opts;
|
||||||
|
}
|
||||||
|
|
||||||
my $get_exec = sub {
|
my $get_exec = sub {
|
||||||
my @prefix = ();
|
my @prefix = ();
|
||||||
my @opts = ();
|
my @opts = ();
|
||||||
|
@ -1031,15 +1041,6 @@ sub run_apt_download_progress {
|
||||||
info "downloading packages with apt...";
|
info "downloading packages with apt...";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($verbosity_level >= 3) {
|
|
||||||
my @apt_debug_opts = qw(
|
|
||||||
-oDebug::pkgProblemResolver=true
|
|
||||||
-oDebug::pkgDepCache::Marker=1
|
|
||||||
-oDebug::pkgDepCache::AutoInstall=1
|
|
||||||
);
|
|
||||||
push @{ $options->{APT_ARGV} }, @apt_debug_opts;
|
|
||||||
}
|
|
||||||
|
|
||||||
pipe my $rfh, my $wfh;
|
pipe my $rfh, my $wfh;
|
||||||
my $pid = open my $fh, '-|' // error "fork() failed: $!";
|
my $pid = open my $fh, '-|' // error "fork() failed: $!";
|
||||||
if ($pid == 0) {
|
if ($pid == 0) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
sysctl -w kernel.unprivileged_userns_clone=1
|
sysctl -w kernel.unprivileged_userns_clone=1
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
runuser -u user -- {{ CMD }} --variant=custom --mode=unshare --setup-hook='env container=lxc debootstrap unstable "$1" {{ MIRROR }}' - /tmp/debian-mm.tar {{ MIRROR }}
|
runuser -u user -- {{ CMD }} --variant=custom --mode=unshare --setup-hook='env container=lxc debootstrap unstable "$1" {{ MIRROR }}' - /tmp/debian-mm.tar {{ MIRROR }}
|
||||||
|
|
||||||
mkdir /tmp/debian-mm
|
mkdir /tmp/debian-mm
|
||||||
|
|
|
@ -5,7 +5,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
||||||
echo "this test modifies the system and should only be run inside a container" >&2
|
echo "this test modifies the system and should only be run inside a container" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
sysctl -w kernel.unprivileged_userns_clone=0
|
sysctl -w kernel.unprivileged_userns_clone=0
|
||||||
runuser -u user -- {{ CMD }} --mode=auto --variant=apt {{ DIST }} /tmp/debian-chroot.tar.gz {{ MIRROR }}
|
runuser -u user -- {{ CMD }} --mode=auto --variant=apt {{ DIST }} /tmp/debian-chroot.tar.gz {{ MIRROR }}
|
||||||
tar -tf /tmp/debian-chroot.tar.gz | sort | diff -u tar1.txt -
|
tar -tf /tmp/debian-chroot.tar.gz | sort | diff -u tar1.txt -
|
||||||
|
|
|
@ -5,7 +5,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
||||||
echo "this test modifies the system and should only be run inside a container" >&2
|
echo "this test modifies the system and should only be run inside a container" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
sysctl -w kernel.unprivileged_userns_clone=1
|
sysctl -w kernel.unprivileged_userns_clone=1
|
||||||
export SOURCE_DATE_EPOCH={{ SOURCE_DATE_EPOCH }}
|
export SOURCE_DATE_EPOCH={{ SOURCE_DATE_EPOCH }}
|
||||||
{{ CMD }} --mode=root --variant={{ VARIANT }} {{ DIST }} /tmp/debian-chroot-root.{{ FORMAT }} {{ MIRROR }}
|
{{ CMD }} --mode=root --variant={{ VARIANT }} {{ DIST }} /tmp/debian-chroot-root.{{ FORMAT }} {{ MIRROR }}
|
||||||
|
|
|
@ -8,7 +8,7 @@ if [ "$(id -u)" -eq 0 ] && ! id -u user > /dev/null 2>&1; then
|
||||||
echo "this test modifies the system and should only be run inside a container" >&2
|
echo "this test modifies the system and should only be run inside a container" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
fi
|
fi
|
||||||
prefix=
|
prefix=
|
||||||
[ "$(id -u)" -eq 0 ] && prefix="runuser -u user --"
|
[ "$(id -u)" -eq 0 ] && prefix="runuser -u user --"
|
||||||
|
|
|
@ -6,7 +6,7 @@ if [ "$(id -u)" -eq 0 ] && ! id -u user > /dev/null 2>&1; then
|
||||||
echo "this test modifies the system and should only be run inside a container" >&2
|
echo "this test modifies the system and should only be run inside a container" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
fi
|
fi
|
||||||
if [ "{{ MODE }}" = unshare ]; then
|
if [ "{{ MODE }}" = unshare ]; then
|
||||||
if [ ! -e /mmdebstrap-testenv ]; then
|
if [ ! -e /mmdebstrap-testenv ]; then
|
||||||
|
|
|
@ -5,7 +5,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
||||||
echo "this test modifies the system and should only be run inside a container" >&2
|
echo "this test modifies the system and should only be run inside a container" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
sysctl -w kernel.unprivileged_userns_clone=1
|
sysctl -w kernel.unprivileged_userns_clone=1
|
||||||
runuser -u user -- {{ CMD }} --mode=unshare --variant=apt {{ DIST }} /tmp/debian-chroot.tar.gz {{ MIRROR }}
|
runuser -u user -- {{ CMD }} --mode=unshare --variant=apt {{ DIST }} /tmp/debian-chroot.tar.gz {{ MIRROR }}
|
||||||
printf '\037\213\010' | cmp --bytes=3 /tmp/debian-chroot.tar.gz -
|
printf '\037\213\010' | cmp --bytes=3 /tmp/debian-chroot.tar.gz -
|
||||||
|
|
|
@ -14,7 +14,7 @@ if [ "$(id -u)" -eq 0 ] && [ "{{ MODE }}" != root ] && [ "{{ MODE }}" != auto ];
|
||||||
echo "this test modifies the system and should only be run inside a container" >&2
|
echo "this test modifies the system and should only be run inside a container" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
fi
|
fi
|
||||||
if [ "{{ MODE }}" = unshare ]; then
|
if [ "{{ MODE }}" = unshare ]; then
|
||||||
if [ ! -e /mmdebstrap-testenv ]; then
|
if [ ! -e /mmdebstrap-testenv ]; then
|
||||||
|
|
|
@ -7,7 +7,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
||||||
fi
|
fi
|
||||||
# https://www.etalabs.net/sh_tricks.html
|
# https://www.etalabs.net/sh_tricks.html
|
||||||
quote () { printf %s\\n "$1" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/'/" ; }
|
quote () { printf %s\\n "$1" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/'/" ; }
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
sysctl -w kernel.unprivileged_userns_clone=1
|
sysctl -w kernel.unprivileged_userns_clone=1
|
||||||
homedir=$(runuser -u user -- sh -c 'cd && pwd')
|
homedir=$(runuser -u user -- sh -c 'cd && pwd')
|
||||||
# apt:test/integration/test-apt-key
|
# apt:test/integration/test-apt-key
|
||||||
|
|
|
@ -5,7 +5,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
||||||
echo "this test modifies the system and should only be run inside a container" >&2
|
echo "this test modifies the system and should only be run inside a container" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
sysctl -w kernel.unprivileged_userns_clone=1
|
sysctl -w kernel.unprivileged_userns_clone=1
|
||||||
mkdir /tmp/debian-chroot
|
mkdir /tmp/debian-chroot
|
||||||
chmod 700 /tmp/debian-chroot
|
chmod 700 /tmp/debian-chroot
|
||||||
|
|
|
@ -12,7 +12,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ "$(id -u)" -eq 0 ] && ! id -u user > /dev/null 2>&1; then
|
if [ "$(id -u)" -eq 0 ] && ! id -u user > /dev/null 2>&1; then
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
fi
|
fi
|
||||||
prefix=
|
prefix=
|
||||||
[ "$(id -u)" -eq 0 ] && [ "{{ MODE }}" != "root" ] && prefix="runuser -u user --"
|
[ "$(id -u)" -eq 0 ] && [ "{{ MODE }}" != "root" ] && prefix="runuser -u user --"
|
||||||
|
@ -117,8 +117,8 @@ END
|
||||||
# use script to create a fake tty
|
# use script to create a fake tty
|
||||||
# run all tests as root and as a normal user (the latter requires ptmxmode=666)
|
# run all tests as root and as a normal user (the latter requires ptmxmode=666)
|
||||||
script -qfec "$prefix {{ CMD }} --mode={{ MODE }} --variant=apt \
|
script -qfec "$prefix {{ CMD }} --mode={{ MODE }} --variant=apt \
|
||||||
--include=gcc,libc6-dev,python3,adduser \
|
--include=gcc,libc6-dev,python3,passwd \
|
||||||
--customize-hook='chroot \"\$1\" adduser --gecos user --disabled-password user' \
|
--customize-hook='chroot \"\$1\" useradd --home-dir /home/user --create-home user' \
|
||||||
--customize-hook='chroot \"\$1\" python3 -c \"import pty; print(pty.openpty())\"' \
|
--customize-hook='chroot \"\$1\" python3 -c \"import pty; print(pty.openpty())\"' \
|
||||||
--customize-hook='chroot \"\$1\" runuser -u user -- python3 -c \"import pty; print(pty.openpty())\"' \
|
--customize-hook='chroot \"\$1\" runuser -u user -- python3 -c \"import pty; print(pty.openpty())\"' \
|
||||||
--customize-hook='chroot \"\$1\" script -c \"echo foobar\"' \
|
--customize-hook='chroot \"\$1\" script -c \"echo foobar\"' \
|
||||||
|
|
|
@ -5,7 +5,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
||||||
echo "this test modifies the system and should only be run inside a container" >&2
|
echo "this test modifies the system and should only be run inside a container" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
sysctl -w kernel.unprivileged_userns_clone=1
|
sysctl -w kernel.unprivileged_userns_clone=1
|
||||||
rm /etc/subuid
|
rm /etc/subuid
|
||||||
ret=0
|
ret=0
|
||||||
|
|
|
@ -5,7 +5,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
||||||
echo "this test modifies the system and should only be run inside a container" >&2
|
echo "this test modifies the system and should only be run inside a container" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
sysctl -w kernel.unprivileged_userns_clone=1
|
sysctl -w kernel.unprivileged_userns_clone=1
|
||||||
awk -F: '$1!="user"' /etc/subuid > /etc/subuid.tmp
|
awk -F: '$1!="user"' /etc/subuid > /etc/subuid.tmp
|
||||||
mv /etc/subuid.tmp /etc/subuid
|
mv /etc/subuid.tmp /etc/subuid
|
||||||
|
|
|
@ -6,7 +6,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ "$(id -u)" -eq 0 ] && ! id -u user > /dev/null 2>&1; then
|
if [ "$(id -u)" -eq 0 ] && ! id -u user > /dev/null 2>&1; then
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
fi
|
fi
|
||||||
prefix=
|
prefix=
|
||||||
[ "$(id -u)" -eq 0 ] && [ "{{ MODE }}" != "root" ] && prefix="runuser -u user --"
|
[ "$(id -u)" -eq 0 ] && [ "{{ MODE }}" != "root" ] && prefix="runuser -u user --"
|
||||||
|
|
|
@ -6,7 +6,7 @@ if [ "$(id -u)" -eq 0 ] && ! id -u user > /dev/null 2>&1; then
|
||||||
echo "this test modifies the system and should only be run inside a container" >&2
|
echo "this test modifies the system and should only be run inside a container" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
fi
|
fi
|
||||||
prefix=
|
prefix=
|
||||||
[ "$(id -u)" -eq 0 ] && prefix="runuser -u user --"
|
[ "$(id -u)" -eq 0 ] && prefix="runuser -u user --"
|
||||||
|
|
|
@ -7,7 +7,7 @@ if [ "$(id -u)" -eq 0 ] && ! id -u user > /dev/null 2>&1; then
|
||||||
echo "this test modifies the system and should only be run inside a container" >&2
|
echo "this test modifies the system and should only be run inside a container" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
fi
|
fi
|
||||||
prefix=
|
prefix=
|
||||||
[ "$(id -u)" -eq 0 ] && prefix="runuser -u user --"
|
[ "$(id -u)" -eq 0 ] && prefix="runuser -u user --"
|
||||||
|
|
|
@ -7,7 +7,7 @@ if [ "$(id -u)" -eq 0 ] && ! id -u user > /dev/null 2>&1; then
|
||||||
echo "this test modifies the system and should only be run inside a container" >&2
|
echo "this test modifies the system and should only be run inside a container" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
fi
|
fi
|
||||||
prefix=
|
prefix=
|
||||||
[ "$(id -u)" -eq 0 ] && prefix="runuser -u user --"
|
[ "$(id -u)" -eq 0 ] && prefix="runuser -u user --"
|
||||||
|
|
|
@ -6,7 +6,7 @@ if [ "$(id -u)" -eq 0 ] && ! id -u user > /dev/null 2>&1; then
|
||||||
echo "this test modifies the system and should only be run inside a container" >&2
|
echo "this test modifies the system and should only be run inside a container" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
fi
|
fi
|
||||||
prefix=
|
prefix=
|
||||||
[ "$(id -u)" -eq 0 ] && prefix="runuser -u user --"
|
[ "$(id -u)" -eq 0 ] && prefix="runuser -u user --"
|
||||||
|
|
|
@ -5,7 +5,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
||||||
echo "this test modifies the system and should only be run inside a container" >&2
|
echo "this test modifies the system and should only be run inside a container" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
sysctl -w kernel.unprivileged_userns_clone=1
|
sysctl -w kernel.unprivileged_userns_clone=1
|
||||||
export SOURCE_DATE_EPOCH={{ SOURCE_DATE_EPOCH }}
|
export SOURCE_DATE_EPOCH={{ SOURCE_DATE_EPOCH }}
|
||||||
|
|
||||||
|
|
|
@ -38,9 +38,9 @@ chroot "$rootfs" env --chdir=/mnt \
|
||||||
{{ DIST }} /tmp/chroot-fakechroot.tar {{ MIRROR }}
|
{{ DIST }} /tmp/chroot-fakechroot.tar {{ MIRROR }}
|
||||||
SCRIPT
|
SCRIPT
|
||||||
chmod +x script.sh
|
chmod +x script.sh
|
||||||
{{ CMD }} --mode=root --variant=apt --include=perl,python3,adduser,fakeroot,fakechroot \
|
{{ CMD }} --mode=root --variant=apt --include=perl,python3,passwd,fakeroot,fakechroot \
|
||||||
--hook-dir=./hooks/no-merged-usr \
|
--hook-dir=./hooks/no-merged-usr \
|
||||||
--customize-hook='chroot "$1" adduser --gecos user --disabled-password user' \
|
--customize-hook='chroot "$1" useradd --home-dir /home/user --create-home user' \
|
||||||
--customize-hook='chroot "$1" sh -c "exec test \"\$(realpath -e /usr/bin/ldd)\" = /usr/bin/ldd"' \
|
--customize-hook='chroot "$1" sh -c "exec test \"\$(realpath -e /usr/bin/ldd)\" = /usr/bin/ldd"' \
|
||||||
--customize-hook='chroot "$1" sh -c "exec test ! -e /usr/sbin/ldconfig"' \
|
--customize-hook='chroot "$1" sh -c "exec test ! -e /usr/sbin/ldconfig"' \
|
||||||
--customize-hook=./script.sh \
|
--customize-hook=./script.sh \
|
||||||
|
|
|
@ -5,6 +5,6 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
||||||
echo "this test modifies the system and should only be run inside a container" >&2
|
echo "this test modifies the system and should only be run inside a container" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
sysctl -w kernel.unprivileged_userns_clone=1
|
sysctl -w kernel.unprivileged_userns_clone=1
|
||||||
runuser -u user -- {{ CMD }} --mode=unshare --variant=custom --include=dpkg,dash,diffutils,coreutils,libc-bin,sed {{ DIST }} /dev/null {{ MIRROR }}
|
runuser -u user -- {{ CMD }} --mode=unshare --variant=custom --include=dpkg,dash,diffutils,coreutils,libc-bin,sed {{ DIST }} /dev/null {{ MIRROR }}
|
||||||
|
|
|
@ -6,7 +6,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
rm /dev/console
|
rm /dev/console
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
sysctl -w kernel.unprivileged_userns_clone=1
|
sysctl -w kernel.unprivileged_userns_clone=1
|
||||||
runuser -u user -- {{ CMD }} --mode=unshare --variant=apt {{ DIST }} /tmp/debian-chroot.tar {{ MIRROR }}
|
runuser -u user -- {{ CMD }} --mode=unshare --variant=apt {{ DIST }} /tmp/debian-chroot.tar {{ MIRROR }}
|
||||||
tar -tf /tmp/debian-chroot.tar | sort | diff -u tar1.txt -
|
tar -tf /tmp/debian-chroot.tar | sort | diff -u tar1.txt -
|
||||||
|
|
|
@ -14,7 +14,7 @@ if [ "$(id -u)" -eq 0 ] && ! id -u user > /dev/null 2>&1; then
|
||||||
echo "this test modifies the system and should only be run inside a container" >&2
|
echo "this test modifies the system and should only be run inside a container" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
fi
|
fi
|
||||||
prefix=
|
prefix=
|
||||||
[ "$(id -u)" -eq 0 ] && prefix="runuser -u user --"
|
[ "$(id -u)" -eq 0 ] && prefix="runuser -u user --"
|
||||||
|
|
|
@ -10,7 +10,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$(id -u)" -eq 0 ] && ! id -u user > /dev/null 2>&1; then
|
if [ "$(id -u)" -eq 0 ] && ! id -u user > /dev/null 2>&1; then
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
fi
|
fi
|
||||||
|
|
||||||
prefix=
|
prefix=
|
||||||
|
|
|
@ -10,7 +10,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
[ "$(whoami)" = "root" ]
|
[ "$(whoami)" = "root" ]
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
sysctl -w kernel.unprivileged_userns_clone=1
|
sysctl -w kernel.unprivileged_userns_clone=1
|
||||||
cat << 'SCRIPT' > script.sh
|
cat << 'SCRIPT' > script.sh
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
|
@ -6,7 +6,7 @@ if [ "$(id -u)" -eq 0 ] && ! id -u user > /dev/null 2>&1; then
|
||||||
echo "this test modifies the system and should only be run inside a container" >&2
|
echo "this test modifies the system and should only be run inside a container" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
fi
|
fi
|
||||||
if [ "{{ MODE }}" = unshare ]; then
|
if [ "{{ MODE }}" = unshare ]; then
|
||||||
if [ ! -e /mmdebstrap-testenv ]; then
|
if [ ! -e /mmdebstrap-testenv ]; then
|
||||||
|
|
|
@ -6,7 +6,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
trap "rm -f /tmp/debian-chroot.tar /tmp/debian-chroot-shifted.tar /tmp/debian-chroot.txt /tmp/debian-chroot-shiftedback.tar /tmp/expected; rm -rf /tmp/debian-chroot" EXIT INT TERM
|
trap "rm -f /tmp/debian-chroot.tar /tmp/debian-chroot-shifted.tar /tmp/debian-chroot.txt /tmp/debian-chroot-shiftedback.tar /tmp/expected; rm -rf /tmp/debian-chroot" EXIT INT TERM
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
echo user:100000:65536 | cmp /etc/subuid -
|
echo user:100000:65536 | cmp /etc/subuid -
|
||||||
echo user:100000:65536 | cmp /etc/subgid -
|
echo user:100000:65536 | cmp /etc/subgid -
|
||||||
sysctl -w kernel.unprivileged_userns_clone=1
|
sysctl -w kernel.unprivileged_userns_clone=1
|
||||||
|
|
|
@ -6,7 +6,7 @@ if [ "$(id -u)" -eq 0 ] && ! id -u user > /dev/null 2>&1; then
|
||||||
echo "this test modifies the system and should only be run inside a container" >&2
|
echo "this test modifies the system and should only be run inside a container" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
fi
|
fi
|
||||||
if [ "{{ MODE }}" = unshare ]; then
|
if [ "{{ MODE }}" = unshare ]; then
|
||||||
if [ ! -e /mmdebstrap-testenv ]; then
|
if [ ! -e /mmdebstrap-testenv ]; then
|
||||||
|
|
|
@ -10,7 +10,7 @@ if [ "$(id -u)" -eq 0 ] && ! id -u user > /dev/null 2>&1; then
|
||||||
echo "this test modifies the system and should only be run inside a container" >&2
|
echo "this test modifies the system and should only be run inside a container" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
adduser --gecos user --disabled-password user
|
useradd --home-dir /home/user --create-home user
|
||||||
fi
|
fi
|
||||||
[ "$(id -u)" -eq 0 ] && prefix="runuser -u user --"
|
[ "$(id -u)" -eq 0 ] && prefix="runuser -u user --"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue