olsrd: hotplug-script: cleanup/simplify
authorBastian Bittorf <bittorf@bluebottle.com>
Wed, 25 Sep 2013 13:30:15 +0000 (15:30 +0200)
committerBastian Bittorf <bittorf@bluebottle.com>
Wed, 25 Sep 2013 13:30:44 +0000 (15:30 +0200)
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
-}