mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-24 11:46:30 +00:00
/etc/init.d/S33hostapd: enable AP interface if available
This commit is contained in:
parent
688388c3e7
commit
c517c30230
@ -18,7 +18,6 @@ test -x ${PROG} || exit 0
|
||||
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||
|
||||
prepare_conf ${CONF} ${SYS_CONF} ${BOOT_CONF}
|
||||
test -s ${CONF} || exit 0
|
||||
|
||||
test -s ${WATCH_CONF} && source ${WATCH_CONF}
|
||||
|
||||
@ -38,7 +37,23 @@ watch() {
|
||||
done
|
||||
}
|
||||
|
||||
start() {
|
||||
prepare_ap_iface() {
|
||||
# Only prepare AP interfaces of format "apX"
|
||||
if ! [[ "${OS_AP}" =~ ap([[:digit:]]) ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
wlan_iface=wlan${BASH_REMATCH[1]}
|
||||
if ! iw dev ${wlan_iface} info &>/dev/null; then
|
||||
return # No wlan interface
|
||||
fi
|
||||
|
||||
msg_begin "Preparing AP interface"
|
||||
iw dev ${wlan_interface} interface add ${OS_AP} type __ap &>/dev/null
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
}
|
||||
|
||||
start_hostapd() {
|
||||
msg_begin "Starting hostapd"
|
||||
|
||||
# wait up to 5 seconds for interface
|
||||
@ -65,13 +80,27 @@ start() {
|
||||
test -n "${module}" && msg_done "done (${module})"|| msg_done
|
||||
}
|
||||
|
||||
stop() {
|
||||
stop_hostapd() {
|
||||
msg_begin "Stopping hostpad"
|
||||
killall hostapd &>/dev/null
|
||||
ps | grep hostapd | grep -v $$ | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1 | xargs -r kill
|
||||
msg_done
|
||||
}
|
||||
|
||||
start() {
|
||||
prepare_ap_iface
|
||||
|
||||
if [[ -s ${CONF} ]]; then
|
||||
start_hostapd
|
||||
fi
|
||||
}
|
||||
|
||||
stop() {
|
||||
if [[ -s ${CONF} ]]; then
|
||||
stop_hostapd
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
@ -90,4 +119,3 @@ case "$1" in
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
|
@ -10,4 +10,3 @@ OS_FIRMWARE_METHOD="github"
|
||||
OS_FIRMWARE_REPO="ccrisan/thingos"
|
||||
OS_FIRMWARE_USERNAME=""
|
||||
OS_FIRMWARE_PASSWORD=""
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user