diff --git a/setup-bazel/action.yml b/setup-bazel/action.yml index ef48c1d..85c20c0 100644 --- a/setup-bazel/action.yml +++ b/setup-bazel/action.yml @@ -20,13 +20,24 @@ runs: - name: Fix MTU size for Proxmox/Docker network compatibility shell: bash run: | - DEFAULT_INTERFACE=$(ip route show | grep default | awk '{print $5}') - if [ -n "$DEFAULT_INTERFACE" ]; then - echo "Setting MTU of $DEFAULT_INTERFACE to 1400..." - if [ "$(id -u)" -eq 0 ]; then - ip link set dev "$DEFAULT_INTERFACE" mtu 1400 || true + if ! command -v ip &> /dev/null; then + if command -v apt-get &> /dev/null && [ "$(id -u)" -eq 0 ]; then + echo "ip command not found. Installing iproute2..." + apt-get update -qy && apt-get install -qy iproute2 || true else - sudo ip link set dev "$DEFAULT_INTERFACE" mtu 1400 || true + echo "ip command not found and cannot install. Skipping MTU configuration." + fi + fi + + if command -v ip &> /dev/null; then + DEFAULT_INTERFACE=$(ip route show | grep default | awk '{print $5}') + if [ -n "$DEFAULT_INTERFACE" ]; then + echo "Setting MTU of $DEFAULT_INTERFACE to 1400..." + if [ "$(id -u)" -eq 0 ]; then + ip link set dev "$DEFAULT_INTERFACE" mtu 1400 || true + else + sudo ip link set dev "$DEFAULT_INTERFACE" mtu 1400 || true + fi fi fi