From 057113fa55e5731ada1e414c607ba3bc85d676e6 Mon Sep 17 00:00:00 2001 From: Olav Vitters Date: Tue, 28 Jul 2020 10:44:25 +0200 Subject: ifup-eth: make use of is_true and is_false in our customizations --- network-scripts/ifup-eth | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/network-scripts/ifup-eth b/network-scripts/ifup-eth index ea0ebef8..5562d46c 100755 --- a/network-scripts/ifup-eth +++ b/network-scripts/ifup-eth @@ -141,7 +141,7 @@ IS_WIRELESS= if is_wireless_device ${DEVICE}; then # ralink devices need to be up for wireless-tools to work ip link set dev ${DEVICE} up - if [ -n "${daemon}" -o "$MII_NOT_SUPPORTED" = "yes" ]; then + if [ -n "${daemon}" ] || is_true "$MII_NOT_SUPPORTED" ; then # try to trigger association (and always load wireless settings) WIRELESS_CONFIG="wireless.d/$WIRELESS_ESSID" [ -f "$WIRELESS_CONFIG" ] && source "$WIRELESS_CONFIG" @@ -154,7 +154,7 @@ if is_wireless_device ${DEVICE}; then -c /etc/wpa_supplicant.conf \ -D ${WIRELESS_WPA_DRIVER} fi - if [ "$WIRELESS_WPA_REASSOCIATE" = "yes" ]; then + if is_true "$WIRELESS_WPA_REASSOCIATE"; then sleep 2 wpa_cli reassociate fi @@ -268,7 +268,7 @@ if [ -n "${BRIDGE}" ]; then fi # exec ifplugd daemon at boot if supported -if [ -n "${daemon}" -a "$MII_NOT_SUPPORTED" != "yes" ]; then +if [ -n "${daemon}" ] && ! is_true "$MII_NOT_SUPPORTED"; then IFPLUGD_ARGS="${IFPLUGD_ARGS=-I -b}" exec /sbin/ifplugd $IFPLUGD_ARGS -i $DEVICE fi @@ -309,16 +309,16 @@ case $(basename $DHCP_CLIENT) in dhcpcd) DHCP_ARGS="--waitip" [ -n "${DHCP_HOSTNAME}" ] && DHCP_ARGS="${DHCP_ARGS} -h ${DHCP_HOSTNAME}" - [ "${PEERDNS}" = "no" ] && DHCP_ARGS="${DHCP_ARGS} -C resolv.conf" - [ "${PEERGATEWAY}" = "no" ] && DHCP_ARGS="${DHCP_ARGS} -G" + is_false "${PEERDNS}" && DHCP_ARGS="${DHCP_ARGS} -C resolv.conf" + is_false "${PEERGATEWAY}" && DHCP_ARGS="${DHCP_ARGS} -G" [ -n "${DHCP_TIMEOUT}" ] && DHCP_ARGS="${DHCP_ARGS} -t ${DHCP_TIMEOUT}" - [ "${NEEDHOSTNAME}" = "no" ] && DHCP_ARGS="${DHCP_ARGS} -C lookup-hostname" - if [ "${PEERNTPD}" = "yes" ]; then + is_false "${NEEDHOSTNAME}" && DHCP_ARGS="${DHCP_ARGS} -C lookup-hostname" + if is_true "${PEERNTPD}"; then DHCP_ARGS="${DHCP_ARGS} -o ntp_servers" else DHCP_ARGS="${DHCP_ARGS} -C ntp.conf -O ntp_servers" fi - if [ "${PEERYP}" = "yes" ]; then + if is_true "${PEERYP}"; then DHCP_ARGS="${DHCP_ARGS} -o nis_domain -o nis_servers" else DHCP_ARGS="${DHCP_ARGS} -C yp.conf -C ypbind -O nis_domain -O nis_servers" @@ -337,9 +337,9 @@ case $(basename $DHCP_CLIENT) in ;; pump) [ -n "$DHCP_HOSTNAME" ] && DHCP_ARGS="-h $DHCP_HOSTNAME" - [ "${NEEDHOSTNAME}" = "yes" ] && DHCP_ARGS="$DHCP_ARGS --lookup-hostname" - [ "${PEERDNS}" = "no" ] && DHCP_ARGS="$DHCP_ARGS -d" - [ "${PEERGATEWAY}" = "no" ] && DHCP_ARGS="$DHCP_ARGS --no-gateway" + is_true "${NEEDHOSTNAME}" && DHCP_ARGS="$DHCP_ARGS --lookup-hostname" + is_false "${PEERDNS}" && DHCP_ARGS="$DHCP_ARGS -d" + is_false "${PEERGATEWAY}" && DHCP_ARGS="$DHCP_ARGS --no-gateway" DHCP_ARGS="$DHCP_ARGS -i $DEVICE" ;; dhcpxd) @@ -348,7 +348,7 @@ case $(basename $DHCP_CLIENT) in DHCP_ARGS="$DHCP_ARGS --wait $DEVICE" ;; dhclient) - if [[ "${PERSISTENT_DHCLIENT}" = [yY1]* ]]; then + if is_true "${PERSISTENT_DHCLIENT}"; then ONESHOT= else ONESHOT="-1" -- cgit v1.2.1