1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/network/templates/gateway/check-LAN
georgejhunt f319afa432 Test (#20)
* change apache_data to apache_user in all

* no libapach2 in centos. just php. no php-magick in centos

* remove redundant vars entries

* do not create apache user

* missed one pound sign

* soft code all references to apache_user

* centos requires older setuptools

* revert ansible_lsb.id in xsce.yml

* try getting recent pip

* move pip download to 2prep so that kalite success is not dependent on iiab coming first

* still need to replace setuptools in kalite

* add curl -- needed in debian

* massivly substitue iiab for xsce, and rename files

* completed runansible

* centos fixes,install  pip

* appliance means no iptables rules

* change to earlier version of setuptools for centos

* delete file duplicate, hopefully unnecessary. generate the offline docs

* wiki docs errors

* create the admin group -- deleted earlier

* use the --yes option with pip uninstall

* base of repo moved from schoolserver to iiab, unleashkids.org->iiab.io

* network detection broken due to tupo
2017-06-09 16:25:56 -07:00

61 lines
2.1 KiB
Bash
Executable file

#!/bin/bash
run_detect(){
logger "check-LAN: running reconfig"
cd /opt/schoolserver/iiab
/opt/schoolserver/iiab/runtags network > /dev/null
logger "check-LAN: completed reconfig"
exit 0
}
exit_clean(){
logger "check-LAN: completed - nothing to do"
exit 0
}
logger "check-LAN: startup"
if [ -f /etc/sysconfig/xs_lan_device ]; then
LAN_DEVICE=`cat /etc/sysconfig/xs_lan_device`
if [ "x$LAN_DEVICE" = "x" ]; then
logger "check-LAN: no lan expected"
exit_clean
else
if [ "$LAN_DEVICE" = "br0" ]; then
SLAVES=`egrep -rn BRIDGE=br0 /etc/sysconfig/network-scripts/ifcfg-* \
| gawk -F'[-:]' '{print $3}'`
SLAVE_COUNT=`egrep -rn BRIDGE=br0 /etc/sysconfig/network-scripts/ifcfg-* \
| wc | awk '{print $1}'`
logger "check-LAN: looking for $SLAVE_COUNT slaves"
while [ "$SLAVE_COUNT" > 1 ]; do
TEST_SLAVE=`brctl show | tail -n $[ $SLAVE_COUNT - 1 ] | awk '{print $1}'`
if [ "x$TEST_SLAVE" = "x" ]; then
logger "check-LAN: blank slave for number $SLAVE_COUNT"
run_detect
else
logger "check-LAN: slave number $SLAVE_COUNT $TEST_SLAVE present"
fi
SLAVE_COUNT="$[ $SLAVE_COUNT - 1 ]"
if [ "$SLAVE_COUNT" = 1 ]; then
TEST_SLAVE=`brctl show | grep br0 | awk '{print $4}'`
if [ "x$TEST_SLAVE" = "x" ]; then
logger "check-LAN: single blank slave for number $SLAVE_COUNT"
run_detect
else
logger "check-LAN: single slave number $SLAVE_COUNT $TEST_SLAVE present"
exit_clean
fi
fi
done
fi
LAN_IF=`ip -o addr | grep 172.18 | awk '{print $2}'`
if [ "$LAN_IF" = "$LAN_DEVICE" ]; then
logger "check-LAN: expected LAN matched $LAN_DEVICE"
exit_clean
fi
fi
else
logger "check-LAN: unconfigured"
exit_clean
fi