tests: replace adduser with useradd
This commit is contained in:
parent
a0133a6393
commit
090ce862c7
28 changed files with 31 additions and 31 deletions
|
@ -7,7 +7,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
|||
exit 1
|
||||
fi
|
||||
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 }}
|
||||
|
||||
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
|
||||
exit 1
|
||||
fi
|
||||
adduser --gecos user --disabled-password user
|
||||
useradd --home-dir /home/user --create-home user
|
||||
sysctl -w kernel.unprivileged_userns_clone=0
|
||||
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 -
|
||||
|
|
|
@ -5,7 +5,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
|||
echo "this test modifies the system and should only be run inside a container" >&2
|
||||
exit 1
|
||||
fi
|
||||
adduser --gecos user --disabled-password user
|
||||
useradd --home-dir /home/user --create-home user
|
||||
sysctl -w kernel.unprivileged_userns_clone=1
|
||||
export SOURCE_DATE_EPOCH={{ SOURCE_DATE_EPOCH }}
|
||||
{{ 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
|
||||
exit 1
|
||||
fi
|
||||
adduser --gecos user --disabled-password user
|
||||
useradd --home-dir /home/user --create-home user
|
||||
fi
|
||||
prefix=
|
||||
[ "$(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
|
||||
exit 1
|
||||
fi
|
||||
adduser --gecos user --disabled-password user
|
||||
useradd --home-dir /home/user --create-home user
|
||||
fi
|
||||
if [ "{{ MODE }}" = unshare ]; 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
|
||||
exit 1
|
||||
fi
|
||||
adduser --gecos user --disabled-password user
|
||||
useradd --home-dir /home/user --create-home user
|
||||
sysctl -w kernel.unprivileged_userns_clone=1
|
||||
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 -
|
||||
|
|
|
@ -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
|
||||
exit 1
|
||||
fi
|
||||
adduser --gecos user --disabled-password user
|
||||
useradd --home-dir /home/user --create-home user
|
||||
fi
|
||||
if [ "{{ MODE }}" = unshare ]; then
|
||||
if [ ! -e /mmdebstrap-testenv ]; then
|
||||
|
|
|
@ -7,7 +7,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
|||
fi
|
||||
# https://www.etalabs.net/sh_tricks.html
|
||||
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
|
||||
homedir=$(runuser -u user -- sh -c 'cd && pwd')
|
||||
# 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
|
||||
exit 1
|
||||
fi
|
||||
adduser --gecos user --disabled-password user
|
||||
useradd --home-dir /home/user --create-home user
|
||||
sysctl -w kernel.unprivileged_userns_clone=1
|
||||
mkdir /tmp/debian-chroot
|
||||
chmod 700 /tmp/debian-chroot
|
||||
|
|
|
@ -12,7 +12,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
|||
exit 1
|
||||
fi
|
||||
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
|
||||
prefix=
|
||||
[ "$(id -u)" -eq 0 ] && [ "{{ MODE }}" != "root" ] && prefix="runuser -u user --"
|
||||
|
@ -117,8 +117,8 @@ END
|
|||
# use script to create a fake tty
|
||||
# run all tests as root and as a normal user (the latter requires ptmxmode=666)
|
||||
script -qfec "$prefix {{ CMD }} --mode={{ MODE }} --variant=apt \
|
||||
--include=gcc,libc6-dev,python3,adduser \
|
||||
--customize-hook='chroot \"\$1\" adduser --gecos user --disabled-password user' \
|
||||
--include=gcc,libc6-dev,python3,passwd \
|
||||
--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\" runuser -u user -- python3 -c \"import pty; print(pty.openpty())\"' \
|
||||
--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
|
||||
exit 1
|
||||
fi
|
||||
adduser --gecos user --disabled-password user
|
||||
useradd --home-dir /home/user --create-home user
|
||||
sysctl -w kernel.unprivileged_userns_clone=1
|
||||
rm /etc/subuid
|
||||
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
|
||||
exit 1
|
||||
fi
|
||||
adduser --gecos user --disabled-password user
|
||||
useradd --home-dir /home/user --create-home user
|
||||
sysctl -w kernel.unprivileged_userns_clone=1
|
||||
awk -F: '$1!="user"' /etc/subuid > /etc/subuid.tmp
|
||||
mv /etc/subuid.tmp /etc/subuid
|
||||
|
|
|
@ -6,7 +6,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
|||
exit 1
|
||||
fi
|
||||
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
|
||||
prefix=
|
||||
[ "$(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
|
||||
exit 1
|
||||
fi
|
||||
adduser --gecos user --disabled-password user
|
||||
useradd --home-dir /home/user --create-home user
|
||||
fi
|
||||
prefix=
|
||||
[ "$(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
|
||||
exit 1
|
||||
fi
|
||||
adduser --gecos user --disabled-password user
|
||||
useradd --home-dir /home/user --create-home user
|
||||
fi
|
||||
prefix=
|
||||
[ "$(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
|
||||
exit 1
|
||||
fi
|
||||
adduser --gecos user --disabled-password user
|
||||
useradd --home-dir /home/user --create-home user
|
||||
fi
|
||||
prefix=
|
||||
[ "$(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
|
||||
exit 1
|
||||
fi
|
||||
adduser --gecos user --disabled-password user
|
||||
useradd --home-dir /home/user --create-home user
|
||||
fi
|
||||
prefix=
|
||||
[ "$(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
|
||||
exit 1
|
||||
fi
|
||||
adduser --gecos user --disabled-password user
|
||||
useradd --home-dir /home/user --create-home user
|
||||
sysctl -w kernel.unprivileged_userns_clone=1
|
||||
export SOURCE_DATE_EPOCH={{ SOURCE_DATE_EPOCH }}
|
||||
|
||||
|
|
|
@ -38,9 +38,9 @@ chroot "$rootfs" env --chdir=/mnt \
|
|||
{{ DIST }} /tmp/chroot-fakechroot.tar {{ MIRROR }}
|
||||
SCRIPT
|
||||
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 \
|
||||
--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 ! -e /usr/sbin/ldconfig"' \
|
||||
--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
|
||||
exit 1
|
||||
fi
|
||||
adduser --gecos user --disabled-password user
|
||||
useradd --home-dir /home/user --create-home user
|
||||
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 }}
|
||||
|
|
|
@ -6,7 +6,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
|||
exit 1
|
||||
fi
|
||||
rm /dev/console
|
||||
adduser --gecos user --disabled-password user
|
||||
useradd --home-dir /home/user --create-home user
|
||||
sysctl -w kernel.unprivileged_userns_clone=1
|
||||
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 -
|
||||
|
|
|
@ -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
|
||||
exit 1
|
||||
fi
|
||||
adduser --gecos user --disabled-password user
|
||||
useradd --home-dir /home/user --create-home user
|
||||
fi
|
||||
prefix=
|
||||
[ "$(id -u)" -eq 0 ] && prefix="runuser -u user --"
|
||||
|
|
|
@ -10,7 +10,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
|||
fi
|
||||
|
||||
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
|
||||
|
||||
prefix=
|
||||
|
|
|
@ -10,7 +10,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
|||
exit 1
|
||||
fi
|
||||
[ "$(whoami)" = "root" ]
|
||||
adduser --gecos user --disabled-password user
|
||||
useradd --home-dir /home/user --create-home user
|
||||
sysctl -w kernel.unprivileged_userns_clone=1
|
||||
cat << 'SCRIPT' > script.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
|
||||
exit 1
|
||||
fi
|
||||
adduser --gecos user --disabled-password user
|
||||
useradd --home-dir /home/user --create-home user
|
||||
fi
|
||||
if [ "{{ MODE }}" = unshare ]; then
|
||||
if [ ! -e /mmdebstrap-testenv ]; then
|
||||
|
|
|
@ -6,7 +6,7 @@ if [ ! -e /mmdebstrap-testenv ]; then
|
|||
exit 1
|
||||
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
|
||||
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/subgid -
|
||||
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
|
||||
exit 1
|
||||
fi
|
||||
adduser --gecos user --disabled-password user
|
||||
useradd --home-dir /home/user --create-home user
|
||||
fi
|
||||
if [ "{{ MODE }}" = unshare ]; 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
|
||||
exit 1
|
||||
fi
|
||||
adduser --gecos user --disabled-password user
|
||||
useradd --home-dir /home/user --create-home user
|
||||
fi
|
||||
[ "$(id -u)" -eq 0 ] && prefix="runuser -u user --"
|
||||
|
||||
|
|
Loading…
Reference in a new issue