diff options
author | Alex Harpin <development@landsofshadow.co.uk> | 2014-09-07 16:51:50 +0100 |
---|---|---|
committer | Alex Harpin <development@landsofshadow.co.uk> | 2014-09-07 17:36:07 +0100 |
commit | d095d3b8cc04b2eb52e3617c056fb0af40d8307d (patch) | |
tree | b4fc27e347078274aaa35323cf22bfc7051959f0 | |
parent | 3e62229285ce90c6b56eab5f79f1559c4156641d (diff) | |
download | vyatta-cfg-system-d095d3b8cc04b2eb52e3617c056fb0af40d8307d.tar.gz vyatta-cfg-system-d095d3b8cc04b2eb52e3617c056fb0af40d8307d.zip |
vyatta-cfg-system: formatting changes for style consistency
Update scripts/vyatta-address to have consistent identation levels and
style throughout.
-rwxr-xr-x | scripts/vyatta-address | 65 |
1 files changed, 30 insertions, 35 deletions
diff --git a/scripts/vyatta-address b/scripts/vyatta-address index 08e14196..bc496996 100755 --- a/scripts/vyatta-address +++ b/scripts/vyatta-address @@ -9,45 +9,40 @@ if [ $# -ne 3 ]; then fi case $1 in - add) - if [[ "$3" = "dhcp" ]] - then - exec /opt/vyatta/sbin/vyatta-interfaces.pl --dev="$2" --dhcp=start - elif [[ "$3" = "dhcpv6" ]] - then + add) + if [[ "$3" = "dhcp" ]]; then + exec /opt/vyatta/sbin/vyatta-interfaces.pl --dev="$2" --dhcp=start + elif [[ "$3" = "dhcpv6" ]]; then exec /opt/vyatta/sbin/vyatta-dhcpv6-client.pl --start -ifname "$2" - elif [[ "$3" =~ ":" ]] - then # Ipv6 address - if ! ip -6 addr list dev $2 | grep -q $3; then - exec ip -6 addr add "$3" dev "$2" - fi - else - if ! ip addr list dev $2 | grep -q $3; then - exec ip addr add "$3" broadcast + dev "$2" - fi - fi ;; + elif [[ "$3" =~ ":" ]]; then + # Ipv6 address + if ! ip -6 addr list dev $2 | grep -q $3; then + exec ip -6 addr add "$3" dev "$2" + fi + else + if ! ip addr list dev $2 | grep -q $3; then + exec ip addr add "$3" broadcast + dev "$2" + fi + fi ;; - delete) + delete) if ! /sbin/ip address show dev $2 2>/dev/null | grep -q "$3"; then # Address doesn't exist there, nothing to delete exit 0 fi - if [ ! -d "/sys/class/net/$2" ] - then # device is already gone - exit 0 - elif [[ "$3" = "dhcp" ]] - then - exec /opt/vyatta/sbin/vyatta-interfaces.pl --dev="$2" --dhcp=stop - elif [[ "$3" = "dhcpv6" ]] - then - exec /opt/vyatta/sbin/vyatta-dhcpv6-client.pl --stop --ifname "$2" - elif [[ "$3" =~ ":" ]] - then - exec ip -6 addr del "$3" dev "$2" - else - exec ip addr del "$3" dev "$2" - fi ;; - *) - echo "Unknown option $1" - exit 1 ;; + if [ ! -d "/sys/class/net/$2" ]; then + # device is already gone + exit 0 + elif [[ "$3" = "dhcp" ]]; then + exec /opt/vyatta/sbin/vyatta-interfaces.pl --dev="$2" --dhcp=stop + elif [[ "$3" = "dhcpv6" ]]; then + exec /opt/vyatta/sbin/vyatta-dhcpv6-client.pl --stop --ifname "$2" + elif [[ "$3" =~ ":" ]]; then + exec ip -6 addr del "$3" dev "$2" + else + exec ip addr del "$3" dev "$2" + fi ;; + *) + echo "Unknown option $1" + exit 1 ;; esac |