Added WiFi watcher script from @AvSquirrel.

Fixes #246.
pull/296/head
Christopher Young 2016-02-28 12:49:17 -05:00
rodzic f034df937d
commit 857b71b716
5 zmienionych plików z 46 dodań i 0 usunięć

22
image/rc.local 100644
Wyświetl plik

@ -0,0 +1,22 @@
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
nohup /usr/sbin/wifi_watch.sh 0<&- &> /var/log/stratux/wifi_watch.log &
exit 0

Wyświetl plik

@ -60,6 +60,8 @@ scp_in_to_qemu /root/spindle/sshd_config /tmp/sshd_config.in
scp_in_to_qemu /root/spindle/libdump978.so /tmp/libdump978.so.in
scp_in_to_qemu /root/spindle/libimu.so /tmp/libimu.so.in
scp_in_to_qemu /root/spindle/go.tgz /mnt/root/go.tgz
scp_in_to_qemu /root/spindle/rc.local /tmp/rc.local.in
scp_in_to_qemu /root/spindle/wifi_watch.sh /tmp/wifi_watch.sh.in
ssh_in_to_qemu chroot /mnt sh -l -ex - <<\EOF
@ -79,6 +81,9 @@ mv -f /tmp/dhcpd.conf.in /etc/dhcp/dhcpd.conf
mv -f /tmp/hostapd.conf.in /etc/hostapd/hostapd.conf
mv -f /tmp/isc-dhcp-server.in /etc/default/isc-dhcp-server
mv -f /tmp/sshd_config.in /etc/ssh/sshd_config
mv -f /tmp/wifi_watch.sh.in /usr/sbin/wifi_watch.sh
chmod +x /usr/sbin/wifi_watch.sh
mv -f /tmp/rc.local.in /etc/rc.local
rm -f /usr/share/dbus-1/system-services/fi.epitest.hostap.WPASupplicant.service
echo "DAEMON_CONF=\"/etc/hostapd/hostapd.conf\"" >/etc/default/hostapd

Wyświetl plik

@ -0,0 +1,12 @@
#!/bin/bash
while true ; do
if ifconfig wlan0 | grep -q "UP BROADCAST RUNNING MULTICAST" ; then
sleep 30
else
echo "Wi-Fi connection down! Attempting reconnection."
service hostapd restart
service isc-dhcp-server restart
sleep 10
fi
done

Wyświetl plik

@ -20,6 +20,8 @@ cp libdump978.so work/bin/
cp linux-mpu9150/libimu.so work/bin/
cp init.d-stratux work/bin/
cp dump1090/dump1090 work/bin/
cp image/rc.local work/bin/
cp image/wifi_watch.sh work/bin/
cp -r web work/bin/
#TODO: librtlsdr.
cd work/

Wyświetl plik

@ -9,6 +9,11 @@ chmod 755 /etc/init.d/stratux
ln -fs /etc/init.d/stratux /etc/rc2.d/S01stratux
ln -fs /etc/init.d/stratux /etc/rc6.d/K01stratux
# Wifi watcher.
cp -f rc.local /etc/rc.local
cp -f wifi_watch.sh /usr/sbin/wifi_watch.sh
chmod +x /usr/sbin/wifi_watch.sh
cp -f dump1090 /usr/bin/
# Web files install.