olsrd: hotplug-script: cleanup/simplify
[feed/routing.git] / olsrd / files / olsrd.hotplug.sh
index 467156f..8d88737 100755 (executable)
@@ -1,7 +1,14 @@
 #!/bin/sh
 
-[ "$ACTION" = ifup ] || exit 0
-/etc/init.d/olsrd enabled || exit 0
+case "$ACTION" in
+       ifup)
+               /etc/init.d/olsrd enabled && {
+                       olsrd_interface_needs_adding "$INTERFACE" "$DEVICE" && {
+                               /etc/init.d/olsrd restart
+                       }
+               }
+       ;;
+esac
 
 olsrd_list_configured_interfaces()
 {
@@ -44,7 +51,3 @@ olsrd_interface_needs_adding()
        logger -t olsrd_hotplug -p daemon.debug "[OK] interface $INTERFACE not used for olsrd"
        return 1
 }
-
-olsrd_interface_needs_adding "$INTERFACE" "$DEVICE" && {
-       /etc/init.d/olsrd restart
-}