Don't sanity check /etc/subgid and /etc/subuid when running as root

The /etc/subgid and /etc/subuid files are only meant to be used when
running rootless, and hence don't have an entry for root.

https://github.com/debarshiray/toolbox/issues/267
This commit is contained in:
Debarshi Ray 2019-09-23 18:19:32 +02:00
parent 691c551cd2
commit 9145ae7690

14
toolbox
View file

@ -1796,13 +1796,15 @@ if [ -f /run/.containerenv ] 2>&3; then
exit 1
fi
else
echo "$base_toolbox_command: checking if /etc/subgid and /etc/subuid have entries for user $USER" >&3
if [ "$user_id_real" -ne 0 ] 2>&3; then
echo "$base_toolbox_command: checking if /etc/subgid and /etc/subuid have entries for user $USER" >&3
if ! grep "^$USER:" /etc/subgid >/dev/null 2>&3 || ! grep "^$USER:" /etc/subuid >/dev/null 2>&3; then
echo "$base_toolbox_command: /etc/subgid and /etc/subuid don't have entries for user $USER" >&2
echo "See the podman(1), subgid(5), subuid(5) and usermod(8) manuals for more" >&2
echo "information." >&2
exit 1
if ! grep "^$USER:" /etc/subgid >/dev/null 2>&3 || ! grep "^$USER:" /etc/subuid >/dev/null 2>&3; then
echo "$base_toolbox_command: /etc/subgid and /etc/subuid don't have entries for user $USER" >&2
echo "See the podman(1), subgid(5), subuid(5) and usermod(8) manuals for more" >&2
echo "information." >&2
exit 1
fi
fi
if [ "$TOOLBOX_PATH" = "" ] 2>&3; then