diff options
author | Jakub Jankowski <shasta@toxcorp.com> | 2017-11-21 03:02:35 +0100 |
---|---|---|
committer | Robby Workman <rworkman@slackware.com> | 2017-11-21 00:07:59 -0600 |
commit | de60d4bdd7e634320f3c9e1248d51bd5e947808e (patch) | |
tree | 94560d83016dd25947ac8d9c6c451fb1cd2230fa /rc.inet1 | |
parent | 7cff32cd89f736d32405de05d73145e4e2dd1b70 (diff) | |
download | slacknetsetup-de60d4bdd7e634320f3c9e1248d51bd5e947808e.tar.xz |
rc.inet1: Avoid code duplication by combining case/esac
There's no reason to have separate cases for
start) ... ;;
up) ... ;;
if they both have the same bodies. Let's combine such cases to avoid
code duplication.
Also, this is that one time where quoting isn't really needed :)
Signed-off-by: Robby Workman <rworkman@slackware.com>
Diffstat (limited to 'rc.inet1')
-rw-r--r-- | rc.inet1 | 39 |
1 files changed, 9 insertions, 30 deletions
@@ -312,28 +312,28 @@ stop() { ############ case "$1" in -'start') # "start" brings up all configured interfaces: +start|up) # "start" (or "up") brings up all configured interfaces: start ;; -'stop') # "stop" takes down all configured interfaces: +stop|down) # "stop" (or "down") takes down all configured interfaces: stop ;; -'restart') # "restart" restarts the network: +restart) # "restart" restarts the network: stop start ;; -'lo_start') # Start the loopback interface: +lo_start|lo_up) # Start the loopback interface: lo_up ;; -*_start) # Example: "eth1_start" will start the specified interface 'eth1' +lo_stop|lo_down) # Stop the loopback interface: + lo_down + ;; +*_start|*_up) # Example: "eth1_start" (or "eth1_up") will start the specified interface 'eth1' INTERFACE=$(echo $1 | /bin/cut -d '_' -f 1) if_up $INTERFACE gateway_up ;; -'lo_stop') # Stop the loopback interface: - lo_down - ;; -*_stop) # Example: "eth0_stop" will stop the specified interface 'eth0' +*_stop|*_down) # Example: "eth0_stop" (or "eth0_down") will stop the specified interface 'eth0' INTERFACE=$(echo $1 | /bin/cut -d '_' -f 1) if_down $INTERFACE ;; @@ -344,27 +344,6 @@ case "$1" in if_up $INTERFACE gateway_up ;; -'up') # "up" does the same thing as "start" - start - ;; -'down') # "down" does the same thing as "stop" - stop - ;; -'lo_up') # Start the loopback interface: - lo_up - ;; -*_up) # "*_up" does the same thing as "*_start" - INTERFACE=$(echo $1 | /bin/cut -d '_' -f 1) - if_up $INTERFACE - gateway_up - ;; -'lo_down') # Stop the loopback interface: - lo_down - ;; -*_down) # "*_down" does the same thing as "*_stop" - INTERFACE=$(echo $1 | /bin/cut -d '_' -f 1) - if_down $INTERFACE - ;; *) # The default is to bring up all configured interfaces: start esac |