#!/bin/bash checkDockerNetworkRequirement() { if [[ $CFG_REQUIREMENT_DOCKER_NETWORK == "true" ]]; then if [[ $CFG_DOCKER_INSTALL_TYPE == "rootless" ]]; then if dockerCommandRun "docker network inspect $CFG_NETWORK_NAME > /dev/null 2>&1"; then local current_subnet=$(dockerCommandRun "docker network inspect $CFG_NETWORK_NAME --format '{{range .IPAM.Config}}{{.Subnet}}{{end}}' 2>/dev/null") if [[ "$current_subnet" == "$CFG_NETWORK_SUBNET" ]]; then isSuccessful "Docker Network $CFG_NETWORK_NAME exists with matching subnet" else updateDockerNetworkConfig "$current_subnet" fi else isNotice "Docker Network $CFG_NETWORK_NAME not found." DOCKER_NETWORK_SETUP_NEEDED="true" ((preinstallneeded++)) fi elif [[ $CFG_DOCKER_INSTALL_TYPE == "rooted" ]]; then if runFileOp docker network inspect $CFG_NETWORK_NAME > /dev/null 2>&1; then local current_subnet=$(runFileOp docker network inspect $CFG_NETWORK_NAME --format '{{range .IPAM.Config}}{{.Subnet}}{{end}}' 2>/dev/null) if [[ "$current_subnet" == "$CFG_NETWORK_SUBNET" ]]; then isSuccessful "Docker Network $CFG_NETWORK_NAME exists with matching subnet" else updateDockerNetworkConfig "$current_subnet" fi else isNotice "Docker Network $CFG_NETWORK_NAME not found." DOCKER_NETWORK_SETUP_NEEDED="true" ((preinstallneeded++)) fi fi fi }