From cf03ae3e2a65e8a7d80514812c5880c5e8d4c3e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Thu, 20 Jun 2019 16:32:08 +0200 Subject: [PATCH] Better use '-z' and '-n' for readibility --- network/setup-ip | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/network/setup-ip b/network/setup-ip index cace94c..8c8a613 100755 --- a/network/setup-ip +++ b/network/setup-ip @@ -172,25 +172,25 @@ if [ -n "$INTERFACE" ]; then # Handle legacy values LEGACY_MAC="$(/usr/bin/qubesdb-read /qubes-mac 2> /dev/null)" - if [ "$MAC" == "$LEGACY_MAC" ] || [ "x$LEGACY_MAC" == "x" ]; then - if [ "x$ip" == "x" ]; then + if [ "$MAC" == "$LEGACY_MAC" ] || [ -z "$LEGACY_MAC" ]; then + if [ -z "$ip" ]; then ip="$(/usr/bin/qubesdb-read /qubes-ip 2> /dev/null)" fi - if [ "$ip6" == "x" ]; then + if [ -z "$ip6" ]; then ip6="$(/usr/bin/qubesdb-read /qubes-ip6 2> /dev/null)" fi - if [ "$gateway" == "x" ]; then + if [ -z "$gateway" ]; then gateway="$(/usr/bin/qubesdb-read /qubes-gateway)" fi - if [ "x$gateway6" == "x" ]; then + if [ -z "$gateway6" ]; then gateway6="$(/usr/bin/qubesdb-read /qubes-gateway6)" fi fi - if [ "x$netmask" == "x" ]; then + if [ -z "$netmask" ]; then netmask="255.255.255.255" fi - if [ "x$netmask6" == "x" ]; then + if [ -z "$netmask6" ]; then netmask6="128" fi @@ -209,7 +209,7 @@ if [ -n "$INTERFACE" ]; then fi network=$(qubesdb-read /qubes-netvm-network 2>/dev/null) - if [ "x$network" != "x" ]; then + if [ -n "$network" ]; then if ! qsvc disable-dns-server; then configure_qubes_ns fi