mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-28 21:56:31 +00:00
boolean watch config variables have been normalized to "true" and "false"
This commit is contained in:
parent
ce5d1b27b3
commit
33dc034af5
@ -12,9 +12,6 @@ sys_watch_conf="/etc/watch.conf"
|
|||||||
boot_watch_conf="/boot/watch.conf"
|
boot_watch_conf="/boot/watch.conf"
|
||||||
watch_conf="/data/etc/watch.conf"
|
watch_conf="/data/etc/watch.conf"
|
||||||
|
|
||||||
link_watch=yes
|
|
||||||
link_watch_timeout=20
|
|
||||||
|
|
||||||
if ! [ -f $watch_conf ]; then
|
if ! [ -f $watch_conf ]; then
|
||||||
if [ -f $boot_watch_conf ]; then
|
if [ -f $boot_watch_conf ]; then
|
||||||
cp $boot_watch_conf $watch_conf
|
cp $boot_watch_conf $watch_conf
|
||||||
@ -23,7 +20,7 @@ if ! [ -f $watch_conf ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
test -f $watch_conf && source $watch_conf
|
source $watch_conf
|
||||||
|
|
||||||
if ! [ -f $conf ]; then
|
if ! [ -f $conf ]; then
|
||||||
if [ -f $boot_conf ]; then
|
if [ -f $boot_conf ]; then
|
||||||
@ -99,7 +96,7 @@ start() {
|
|||||||
count=$(($count + 1))
|
count=$(($count + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$link_watch" == "yes" ]; then
|
if [ "$link_watch" == "true" ]; then
|
||||||
watch &
|
watch &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ provider="mobile"
|
|||||||
|
|
||||||
watch_conf="/data/etc/watch.conf"
|
watch_conf="/data/etc/watch.conf"
|
||||||
|
|
||||||
test -f $watch_conf && source $watch_conf
|
source $watch_conf
|
||||||
|
|
||||||
if ! [ -d $conf ]; then
|
if ! [ -d $conf ]; then
|
||||||
if [ -d $boot_conf ]; then
|
if [ -d $boot_conf ]; then
|
||||||
@ -101,7 +101,7 @@ start() {
|
|||||||
count=$(($count + 1))
|
count=$(($count + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$link_watch" == "yes" ]; then
|
if [ "$link_watch" == "true" ]; then
|
||||||
watch &
|
watch &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -7,13 +7,9 @@ boot_static_conf="/boot/static_ip.conf"
|
|||||||
static_conf="/data/etc/static_ip.conf"
|
static_conf="/data/etc/static_ip.conf"
|
||||||
watch_conf="/data/etc/watch.conf"
|
watch_conf="/data/etc/watch.conf"
|
||||||
|
|
||||||
link_watch=yes
|
|
||||||
link_watch_timeout=20
|
|
||||||
ip_watch=yes
|
|
||||||
ip_watch_timeout=40
|
|
||||||
link_nego_timeout=10
|
link_nego_timeout=10
|
||||||
|
|
||||||
test -r $watch_conf && source $watch_conf
|
source $watch_conf
|
||||||
|
|
||||||
if ! [ -f $static_conf ]; then
|
if ! [ -f $static_conf ]; then
|
||||||
if [ -f $boot_static_conf ]; then
|
if [ -f $boot_static_conf ]; then
|
||||||
@ -94,7 +90,7 @@ start_wlan() {
|
|||||||
dhclient -cf "$dh_conf" $os_wlan
|
dhclient -cf "$dh_conf" $os_wlan
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ip_watch" == "yes" ] && ip addr show dev $os_wlan | grep inet &>/dev/null; then
|
if [ "$ip_watch" == "true" ] && ip addr show dev $os_wlan | grep inet &>/dev/null; then
|
||||||
watch_ip $os_wlan &
|
watch_ip $os_wlan &
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -104,7 +100,7 @@ start_eth() {
|
|||||||
|
|
||||||
# wait for driver
|
# wait for driver
|
||||||
w=3
|
w=3
|
||||||
test "$link_watch" == "yes" || w=1
|
test "$link_watch" == "true" || w=1
|
||||||
count=0
|
count=0
|
||||||
while ! ifconfig $os_eth >/dev/null 2>&1; do
|
while ! ifconfig $os_eth >/dev/null 2>&1; do
|
||||||
sleep 1
|
sleep 1
|
||||||
@ -120,7 +116,7 @@ start_eth() {
|
|||||||
|
|
||||||
# wait for operstate
|
# wait for operstate
|
||||||
w=3
|
w=3
|
||||||
test "$link_watch" == "yes" || w=1
|
test "$link_watch" == "true" || w=1
|
||||||
count=0
|
count=0
|
||||||
while [ "$(cat /sys/class/net/$os_eth/operstate 2>&1)" == "unknown" ]; do
|
while [ "$(cat /sys/class/net/$os_eth/operstate 2>&1)" == "unknown" ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
@ -132,7 +128,7 @@ start_eth() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
# wait for link
|
# wait for link
|
||||||
test "$link_watch" == "yes" || link_nego_timeout=3
|
test "$link_watch" == "true" || link_nego_timeout=3
|
||||||
count=0
|
count=0
|
||||||
while [ "$(cat /sys/class/net/$os_eth/carrier 2>&1)" != "1" ]; do
|
while [ "$(cat /sys/class/net/$os_eth/carrier 2>&1)" != "1" ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
@ -156,11 +152,11 @@ start_eth() {
|
|||||||
dhclient -cf "$dh_conf" $os_eth
|
dhclient -cf "$dh_conf" $os_eth
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$link_watch" == "yes" ]; then
|
if [ "$link_watch" == "true" ]; then
|
||||||
watch_eth &
|
watch_eth &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ip_watch" == "yes" ] && ip addr show dev $os_eth | grep inet &>/dev/null; then
|
if [ "$ip_watch" == "true" ] && ip addr show dev $os_eth | grep inet &>/dev/null; then
|
||||||
watch_ip $os_eth &
|
watch_ip $os_eth &
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -186,7 +182,7 @@ start() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$eth_ok" != "ok" ] && [ "$wlan_ok" != "ok" ] && [ "$ppp_ok" != "ok" ]; then
|
if [ "$eth_ok" != "ok" ] && [ "$wlan_ok" != "ok" ] && [ "$ppp_ok" != "ok" ]; then
|
||||||
if [ "$link_watch" == "yes" ]; then
|
if [ "$link_watch" == "true" ]; then
|
||||||
logger -t ethernet -s "no network connection available, rebooting"
|
logger -t ethernet -s "no network connection available, rebooting"
|
||||||
reboot
|
reboot
|
||||||
return 1
|
return 1
|
||||||
|
@ -7,7 +7,7 @@ motion_conf="/data/etc/motion.conf"
|
|||||||
watch_conf="/data/etc/watch.conf"
|
watch_conf="/data/etc/watch.conf"
|
||||||
|
|
||||||
meyewatch_timeout=120
|
meyewatch_timeout=120
|
||||||
meyewatch_disable=""
|
meyewatch_disable="false"
|
||||||
dev_v4l_by_id="/dev/v4l/by-id/"
|
dev_v4l_by_id="/dev/v4l/by-id/"
|
||||||
media_dir="/data/output"
|
media_dir="/data/output"
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ start() {
|
|||||||
|
|
||||||
if [ $count -gt $meyewatch_timeout ]; then
|
if [ $count -gt $meyewatch_timeout ]; then
|
||||||
msg_fail
|
msg_fail
|
||||||
test -z "$meyewatch_disable" && reboot
|
test "$meyewatch_disable" == "false" && reboot
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ start() {
|
|||||||
sync
|
sync
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$meyewatch_disable" ]; then
|
if [ "$meyewatch_disable" == "false" ]; then
|
||||||
watch &
|
watch &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
link_watch=yes
|
link_watch="true"
|
||||||
link_watch_timeout=20
|
link_watch_timeout=20
|
||||||
|
|
||||||
ip_watch=yes
|
ip_watch="true"
|
||||||
ip_watch_timeout=40
|
ip_watch_timeout=40
|
||||||
|
|
||||||
#netwatch_host=www.google.com
|
#netwatch_host=www.google.com
|
||||||
@ -10,6 +10,6 @@ netwatch_retries=3
|
|||||||
netwatch_timeout=5
|
netwatch_timeout=5
|
||||||
netwatch_interval=20
|
netwatch_interval=20
|
||||||
|
|
||||||
#meyewatch_disable=yes
|
#meyewatch_disable="true"
|
||||||
meyewatch_timeout=120
|
meyewatch_timeout=120
|
||||||
|
|
||||||
|
@ -7,3 +7,7 @@ echo 'os_eth="eth0"' >> /data/etc/os.conf
|
|||||||
echo 'os_wlan="wlan0"' >> /data/etc/os.conf
|
echo 'os_wlan="wlan0"' >> /data/etc/os.conf
|
||||||
echo 'os_ppp="ppp0"' >> /data/etc/os.conf
|
echo 'os_ppp="ppp0"' >> /data/etc/os.conf
|
||||||
|
|
||||||
|
# boolean values in watch.conf have been normalized to "true" and "false"
|
||||||
|
sed -i 's/=no/="false"/' /data/etc/watch.conf
|
||||||
|
sed -i 's/=yes/="true"/' /data/etc/watch.conf
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ def _get_watch_settings():
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if name == 'link_watch':
|
if name == 'link_watch':
|
||||||
watch_link = (value == 'yes') and not comment
|
watch_link = (value == 'true') and not comment
|
||||||
|
|
||||||
elif name == 'link_watch_timeout':
|
elif name == 'link_watch_timeout':
|
||||||
watch_link_timeout = int(value)
|
watch_link_timeout = int(value)
|
||||||
@ -115,10 +115,10 @@ def _set_watch_settings(s):
|
|||||||
|
|
||||||
|
|
||||||
with open(WATCH_CONF, 'w') as f:
|
with open(WATCH_CONF, 'w') as f:
|
||||||
f.write('link_watch=%s\n' % ['no', 'yes'][s['watchLink']])
|
f.write('link_watch=%s\n' % ['"false"', '"true"'][s['watchLink']])
|
||||||
f.write('link_watch_timeout=%s\n' % s['watchLinkTimeout'])
|
f.write('link_watch_timeout=%s\n' % s['watchLinkTimeout'])
|
||||||
f.write('\n')
|
f.write('\n')
|
||||||
f.write('ip_watch=%s\n' % ['no', 'yes'][s['watchLink']])
|
f.write('ip_watch=%s\n' % ['"false"', '"true"'][s['watchLink']])
|
||||||
f.write('ip_watch_timeout=%s\n' % s['watchLinkTimeout'])
|
f.write('ip_watch_timeout=%s\n' % s['watchLinkTimeout'])
|
||||||
f.write('\n')
|
f.write('\n')
|
||||||
f.write('%snetwatch_host=%s\n' % (('#' if not s['watchConnect'] else ''), s['watchConnectHost']))
|
f.write('%snetwatch_host=%s\n' % (('#' if not s['watchConnect'] else ''), s['watchConnectHost']))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user