set-location() {
laptop=false
case $HOSTNAME in
- kw)
- at_work=true
- ;;
kd|frodo)
at_home=true
;;
&& ip n show 10.2.0.1 | grep . &>/dev/null; then
# note: logic duplicated in 11-iank
at_home=true
- elif ping -q -c1 -w1 hal.office.fsf.org &>/dev/null \
- && ip n show 192.168.0.26 | grep . &>/dev/null; then
- at_work=true
fi
;;
esac
}
add-x3-target() {
- # main work machine
- if ping -q -c1 -w1 x3.office.fsf.org &>/dev/null; then
- targets+=(x3.office.fsf.org)
- elif ping -q -c1 -w1 x3.b8.nz &>/dev/null; then
+ if ping -q -c1 -w1 x3.b8.nz &>/dev/null; then
# in case we took it home
targets+=(x3.b8.nz)
elif ping -q -c1 -w1 x3w.b8.nz &>/dev/null; then
# targets, plus any given on the command line.
-at_work=false
at_home=false
set-location
targets+=(frodo.b8.nz)
fi
wireless_home_hosts=(
- # out of comission for now
- #x2
- # sy is so temp
- #sy
+ sy
so
)
for h in ${wireless_home_hosts[@]}; do
add-wireless-target
fi
done
- elif $at_work; then
- targets+=(b8.nz)
- for h in x2 x3 kw; do
- if [[ $HOSTNAME == "$h" ]]; then
- continue
- fi
- if ping -q -c1 -w1 $h.office.fsf.org &>/dev/null; then
- targets+=($h.office.fsf.org)
- fi
- done
else
targets+=(b8.nz)
fi