Cleanup setup-ip script a bit

There is no longer a case where $INTERFACE is not set.
This commit is contained in:
Marek Marczykowski-Górecki 2020-12-03 20:51:49 +01:00
parent dd8de797e3
commit 6aa2b89fba
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -181,8 +181,7 @@ if [ -z "$INTERFACE" ]; then
exit 1
fi
if [ -n "$INTERFACE" ]; then
if [ "$ACTION" == "add" ]; then
if [ "$ACTION" == "add" ]; then
MAC="$(get_mac_from_iface "$INTERFACE")"
if [ -n "$MAC" ]; then
ip="$(/usr/bin/qubesdb-read "/net-config/$MAC/ip" 2> /dev/null)" || ip=
@ -239,7 +238,7 @@ if [ -n "$INTERFACE" ]; then
fi
fi
fi
elif [ "$ACTION" == "remove" ]; then
elif [ "$ACTION" == "remove" ]; then
# make sure network is disabled, especially on shutdown, to prevent
# leaks when firewall will get stopped too
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
nm_config="/etc/NetworkManager/system-connections/qubes-uplink-$INTERFACE"
rm -rf "$nm_config"
else
else
echo "Invalid action '$ACTION'" >&2
exit 1
fi
fi