Skip to content

Commit

Permalink
--podman: invert check for userns_clone #255
Browse files Browse the repository at this point in the history
  • Loading branch information
mviereck committed Jan 11, 2021
1 parent e6a969b commit 7371bed
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions x11docker
Original file line number Diff line number Diff line change
Expand Up @@ -6476,17 +6476,20 @@ check_host() { # check host environment
case $Network in
host) Hostip="127.0.0.1" ;;
*)
Hostip="$(ip -4 -o a | grep 'docker0' | awk '{print $4}' | cut -d/ -f1 | grep 172.17.0.1 ||: )"
#Hostip="$(hostname -I | cut -d' ' -f1)"
[ "$Hostip" ] || Hostip="$(ip -4 -o a | grep 'docker0' | awk '{print $4}' | cut -d/ -f1 | grep "172.17.0.1" ||: )"
#[ "$Hostip" ] || Hostip="$($Dockerexe network inspect bridge --format='{{.IPAM.Config}}' 2>/dev/null | awk '{print $2}')"
[ "$Hostip" ] || Hostip="$(ip -4 -o a | grep 'docker0' | awk '{print $4}' | cut -d/ -f1 | head -n1)"
[ "$Hostip" ] || Hostip="$(ip -4 -o a | awk '{print $4}' | cut -d/ -f1 | grep -v 127.0.0.1 | head -n1)"
[ "$Hostip" ] || Hostip="$(ip -4 -o a | awk '{print $4}' | cut -d/ -f1 | grep "^192\.168\.*" | head -n1)"
[ "$Hostip" ] || Hostip="$(ip -4 -o a | awk '{print $4}' | cut -d/ -f1 | grep -v "127.0.0.1" | head -n1)"
;;
esac
;;
*)
Hostip="$(ipconfig.exe | rmcr | grep -A6 'DockerNAT' | grep 'IPv4' | rev | cut -d' ' -f1 | rev)"
[ "$Hostip" ] || Hostip="$(ipconfig.exe | rmcr | grep 'IPv4' | grep -o '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*' | grep "^10\.0\.*" ||: )"
[ "$Hostip" ] || Hostip="$(ipconfig.exe | rmcr | grep 'IPv4' | head -n1 | rev | cut -d' ' -f1 | rev)"
Hostip="$(ipconfig.exe | rmcr | grep -A6 'DockerNAT' | grep 'IPv4' | grep -o '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*')"
[ "$Hostip" ] || Hostip="$(ipconfig.exe | rmcr | grep 'IPv4' | grep -o '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*' | grep "^192\.168\.*" | head -n1 )"
[ "$Hostip" ] || Hostip="$(ipconfig.exe | rmcr | grep 'IPv4' | grep -o '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*' | grep "^10\.0\.*" | head -n1 )"
[ "$Hostip" ] || Hostip="$(ipconfig.exe | rmcr | grep 'IPv4' | grep -o '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*' | head -n1 )"
;;
esac

Expand Down Expand Up @@ -7318,7 +7321,9 @@ check_option_interferences() { # check multiple option interferences, change se

case "$Podman" in
yes)
[ "$(cat /proc/sys/kernel/unprivileged_userns_clone)" = "1" ] || error "Option --podman: Linux kernel disallows unprivileged
# /proc/sys/kernel/unprivileged_userns_clone might exist on debian only.
# https://github.com/mviereck/x11docker/issues/255#issuecomment-758014962
[ "$(cat /proc/sys/kernel/unprivileged_userns_clone)" = "0" ] && error "Option --podman: Linux kernel disallows unprivileged
user namespace setup. Please run as root:
sysctl -w kernel.unprivileged_userns_clone=1"
store_runoption cap "CHOWN"
Expand Down

0 comments on commit 7371bed

Please sign in to comment.