mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-06-04 07:27:19 +08:00
feat: Podman detection (#944)
This commit is contained in:
parent
11d4fafa6d
commit
8fb6f1f9ad
@ -199,14 +199,16 @@ configureNAT() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -c /dev/net/tun ]; then
|
if [ ! -c /dev/net/tun ]; then
|
||||||
error "$tuntap" && return 1
|
[[ "$PODMAN" != [Yy1]* ]] && error "$tuntap"
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check port forwarding flag
|
# Check port forwarding flag
|
||||||
if [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]]; then
|
if [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]]; then
|
||||||
{ sysctl -w net.ipv4.ip_forward=1 > /dev/null; rc=$?; } || :
|
{ sysctl -w net.ipv4.ip_forward=1 > /dev/null; rc=$?; } || :
|
||||||
if (( rc != 0 )) || [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]]; then
|
if (( rc != 0 )) || [[ $(< /proc/sys/net/ipv4/ip_forward) -eq 0 ]]; then
|
||||||
error "IP forwarding is disabled. $ADD_ERR --sysctl net.ipv4.ip_forward=1" && return 1
|
[[ "$PODMAN" != [Yy1]* ]] && error "IP forwarding is disabled. $ADD_ERR --sysctl net.ipv4.ip_forward=1"
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -426,6 +428,7 @@ getInfo() {
|
|||||||
[ -n "$IP6" ] && IP6=$(echo "$IP6" | sed -e's/^.*inet6 \([^ ]*\)\/.*$/\1/;t;d' | head -n 1)
|
[ -n "$IP6" ] && IP6=$(echo "$IP6" | sed -e's/^.*inet6 \([^ ]*\)\/.*$/\1/;t;d' | head -n 1)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[ -f "/run/.containerenv" ] && PODMAN="Y" || PODMAN="N"
|
||||||
echo "$IP" > /run/shm/qemu.ip
|
echo "$IP" > /run/shm/qemu.ip
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
@ -496,10 +499,10 @@ else
|
|||||||
closeBridge
|
closeBridge
|
||||||
NETWORK="user"
|
NETWORK="user"
|
||||||
msg="falling back to user-mode networking!"
|
msg="falling back to user-mode networking!"
|
||||||
if [ ! -f "/run/.containerenv" ]; then
|
if [[ "$PODMAN" != [Yy1]* ]]; then
|
||||||
msg="an error occured, $msg"
|
msg="an error occured, $msg"
|
||||||
else
|
else
|
||||||
msg="podman rootless mode detected, $msg"
|
msg="podman detected, $msg"
|
||||||
fi
|
fi
|
||||||
warn "$msg"
|
warn "$msg"
|
||||||
[ -z "$USER_PORTS" ] && info "Notice: port mapping will not work without \"USER_PORTS\" now."
|
[ -z "$USER_PORTS" ] && info "Notice: port mapping will not work without \"USER_PORTS\" now."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user