mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-29 14:16:31 +00:00
Merge branch 'master' into buildroot201605
This commit is contained in:
commit
8b80a21898
@ -1,37 +1,21 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
sys_conf="/etc/os.conf"
|
|
||||||
boot_conf="/boot/os.conf"
|
|
||||||
conf="/data/etc/os.conf"
|
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -n "$os_version" || source /etc/init.d/base
|
||||||
|
|
||||||
mount_fs() {
|
mount_fs() {
|
||||||
msg_begin "Mounting filesystems"
|
msg_begin "Mounting filesystems"
|
||||||
/bin/mount -a
|
/bin/mount -a
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
|
}
|
||||||
|
|
||||||
if ! [ -f $conf ]; then
|
remount_rw() {
|
||||||
if [ -f $boot_conf ]; then
|
msg_begin "Remounting boot partition read-write"
|
||||||
cp $boot_conf $conf
|
mount -o remount,rw /boot
|
||||||
elif [ -f $sys_conf ]; then
|
test $? == 0 && msg_done || msg_fail
|
||||||
cp $sys_conf $conf
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f $conf ]; then
|
msg_begin "Remounting root partition read-write"
|
||||||
source $conf
|
mount -o remount,rw /
|
||||||
fi
|
test $? == 0 && msg_done || msg_fail
|
||||||
|
|
||||||
if [ "$os_debug" == "true" ]; then
|
|
||||||
msg_begin "Remounting boot partition read-write"
|
|
||||||
mount -o remount,rw /boot
|
|
||||||
test $? == 0 && msg_done || msg_fail
|
|
||||||
|
|
||||||
msg_begin "Remounting root partition read-write"
|
|
||||||
mount -o remount,rw /
|
|
||||||
test $? == 0 && msg_done || msg_fail
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mk_tty_login() {
|
mk_tty_login() {
|
||||||
@ -42,6 +26,8 @@ mk_tty_login() {
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
mount_fs
|
mount_fs
|
||||||
|
test -n "$os_debug" || source /etc/init.d/conf
|
||||||
|
test "$os_debug" == "true" && remount_rw
|
||||||
mk_tty_login
|
mk_tty_login
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -6,16 +6,12 @@ conf="/data/etc/wpa_supplicant.conf"
|
|||||||
|
|
||||||
log="/var/log/wpa_supplicant.log"
|
log="/var/log/wpa_supplicant.log"
|
||||||
prog="/usr/sbin/wpa_supplicant"
|
prog="/usr/sbin/wpa_supplicant"
|
||||||
iface=wlan0
|
|
||||||
driver=wext
|
driver=wext
|
||||||
|
|
||||||
sys_watch_conf="/etc/watch.conf"
|
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
|
||||||
@ -24,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
|
||||||
@ -40,9 +36,12 @@ ssid=$(cat $conf | grep ssid | grep -v scan_ssid | cut -d '"' -f 2)
|
|||||||
test -n "$ssid" || exit 0
|
test -n "$ssid" || exit 0
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -n "$os_version" || source /etc/init.d/base
|
||||||
|
test -n "$os_debug" || source /etc/init.d/conf
|
||||||
|
|
||||||
|
test "$os_networkless" == "true" && exit 0
|
||||||
|
|
||||||
connected() {
|
connected() {
|
||||||
ip link show dev $iface 2>&1 | grep LOWER_UP &> /dev/null && return 0 || return 1
|
ip link show dev $os_wlan 2>&1 | grep LOWER_UP &> /dev/null && return 0 || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
watch() {
|
watch() {
|
||||||
@ -68,7 +67,7 @@ start() {
|
|||||||
|
|
||||||
# wait up to 5 seconds for interface
|
# wait up to 5 seconds for interface
|
||||||
count=0
|
count=0
|
||||||
while ! ifconfig $iface >/dev/null 2>&1; do
|
while ! ifconfig $os_wlan >/dev/null 2>&1; do
|
||||||
sleep 1
|
sleep 1
|
||||||
count=$(($count + 1))
|
count=$(($count + 1))
|
||||||
if [ $count -ge 5 ]; then
|
if [ $count -ge 5 ]; then
|
||||||
@ -77,10 +76,10 @@ start() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
module=$(basename $(readlink /sys/class/net/$iface/device/driver/module 2>/dev/null) 2>/dev/null)
|
module=$(basename $(readlink /sys/class/net/$os_wlan/device/driver/module 2>/dev/null) 2>/dev/null)
|
||||||
|
|
||||||
iwconfig $iface power off &> /dev/null
|
iwconfig $os_wlan power off &> /dev/null
|
||||||
$prog -i$iface -c$conf -D$driver -B &> $log
|
$prog -i$os_wlan -c$conf -D$driver -B &> $log
|
||||||
count=0
|
count=0
|
||||||
while true; do
|
while true; do
|
||||||
sleep 1
|
sleep 1
|
||||||
@ -97,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
|
||||||
|
|
||||||
|
@ -5,12 +5,11 @@ boot_conf="/boot/ppp"
|
|||||||
conf="/data/etc/ppp"
|
conf="/data/etc/ppp"
|
||||||
|
|
||||||
prog="/usr/sbin/pppd"
|
prog="/usr/sbin/pppd"
|
||||||
dev="ppp0"
|
|
||||||
provider="mobile"
|
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
|
||||||
@ -24,9 +23,12 @@ test -e $conf/modem || exit 0
|
|||||||
test -e $conf/apn || exit 0
|
test -e $conf/apn || exit 0
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -n "$os_version" || source /etc/init.d/base
|
||||||
|
test -n "$os_debug" || source /etc/init.d/conf
|
||||||
|
|
||||||
|
test "$os_networkless" == "true" && exit 0
|
||||||
|
|
||||||
connected() {
|
connected() {
|
||||||
ifconfig | grep $dev &>/dev/null 2>&1 && return 0 || return 1
|
ifconfig | grep $os_ppp &>/dev/null 2>&1 && return 0 || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
watch() {
|
watch() {
|
||||||
@ -99,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,16 +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
|
||||||
eth=eth0
|
|
||||||
wlan=wlan0
|
|
||||||
|
|
||||||
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
|
||||||
@ -29,12 +22,13 @@ fi
|
|||||||
test -r $static_conf && source $static_conf
|
test -r $static_conf && source $static_conf
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -n "$os_version" || source /etc/init.d/base
|
||||||
|
test -n "$os_debug" || source /etc/init.d/conf
|
||||||
|
|
||||||
watch_eth() {
|
watch_eth() {
|
||||||
count=0
|
count=0
|
||||||
while true; do
|
while true; do
|
||||||
sleep 5
|
sleep 5
|
||||||
if [ "$(cat /sys/class/net/$eth/operstate 2>/dev/null)" == "up" ]; then
|
if [ "$(cat /sys/class/net/$os_eth/operstate 2>/dev/null)" == "up" ]; then
|
||||||
count=0
|
count=0
|
||||||
else
|
else
|
||||||
if [ $count -lt $link_watch_timeout ]; then
|
if [ $count -lt $link_watch_timeout ]; then
|
||||||
@ -73,65 +67,68 @@ start_lo() {
|
|||||||
|
|
||||||
start_wlan() {
|
start_wlan() {
|
||||||
msg_begin "Configuring wireless network"
|
msg_begin "Configuring wireless network"
|
||||||
if ! ifconfig $wlan &>/dev/null; then
|
if ! ifconfig $os_wlan &>/dev/null; then
|
||||||
msg_fail "no device"
|
msg_fail "no device"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$(cat /sys/class/net/$wlan/carrier 2>/dev/null)" != "1" ]; then
|
if [ "$(cat /sys/class/net/$os_wlan/carrier 2>/dev/null)" != "1" ]; then
|
||||||
msg_fail "no link"
|
msg_fail "no link"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$mtu" ]; then
|
if [ -n "$mtu" ]; then
|
||||||
ip link set mtu $mtu dev $wlan
|
ip link set mtu $mtu dev $os_wlan
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$static_ip" ]; then
|
if [ -n "$static_ip" ]; then
|
||||||
msg_done $static_ip
|
msg_done $static_ip
|
||||||
ifconfig $wlan $static_ip up
|
ifconfig $os_wlan $static_ip up
|
||||||
static_ip="" # won't be used again
|
static_ip="" # won't be used again
|
||||||
else
|
else
|
||||||
msg_done dhcp
|
msg_done dhcp
|
||||||
dhclient -cf "$dh_conf" $wlan
|
dhclient -cf "$dh_conf" $os_wlan
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ip_watch" == "yes" ] && ip addr show dev $wlan | grep inet &>/dev/null; then
|
if [ "$ip_watch" == "true" ] && ip addr show dev $os_wlan | grep inet &>/dev/null; then
|
||||||
watch_ip $wlan &
|
watch_ip $os_wlan &
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
start_eth() {
|
start_eth() {
|
||||||
msg_begin "Configuring wired network"
|
msg_begin "Configuring wired network"
|
||||||
|
|
||||||
# wait up to 3 seconds for driver
|
# wait for driver
|
||||||
|
w=3
|
||||||
count=0
|
count=0
|
||||||
while ! ifconfig $eth >/dev/null 2>&1; do
|
while ! ifconfig $os_eth >/dev/null 2>&1; do
|
||||||
sleep 1
|
sleep 1
|
||||||
count=$(($count + 1))
|
count=$(($count + 1))
|
||||||
if [ $count -ge 3 ]; then
|
if [ $count -ge $w ]; then
|
||||||
msg_done "no device"
|
msg_done "no device"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# bring it up
|
# bring it up
|
||||||
ifconfig $eth up
|
ifconfig $os_eth up
|
||||||
|
|
||||||
# wait up to 3 seconds for operstate
|
# wait for operstate
|
||||||
|
w=3
|
||||||
count=0
|
count=0
|
||||||
while [ "$(cat /sys/class/net/$eth/operstate 2>&1)" == "unknown" ]; do
|
while [ "$(cat /sys/class/net/$os_eth/operstate 2>&1)" == "unknown" ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
count=$(($count + 1))
|
count=$(($count + 1))
|
||||||
if [ $count -ge 3 ]; then
|
if [ $count -ge $w ]; then
|
||||||
msg_done "no link"
|
msg_done "no link"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# wait up to $link_nego_timeout seconds for link
|
# wait for link
|
||||||
|
test "$link_watch" == "true" || link_nego_timeout=5
|
||||||
count=0
|
count=0
|
||||||
while [ "$(cat /sys/class/net/$eth/carrier 2>&1)" != "1" ]; do
|
while [ "$(cat /sys/class/net/$os_eth/carrier 2>&1)" != "1" ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
count=$(($count + 1))
|
count=$(($count + 1))
|
||||||
if [ $count -ge $link_nego_timeout ]; then
|
if [ $count -ge $link_nego_timeout ]; then
|
||||||
@ -141,24 +138,24 @@ start_eth() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [ -n "$mtu" ]; then
|
if [ -n "$mtu" ]; then
|
||||||
ip link set mtu $mtu dev $eth
|
ip link set mtu $mtu dev $os_eth
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$static_ip" ]; then
|
if [ -n "$static_ip" ]; then
|
||||||
msg_done $static_ip
|
msg_done $static_ip
|
||||||
ifconfig $eth $static_ip up
|
ifconfig $os_eth $static_ip up
|
||||||
static_ip="" # won't be used again
|
static_ip="" # won't be used again
|
||||||
else
|
else
|
||||||
msg_done dhcp
|
msg_done dhcp
|
||||||
dhclient -cf "$dh_conf" $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 $eth | grep inet &>/dev/null; then
|
if [ "$ip_watch" == "true" ] && ip addr show dev $os_eth | grep inet &>/dev/null; then
|
||||||
watch_ip $eth &
|
watch_ip $os_eth &
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,10 +163,11 @@ start() {
|
|||||||
hostname=$(hostname)
|
hostname=$(hostname)
|
||||||
echo "send host-name = \"$hostname\";" > /var/cache/dhclient.conf
|
echo "send host-name = \"$hostname\";" > /var/cache/dhclient.conf
|
||||||
|
|
||||||
ssid=$(cat /data/etc/wpa_supplicant.conf 2>&1 | grep ssid | grep -v scan_ssid | cut -d '"' -f 2)
|
|
||||||
|
|
||||||
start_lo
|
start_lo
|
||||||
|
|
||||||
|
test "$os_networkless" == "true" && return 0
|
||||||
|
|
||||||
|
ssid=$(cat /data/etc/wpa_supplicant.conf 2>&1 | grep ssid | grep -v scan_ssid | cut -d '"' -f 2)
|
||||||
test -n "$ssid" && start_wlan && wlan_ok="ok"
|
test -n "$ssid" && start_wlan && wlan_ok="ok"
|
||||||
|
|
||||||
test -r /data/etc/ppp/modem && ppp_ok="ok" # TODO actually test the ppp link
|
test -r /data/etc/ppp/modem && ppp_ok="ok" # TODO actually test the ppp link
|
||||||
@ -182,9 +180,14 @@ 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
|
||||||
logger -t ethernet -s "no network connection available"
|
if [ "$link_watch" == "true" ]; then
|
||||||
reboot
|
logger -t ethernet -s "no network connection available, rebooting"
|
||||||
return 1
|
reboot
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
logger -t ethernet -s "no network connection available"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$static_gw" ]; then
|
if [ -n "$static_gw" ]; then
|
||||||
|
@ -10,6 +10,9 @@ test -f $watch_conf && source $watch_conf || exit 0
|
|||||||
test -z "$netwatch_host" || -z "$netwatch_port" && exit 0
|
test -z "$netwatch_host" || -z "$netwatch_port" && exit 0
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -n "$os_version" || source /etc/init.d/base
|
||||||
|
test -n "$os_debug" || source /etc/init.d/conf
|
||||||
|
|
||||||
|
test "$os_networkless" == "true" && exit 0
|
||||||
|
|
||||||
watch() {
|
watch() {
|
||||||
count=0
|
count=0
|
||||||
|
@ -27,7 +27,10 @@ fi
|
|||||||
test -f $conf || exit 0
|
test -f $conf || exit 0
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -n "$os_version" || source /etc/init.d/base
|
||||||
|
test -n "$os_debug" || source /etc/init.d/conf
|
||||||
|
|
||||||
|
has_net_conn || exit 0
|
||||||
|
|
||||||
date_timeout=10
|
date_timeout=10
|
||||||
date_method=http
|
date_method=http
|
||||||
date_host="google.com"
|
date_host="google.com"
|
||||||
|
@ -5,6 +5,9 @@ conf="/etc/sshd_config"
|
|||||||
test -f $conf || exit 0
|
test -f $conf || exit 0
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -n "$os_version" || source /etc/init.d/base
|
||||||
|
test -n "$os_debug" || source /etc/init.d/conf
|
||||||
|
|
||||||
|
has_net_conn || exit 0
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
msg_begin "Starting sshd"
|
msg_begin "Starting sshd"
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
test -f /etc/proftpd.conf || exit 0
|
test -f /etc/proftpd.conf || exit 0
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -n "$os_version" || source /etc/init.d/base
|
||||||
|
test -n "$os_debug" || source /etc/init.d/conf
|
||||||
|
|
||||||
|
has_net_conn || exit 0
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
msg_begin "Starting proftpd"
|
msg_begin "Starting proftpd"
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
test -f /etc/samba/smb.conf || exit 0
|
test -f /etc/samba/smb.conf || exit 0
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -n "$os_version" || source /etc/init.d/base
|
||||||
|
test -n "$os_debug" || source /etc/init.d/conf
|
||||||
|
|
||||||
|
has_net_conn || exit 0
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
msg_begin "Setting smb admin password"
|
msg_begin "Setting smb admin password"
|
||||||
|
@ -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,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -n "$os_version" || source /etc/init.d/base
|
||||||
|
test -n "$os_debug" || source /etc/init.d/conf
|
||||||
|
|
||||||
msg_info() {
|
msg_info() {
|
||||||
echo " # $1"
|
echo " # $1"
|
||||||
@ -17,15 +18,16 @@ show_gateway() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
show_dns() {
|
show_dns() {
|
||||||
dns=$(cat /etc/resolv.conf | grep nameserver | cut -d ' ' -f 2)
|
test -r /etc/resolv.conf || return
|
||||||
test -n "$gateway" && msg_info "DNS server address is $dns"
|
dns=$(cat /etc/resolv.conf | grep nameserver | head -n 1 | cut -d ' ' -f 2)
|
||||||
|
test -n "$dns" && msg_info "DNS server address is $dns"
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
show_iface_ip_addr eth0
|
show_iface_ip_addr $os_eth
|
||||||
show_iface_ip_addr wlan0
|
show_iface_ip_addr $os_wlan
|
||||||
show_iface_ip_addr ppp0
|
show_iface_ip_addr $os_ppp
|
||||||
show_gateway
|
show_gateway
|
||||||
show_dns
|
show_dns
|
||||||
;;
|
;;
|
||||||
|
29
board/common/overlay/etc/init.d/conf
Normal file
29
board/common/overlay/etc/init.d/conf
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
_sys_conf="/etc/os.conf"
|
||||||
|
_boot_conf="/boot/os.conf"
|
||||||
|
_conf="/data/etc/os.conf"
|
||||||
|
|
||||||
|
if ! [ -f $_conf ]; then
|
||||||
|
if [ -f $_boot_conf ]; then
|
||||||
|
cp $_boot_conf $_conf
|
||||||
|
elif [ -f $_sys_conf ]; then
|
||||||
|
cp $_sys_conf $_conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
source $_conf
|
||||||
|
|
||||||
|
has_net_conn() {
|
||||||
|
test "$os_networkless" == "true" && return 1
|
||||||
|
|
||||||
|
addr_eth=$(ip addr show dev $os_eth 2>/dev/null | grep inet | tr -s ' ' | sed -r 's/^\s+//' | cut -d ' ' -f 2)
|
||||||
|
addr_wlan=$(ip addr show dev $os_wlan 2>/dev/null | grep inet | tr -s ' ' | sed -r 's/^\s+//' | cut -d ' ' -f 2)
|
||||||
|
|
||||||
|
if [ -n "$addr_eth" ] || [ -n "$addr_wlan" ]; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,8 @@
|
|||||||
os_debug="false"
|
os_debug="false"
|
||||||
os_prereleases="false"
|
os_prereleases="false"
|
||||||
os_tty_login="tty1"
|
os_tty_login="tty1"
|
||||||
|
os_eth="eth0"
|
||||||
|
os_wlan="wlan0"
|
||||||
|
os_ppp="ppp0"
|
||||||
|
os_networkless="false"
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
os_name="motionEyeOS"
|
os_name="motionEyeOS"
|
||||||
os_short_name="motioneyeos"
|
os_short_name="motioneyeos"
|
||||||
os_prefix="meye"
|
os_prefix="meye"
|
||||||
os_version="20160801"
|
os_version="20160828"
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
13
board/common/overlay/usr/share/post-upgrade/20160828.sh
Executable file
13
board/common/overlay/usr/share/post-upgrade/20160828.sh
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# more settings have been added to [/data]/etc/os.conf
|
||||||
|
|
||||||
|
echo 'os_networkless="false"' >> /data/etc/os.conf
|
||||||
|
echo 'os_eth="eth0"' >> /data/etc/os.conf
|
||||||
|
echo 'os_wlan="wlan0"' >> /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
|
||||||
|
|
@ -111,7 +111,6 @@ def _set_board_settings(s):
|
|||||||
|
|
||||||
logging.debug('writing board settings to %s: ' % CONFIG_TXT +
|
logging.debug('writing board settings to %s: ' % CONFIG_TXT +
|
||||||
'gpu_mem=%(gpuMem)s, camera_led=%(cameraLed)s' % s)
|
'gpu_mem=%(gpuMem)s, camera_led=%(cameraLed)s' % s)
|
||||||
|
|
||||||
|
|
||||||
lines = []
|
lines = []
|
||||||
if os.path.exists(CONFIG_TXT):
|
if os.path.exists(CONFIG_TXT):
|
||||||
@ -136,17 +135,12 @@ def _set_board_settings(s):
|
|||||||
|
|
||||||
if name == 'gpu_mem':
|
if name == 'gpu_mem':
|
||||||
lines[i] = '%s=%s' % (name, s['gpuMem'])
|
lines[i] = '%s=%s' % (name, s['gpuMem'])
|
||||||
|
|
||||||
elif name == 'disable_camera_led':
|
elif name == 'disable_camera_led':
|
||||||
lines[i] = 'disable_camera_led=%s' % ['1', '0'][s['cameraLed']]
|
lines[i] = 'disable_camera_led=%s' % ['1', '0'][s['cameraLed']]
|
||||||
|
|
||||||
if 'gpu_mem' not in seen:
|
if 'gpu_mem' not in seen:
|
||||||
lines.append('gpu_mem=%s' % s['gpuMem'])
|
lines.append('gpu_mem=%s' % s['gpuMem'])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if 'disable_camera_led' not in seen:
|
if 'disable_camera_led' not in seen:
|
||||||
lines.append('disable_camera_led=%s' % ['1', '0'][s['cameraLed']])
|
lines.append('disable_camera_led=%s' % ['1', '0'][s['cameraLed']])
|
||||||
|
|
||||||
@ -228,8 +222,6 @@ def cameraLed():
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@additional_config
|
@additional_config
|
||||||
def sysMon():
|
def sysMon():
|
||||||
return {
|
return {
|
||||||
|
@ -368,7 +368,7 @@ def hostname():
|
|||||||
'advanced': True,
|
'advanced': True,
|
||||||
'reboot': True,
|
'reboot': True,
|
||||||
'required': False,
|
'required': False,
|
||||||
'validate': '^[a-z0-9\-_]{0,15}$',
|
'validate': '^[a-z0-9\-_.]{0,64}$',
|
||||||
'get': _get_hostname,
|
'get': _get_hostname,
|
||||||
'set': _set_hostname
|
'set': _set_hostname
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
#############################################################
|
#############################################################
|
||||||
|
|
||||||
MOTIONEYE_VERSION = c09764c55e20519f38c64332703ddaf55e3e10f2
|
MOTIONEYE_VERSION = 093c61ea811c92b5168797e4f4fd7398eb31bb5d
|
||||||
MOTIONEYE_SITE = $(call github,ccrisan,motioneye,$(MOTIONEYE_VERSION))
|
MOTIONEYE_SITE = $(call github,ccrisan,motioneye,$(MOTIONEYE_VERSION))
|
||||||
MOTIONEYE_SOURCE = $(MOTIONEYE_VERSION).tar.gz
|
MOTIONEYE_SOURCE = $(MOTIONEYE_VERSION).tar.gz
|
||||||
MOTIONEYE_LICENSE = GPLv3
|
MOTIONEYE_LICENSE = GPLv3
|
||||||
|
@ -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