'local result=$(cmd)' resets $? to 0 (the local builtin's own exit), so the
following checkSuccess always saw success regardless of cmd's real exit — the
mechanism that masked the de-sudo write failures. Split declaration from
assignment ('local result; result=$(cmd)') across all 235 active-code sites
(84 files) so the command's exit reaches checkSuccess. No behaviour change
beyond $? now being accurate (no set -e in runtime code; multi-line
assignments transform safely).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
35 lines
1.0 KiB
Bash
Executable File
35 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
installDockerNetwork()
|
|
{
|
|
# Check if network setup is needed
|
|
if [[ "$DOCKER_NETWORK_SETUP_NEEDED" == "true" ]]; then
|
|
isHeader "Create a Docker Network"
|
|
|
|
isNotice "Network $CFG_NETWORK_NAME not found, creating now"
|
|
|
|
# Check if we need to generate a new subnet
|
|
updateDockerNetworkSubnet
|
|
|
|
# Create the Docker network command
|
|
local network_create="docker network create \
|
|
--driver=bridge \
|
|
--subnet=$CFG_NETWORK_SUBNET \
|
|
--ip-range=${CFG_NETWORK_SUBNET%.*}.0/24 \
|
|
--gateway=${CFG_NETWORK_SUBNET%.*}.1 \
|
|
--opt com.docker.network.bridge.name=$CFG_NETWORK_NAME \
|
|
$CFG_NETWORK_NAME"
|
|
|
|
# Run the network creation command
|
|
local result; result=$(dockerCommandRun "$network_create")
|
|
if [[ $? -eq 0 ]]; then
|
|
checkSuccess "Docker network $CFG_NETWORK_NAME created successfully"
|
|
else
|
|
isError "Failed to create Docker network $CFG_NETWORK_NAME"
|
|
isError " $result"
|
|
fi
|
|
else
|
|
isNotice "Docker network $CFG_NETWORK_NAME already exists or setup not needed"
|
|
fi
|
|
}
|