Knotenkonfig/Richtfunk/bb-fux-kern/etc/rc.local
2020-04-20 10:09:09 +02:00

38 lines
1.1 KiB
Plaintext

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
# Routing-Regel fuer cloud und speicher
CLOUD_IPV4=/lib/gluon/ebtables/109-local-forward-allow-speicher
if [ ! -f $CLOUD_IPV4 ]; then
echo "Installing cloud IPv4 rule"
echo "rule('LOCAL_FORWARD -p IPv4 --ip-src 193.96.224.238/32 -j RETURN')" > $CLOUD_IPV4
echo "rule('LOCAL_FORWARD -p IPv4 --ip-src 193.96.224.237/32 -j RETURN')" >> $CLOUD_IPV4
/etc/init.d/gluon-ebtables start $CLOUD_IPV4
else
echo "Cloud IPv4 rule already exists"
fi
# SNMP installieren
HAS_SNMPD=$(opkg list-installed | grep ^snmpd | wc -l)
if [ $HAS_SNMPD -eq 0 ]; then
echo "Installing snmpd"
opkg update && opkg install snmpd
else
echo "snmpd already installed"
fi
# Hop penalty heruntersetzen
# No uci support for hop penalty after Gluon v2019.1.2
INTERFACE="bat0"
PENALTY="5"
CURRENT=$(cat /sys/class/net/$INTERFACE/mesh/hop_penalty)
if [ "$PENALTY" != "$CURRENT" ]; then
echo $PENALTY > /sys/class/net/$INTERFACE/mesh/hop_penalty
uci set batman-adv.$INTERFACE.hop_penalty=$PENALTY
uci commit batman-adv
fi
exit 0