summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Jankowski <shasta@toxcorp.com>2017-11-21 03:02:35 +0100
committerRobby Workman <rworkman@slackware.com>2017-11-21 00:07:59 -0600
commitde60d4bdd7e634320f3c9e1248d51bd5e947808e (patch)
tree94560d83016dd25947ac8d9c6c451fb1cd2230fa
parent7cff32cd89f736d32405de05d73145e4e2dd1b70 (diff)
downloadslacknetsetup-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>
-rw-r--r--rc.inet139
1 files changed, 9 insertions, 30 deletions
diff --git a/rc.inet1 b/rc.inet1
index b29c285..d6ccea6 100644
--- a/rc.inet1
+++ b/rc.inet1
@@ -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