From 92520debcad27eca08507fe47486ae7ee9df484b Mon Sep 17 00:00:00 2001 From: "David Kaspar [Dee'Kej]" Date: Tue, 11 Oct 2016 17:13:32 +0200 Subject: Use the is_true() and is_false() functions where possible --- sysconfig/network-scripts/ifdown-eth | 2 +- sysconfig/network-scripts/ifup-aliases | 4 ++-- sysconfig/network-scripts/ifup-eth | 10 +++++----- sysconfig/network-scripts/ifup-ippp | 2 +- sysconfig/network-scripts/ifup-ipv6 | 2 +- sysconfig/network-scripts/ifup-sit | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifdown-eth b/sysconfig/network-scripts/ifdown-eth index ab3507c0..23038e54 100755 --- a/sysconfig/network-scripts/ifdown-eth +++ b/sysconfig/network-scripts/ifdown-eth @@ -91,7 +91,7 @@ for VER in "" 6 ; do if [ -f "/var/run/dhclient$VER-${DEVICE}.pid" ]; then dhcpid=$(cat /var/run/dhclient$VER-${DEVICE}.pid) generate_lease_file_name $VER - if [[ "$DHCPRELEASE" = [yY1]* ]]; then + if is_true "$DHCPRELEASE"; then /sbin/dhclient -r -lf ${LEASEFILE} -pf /var/run/dhclient$VER-${DEVICE}.pid ${DEVICE} >/dev/null 2>&1 retcode=$? else diff --git a/sysconfig/network-scripts/ifup-aliases b/sysconfig/network-scripts/ifup-aliases index 50362143..7bf2327e 100755 --- a/sysconfig/network-scripts/ifup-aliases +++ b/sysconfig/network-scripts/ifup-aliases @@ -184,7 +184,7 @@ function new_interface () fi if [ -z "$DEVICE" -o -z "$IPADDR" ]; then - if [ -n "$IPV6ADDR" -a -n "$DEVICE" ] && [[ "$IPV6INIT" != [nN0]* ]]; then + if [ -n "$IPV6ADDR" -a -n "$DEVICE" ] && ! is_false "$IPV6INIT"; then /etc/sysconfig/network-scripts/ifup-ipv6 ${DEVICE} return $? fi @@ -277,7 +277,7 @@ function new_interface () /sbin/ip addr add ${IPADDR}/${PREFIX} brd ${BROADCAST} \ dev ${parent_device} label ${DEVICE} - [[ "$IPV6INIT" != [nN0]* ]] && \ + ! is_false "$IPV6INIT" && \ /etc/sysconfig/network-scripts/ifup-ipv6 ${DEVICE} if [ "$NO_ALIASROUTING" != yes ]; then diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth index eda3c457..fdb711c4 100755 --- a/sysconfig/network-scripts/ifup-eth +++ b/sysconfig/network-scripts/ifup-eth @@ -178,7 +178,7 @@ if [ -n "${BRIDGE}" ] && [ -x /usr/sbin/brctl ]; then fi if [ -n "${DYNCONFIG}" ] && [ -x /sbin/dhclient ]; then - if [[ "${PERSISTENT_DHCLIENT}" = [yY1]* ]]; then + if is_true "${PERSISTENT_DHCLIENT}"; then ONESHOT=""; else ONESHOT="-1"; @@ -188,7 +188,7 @@ if [ -n "${DYNCONFIG}" ] && [ -x /sbin/dhclient ]; then DHCLIENTARGS="${DHCLIENTARGS} -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${ONESHOT} -q ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient-${DEVICE}.pid" echo echo -n $"Determining IP information for ${DEVICE}..." - if [[ "${PERSISTENT_DHCLIENT}" != [yY1]* ]] && check_link_down ${DEVICE}; then + if ! is_true "${PERSISTENT_DHCLIENT}" && check_link_down ${DEVICE}; then echo $" failed; no link present. Check cable?" exit 1 fi @@ -200,10 +200,10 @@ if [ -n "${DYNCONFIG}" ] && [ -x /sbin/dhclient ]; then dhcpipv4="good" else echo $" failed." - if [[ "${IPV4_FAILURE_FATAL}" = [Yy1]* ]] ; then + if is_true "${IPV4_FAILURE_FATAL}"; then exit 1 fi - if [[ "$IPV6INIT" = [nN0]* || "$DHCPV6C" != [yY1]* ]] ; then + if is_false "$IPV6INIT" || ! is_true "$DHCPV6C"; then exit 1 fi net_log "Unable to obtain IPv4 DHCP address ${DEVICE}." warning @@ -318,7 +318,7 @@ fi # IPv6 initialisation? /etc/sysconfig/network-scripts/ifup-ipv6 ${CONFIG} -if [[ "${DHCPV6C}" = [Yy1]* ]] && [ -x /sbin/dhclient ]; then +if is_true "${DHCPV6C}" && [ -x /sbin/dhclient ]; then generate_config_file_name 6 generate_lease_file_name 6 echo diff --git a/sysconfig/network-scripts/ifup-ippp b/sysconfig/network-scripts/ifup-ippp index 848b8670..082b422e 100755 --- a/sysconfig/network-scripts/ifup-ippp +++ b/sysconfig/network-scripts/ifup-ippp @@ -368,7 +368,7 @@ function addprovider() fi # Setup IPv6 - if [[ "$IPV6INIT" != [nN0]* && ! -z "$IPV6ADDR" ]]; then + if ! is_false "$IPV6INIT" && ! [[ -z "$IPV6ADDR" ]]; then # Native IPv6 use of device configured, check of encapsulation required if [ "$ENCAP" = "syncppp" ]; then echo $"Warning: ipppd (kernel 2.4.x and below) doesn't support IPv6 using encapsulation 'syncppp'" diff --git a/sysconfig/network-scripts/ifup-ipv6 b/sysconfig/network-scripts/ifup-ipv6 index 13d7dcc3..c4a9b1d0 100755 --- a/sysconfig/network-scripts/ifup-ipv6 +++ b/sysconfig/network-scripts/ifup-ipv6 @@ -66,7 +66,7 @@ REALDEVICE=${DEVICE%%:*} DEVICE=$REALDEVICE # Test whether IPv6 configuration is disabled for this interface -[[ "$IPV6INIT" = [nN0]* ]] && exit 0 +is_false "$IPV6INIT" && exit 0 [ -f /etc/sysconfig/network-scripts/network-functions-ipv6 ] || exit 1 . /etc/sysconfig/network-scripts/network-functions-ipv6 diff --git a/sysconfig/network-scripts/ifup-sit b/sysconfig/network-scripts/ifup-sit index 29bf431a..3daa3801 100755 --- a/sysconfig/network-scripts/ifup-sit +++ b/sysconfig/network-scripts/ifup-sit @@ -44,7 +44,7 @@ REALDEVICE=${DEVICE%%:*} [ "$DEVICE" != "$REALDEVICE" ] && exit 0 # Test whether IPv6 configuration is disabled for this interface -[[ "$IPV6INIT" = [nN0]* ]] && exit 0 +is_false "$IPV6INIT" && exit 0 [ -f /etc/sysconfig/network-scripts/network-functions-ipv6 ] || exit 1 . /etc/sysconfig/network-scripts/network-functions-ipv6 -- cgit v1.2.1