You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
825 B
Bash

#!/bin/sh /etc/rc.common
#
# Copyright (c) 2017 Qualcomm Technologies, Inc.
#
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
# Copyright (c) 2016, The Linux Foundation. All rights reserved.
#
START=15
boot() {
if [ -e "/var/run/hostapd-global.pid" ]
then
kill $(cat /var/run/hostapd-global.pid) &> /dev/null
rm /var/run/hostapd-global.pid &> /dev/null
fi
hostapd -g /var/run/hostapd/global -B -P /var/run/hostapd-global.pid
($initscript monitor&)
}
# monitor hostapd and restart with wifi if it crashed
monitor() {
exec &>/dev/null
while sleep 5; do
if [ -e /var/run/hostapd-global.pid ] &&
wpa_cli -g /var/run/hostapd/global ping; then
continue
fi
wifi down
$initscript boot
sleep 5
wifi &
break
done
}
EXTRA_COMMANDS="${EXTRA_COMMANDS} monitor"