diff options
author | Katze Miau <miaukatzemiau@priveasy.de> | 2011-12-09 19:52:15 (GMT) |
---|---|---|
committer | Katze Miau <miaukatzemiau@priveasy.de> | 2011-12-09 19:52:15 (GMT) |
commit | cd9f7aca64327e29cc8acb55d94f21a2da03330e (patch) | |
tree | e6aafe13e28045fad9cad192dd14c4b7a419d2f9 /files/common/etc/fsm/inetable/watch | |
parent | ef0ab9ba3f0042f59c0a8f155fcb61187585303e (diff) |
add FSM inetable
- implemented according to documentation
- almost no tests so far
Diffstat (limited to 'files/common/etc/fsm/inetable/watch')
-rwxr-xr-x | files/common/etc/fsm/inetable/watch/default | 10 | ||||
-rwxr-xr-x | files/common/etc/fsm/inetable/watch/ghost | 31 | ||||
l--------- | files/common/etc/fsm/inetable/watch/queen | 1 |
3 files changed, 42 insertions, 0 deletions
diff --git a/files/common/etc/fsm/inetable/watch/default b/files/common/etc/fsm/inetable/watch/default new file mode 100755 index 0000000..959e7ac --- /dev/null +++ b/files/common/etc/fsm/inetable/watch/default @@ -0,0 +1,10 @@ +#!/bin/sh -e +. ../common.sh + +if test_connectivity internet; then + echo queen +elif cloud_is_online; then + echo drone +else + echo robinson +fi diff --git a/files/common/etc/fsm/inetable/watch/ghost b/files/common/etc/fsm/inetable/watch/ghost new file mode 100755 index 0000000..54696f2 --- /dev/null +++ b/files/common/etc/fsm/inetable/watch/ghost @@ -0,0 +1,31 @@ +#!/bin/sh -e +. ../common.sh +. ../common_queen.sh + +# if our GW IP has been taken we must no use it again +if ! we_own_our_ip; then + if ! cloud_is_online; then + echo robinson + else + echo drone + fi + exit +fi + +if test_connectivity internet; then + echo queen + exit +fi + +if [ "$1" == "ghost" ]; then + GhostTime=$(($(date +%s) - $(cat /tmp/ghost_since))) +else + GhostTime=0 +fi +if ! cloud_is_online; then + echo robinson +elif [ $GhostTime -ge $DHCPLeaseTime ]; then + echo drone +else + echo ghost +fi diff --git a/files/common/etc/fsm/inetable/watch/queen b/files/common/etc/fsm/inetable/watch/queen new file mode 120000 index 0000000..cec3826 --- /dev/null +++ b/files/common/etc/fsm/inetable/watch/queen @@ -0,0 +1 @@ +ghost
\ No newline at end of file |