Cleanup setup-ip script a bit
There is no longer a case where $INTERFACE is not set.
This commit is contained in:
parent
dd8de797e3
commit
6aa2b89fba
@ -181,8 +181,7 @@ if [ -z "$INTERFACE" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$INTERFACE" ]; then
|
if [ "$ACTION" == "add" ]; then
|
||||||
if [ "$ACTION" == "add" ]; then
|
|
||||||
MAC="$(get_mac_from_iface "$INTERFACE")"
|
MAC="$(get_mac_from_iface "$INTERFACE")"
|
||||||
if [ -n "$MAC" ]; then
|
if [ -n "$MAC" ]; then
|
||||||
ip="$(/usr/bin/qubesdb-read "/net-config/$MAC/ip" 2> /dev/null)" || ip=
|
ip="$(/usr/bin/qubesdb-read "/net-config/$MAC/ip" 2> /dev/null)" || ip=
|
||||||
@ -239,7 +238,7 @@ if [ -n "$INTERFACE" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
elif [ "$ACTION" == "remove" ]; then
|
elif [ "$ACTION" == "remove" ]; then
|
||||||
# make sure network is disabled, especially on shutdown, to prevent
|
# make sure network is disabled, especially on shutdown, to prevent
|
||||||
# leaks when firewall will get stopped too
|
# leaks when firewall will get stopped too
|
||||||
ip link set "$INTERFACE" down 2>/dev/null || :
|
ip link set "$INTERFACE" down 2>/dev/null || :
|
||||||
@ -247,9 +246,7 @@ if [ -n "$INTERFACE" ]; then
|
|||||||
# If exists, we delete NetworkManager configuration file to prevent duplicate entries
|
# If exists, we delete NetworkManager configuration file to prevent duplicate entries
|
||||||
nm_config="/etc/NetworkManager/system-connections/qubes-uplink-$INTERFACE"
|
nm_config="/etc/NetworkManager/system-connections/qubes-uplink-$INTERFACE"
|
||||||
rm -rf "$nm_config"
|
rm -rf "$nm_config"
|
||||||
else
|
else
|
||||||
echo "Invalid action '$ACTION'" >&2
|
echo "Invalid action '$ACTION'" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user