mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-28 05:36:32 +00:00
Merge remote-tracking branch 'thingos/dev' into dev
This commit is contained in:
commit
dc82eeefe2
@ -15,7 +15,7 @@ case "$1" in
|
|||||||
${PROG}
|
${PROG}
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
echo "---- booting ${OS_NAME} ${OS_VERSION} ----" >> ${DMESG_LOG}
|
echo "---- booting ${OS_NAME} ${OS_VERSION} ----" >> ${DMESG_LOG}
|
||||||
${PROG_D} -T -w >> ${DMESG_LOG} &
|
${PROG_D} -w >> ${DMESG_LOG} &
|
||||||
;;
|
;;
|
||||||
|
|
||||||
stop)
|
stop)
|
||||||
|
@ -33,24 +33,45 @@ source ${CONF}
|
|||||||
|
|
||||||
set_current_date_http() {
|
set_current_date_http() {
|
||||||
date_str=$(curl -v -s -m ${DATE_TIMEOUT} -X GET http://${DATE_HOST} 2>&1 | grep Date | sed -e 's/< Date: //')
|
date_str=$(curl -v -s -m ${DATE_TIMEOUT} -X GET http://${DATE_HOST} 2>&1 | grep Date | sed -e 's/< Date: //')
|
||||||
test -z "${date_str}" && return 1
|
if [[ -n "${date_str}" ]]; then
|
||||||
${PROG_DATE} -u -D "%a, %d %b %Y %H:%M:%S" -s "${date_str}" > /dev/null
|
${PROG_DATE} -u -D "%a, %d %b %Y %H:%M:%S" -s "${date_str}" > /dev/null
|
||||||
return $?
|
logger -t date -s "current system date/time set to $(date) via HTTP"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
logger -t date -s "failed to set current system date/time via HTTP"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
set_current_date_ntp() {
|
set_current_date_ntp() {
|
||||||
cat ${NTP_CONF} | grep server | head -n 1 | cut -d ' ' -f 2 | xargs ${PROG_NTPDATE} -t ${DATE_TIMEOUT} -s
|
cat ${NTP_CONF} | grep server | head -n 1 | cut -d ' ' -f 2 | xargs ${PROG_NTPDATE} -t ${DATE_TIMEOUT} -s
|
||||||
|
if [[ $? == 0 ]]; then
|
||||||
|
logger -t date -s "current system date/time set to $(date) via NTP"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
logger -t date -s "failed to set current system date/time via NTP"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
start_http() {
|
start_http() {
|
||||||
msg_begin "Setting current date using http"
|
msg_begin "Setting current date using http"
|
||||||
set_current_date_http || set_current_date_http
|
if set_current_date_http; then
|
||||||
test $? == 0 && msg_done "$(${PROG_DATE})" || msg_fail
|
sleep_interval=${DATE_INTERVAL}
|
||||||
|
msg_done "$(${PROG_DATE})"
|
||||||
|
else
|
||||||
|
sleep_interval=${DATE_TIMEOUT}
|
||||||
|
msg_fail
|
||||||
|
fi
|
||||||
|
|
||||||
msg_begin "Starting http date updater"
|
msg_begin "Starting http date updater"
|
||||||
while true; do
|
while true; do
|
||||||
sleep ${DATE_INTERVAL}
|
sleep ${sleep_interval}
|
||||||
set_current_date_http
|
if set_current_date_http; then
|
||||||
|
sleep_interval=${DATE_INTERVAL}
|
||||||
|
else
|
||||||
|
sleep_interval=${DATE_TIMEOUT}
|
||||||
|
fi
|
||||||
done &
|
done &
|
||||||
msg_done
|
msg_done
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,8 @@ fi;
|
|||||||
test -f /data/etc/profile && source /data/etc/profile
|
test -f /data/etc/profile && source /data/etc/profile
|
||||||
|
|
||||||
# global environment variables
|
# global environment variables
|
||||||
|
set -a
|
||||||
test -f /etc/environment && source /etc/environment
|
test -f /etc/environment && source /etc/environment
|
||||||
test -f /data/etc/environment && source /data/etc/environment
|
test -f /data/etc/environment && source /data/etc/environment
|
||||||
test -f /boot/etc/environment && source /boot/etc/environment
|
test -f /boot/etc/environment && source /boot/etc/environment
|
||||||
|
set +a
|
||||||
|
@ -162,9 +162,9 @@ fi
|
|||||||
if [ -n "$IP" ] && [ -n "$GW" ] && [ -n "$DNS" ]; then
|
if [ -n "$IP" ] && [ -n "$GW" ] && [ -n "$DNS" ]; then
|
||||||
msg "setting static IP configuration"
|
msg "setting static IP configuration"
|
||||||
conf=$BOOT/static_ip.conf
|
conf=$BOOT/static_ip.conf
|
||||||
echo "static_ip=\"$IP\"" > $conf
|
echo "STATIC_IP=\"$IP\"" > $conf
|
||||||
echo "static_gw=\"$GW\"" >> $conf
|
echo "STATIC_GW=\"$GW\"" >> $conf
|
||||||
echo "static_dns=\"$DNS\"" >> $conf
|
echo "STATIC_DNS=\"$DNS\"" >> $conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg "unmounting sdcard"
|
msg "unmounting sdcard"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user