mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-24 11:46:30 +00:00
all init scripts are now fully refactored
This commit is contained in:
parent
2b13aacfe5
commit
21c7ea9143
@ -1,4 +1,4 @@
|
||||
setenv bootargs console=tty1 root=/dev/mmcblk0p2 rootwait panic=10 earlyprintk ${extra}
|
||||
setenv bootargs console=tty1 root=/dev/mmcblk0p2 rootwait panic=10 earlyprintk quiet loglevel=1 ${extra}
|
||||
fatload mmc 0 0x49000000 sun7i-a20-bananapi.dtb
|
||||
fatload mmc 0 0x46000000 uImage
|
||||
setenv fdt_high ffffffff
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# Busybox version: 1.23.2
|
||||
# Sat Nov 14 19:10:47 2015
|
||||
# Sun Nov 15 16:54:44 2015
|
||||
#
|
||||
CONFIG_HAVE_DOT_CONFIG=y
|
||||
|
||||
@ -1027,16 +1027,16 @@ CONFIG_FEATURE_BASH_IS_NONE=y
|
||||
# System Logging Utilities
|
||||
#
|
||||
CONFIG_SYSLOGD=y
|
||||
CONFIG_FEATURE_ROTATE_LOGFILE=y
|
||||
CONFIG_FEATURE_REMOTE_LOG=y
|
||||
# CONFIG_FEATURE_ROTATE_LOGFILE is not set
|
||||
# CONFIG_FEATURE_REMOTE_LOG is not set
|
||||
# CONFIG_FEATURE_SYSLOGD_DUP is not set
|
||||
# CONFIG_FEATURE_SYSLOGD_CFG is not set
|
||||
CONFIG_FEATURE_SYSLOGD_CFG=y
|
||||
CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256
|
||||
# CONFIG_FEATURE_IPC_SYSLOG is not set
|
||||
CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=0
|
||||
# CONFIG_LOGREAD is not set
|
||||
# CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set
|
||||
# CONFIG_FEATURE_KMSG_SYSLOG is not set
|
||||
CONFIG_KLOGD=y
|
||||
CONFIG_FEATURE_KLOGD_KLOGCTL=y
|
||||
CONFIG_FEATURE_KMSG_SYSLOG=y
|
||||
# CONFIG_KLOGD is not set
|
||||
# CONFIG_FEATURE_KLOGD_KLOGCTL is not set
|
||||
CONFIG_LOGGER=y
|
||||
|
@ -3,6 +3,8 @@
|
||||
sys_hostname_file="/etc/hostname"
|
||||
hostname_file="/data/etc/hostname"
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
msg_begin "Setting hostname"
|
||||
|
@ -1,7 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
sys_modules_file="/etc_modules"
|
||||
modules_file="/data/etc_modules"
|
||||
sys_modules_file="/etc/modules"
|
||||
modules_file="/data/etc/modules"
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
|
@ -1,21 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
msg_begin "Starting logging"
|
||||
start-stop-daemon -b -S -q -m -p /var/run/syslogd.pid --exec /sbin/syslogd -- -n
|
||||
msg_done
|
||||
;;
|
||||
msg_begin "Starting syslogd"
|
||||
syslogd
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
;;
|
||||
|
||||
stop)
|
||||
msg_begin "Stopping logging"
|
||||
start-stop-daemon -K -q -p /var/run/syslogd.pid
|
||||
msg_done
|
||||
;;
|
||||
msg_begin "Stopping syslogd"
|
||||
killall syslogd &>/dev/null
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 {start|stop}"
|
||||
exit 1
|
||||
echo "Usage: $0 {start|stop}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
|
@ -1,16 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# these aren't used in this file but
|
||||
# throughout various init scripts
|
||||
sys_watch_conf="/etc/watch.conf"
|
||||
watch_conf="/data/etc/watch.conf"
|
||||
|
||||
if [ -f $sys_watch_conf ] && ! [ -f $watch_conf ]; then
|
||||
cp $sys_watch_conf $watch_conf
|
||||
fi
|
||||
|
||||
test -c /dev/watchdog || exit 0
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
msg_begin "Starting watchdog"
|
||||
|
@ -5,6 +5,8 @@ data_dev="${disk_dev}p3"
|
||||
|
||||
test -b $data_dev && exit 0
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
msg_begin "Creating data partition"
|
||||
@ -13,13 +15,12 @@ case "$1" in
|
||||
3
|
||||
\n
|
||||
\n
|
||||
w" | /sbin/fdisk $disk_dev >/dev/null
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
sync
|
||||
w" | /sbin/fdisk $disk_dev 2>&1 >/dev/null | grep -v "Device or resource busy" | grep -v '^$'
|
||||
partx -a $disk_dev &>/dev/null
|
||||
test -b $data_dev && msg_done || msg_fail
|
||||
|
||||
msg_begin "Formatting data partition"
|
||||
mkfs.ext4 $data_dev
|
||||
mkfs.ext4 -q $data_dev
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
|
||||
msg_begin "Mounting data partition"
|
||||
|
@ -2,12 +2,14 @@
|
||||
|
||||
test -f /etc/udev/udev.conf || exit 0
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
source /etc/udev/udev.conf
|
||||
|
||||
start() {
|
||||
msg_begin "Starting eudev"
|
||||
echo '\000\000\000\000' > /proc/sys/kernel/hotplug
|
||||
/sbin/udevd --daemon
|
||||
/sbin/udevd --daemon --resolve-names=never
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
|
||||
/sbin/udevadm trigger --type=subsystems --action=add
|
||||
|
@ -3,13 +3,7 @@
|
||||
sys_conf="/etc/os.conf"
|
||||
conf="/data/etc/os.conf"
|
||||
|
||||
if [ -f $sys_conf ] && ! [ -f $conf ]; then
|
||||
cp $sys_conf $conf
|
||||
fi
|
||||
|
||||
if [ -f $conf ]; then
|
||||
source $conf
|
||||
fi
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
@ -17,12 +11,20 @@ case "$1" in
|
||||
/bin/mount -a
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
|
||||
if [ -f $sys_conf ] && ! [ -f $conf ]; then
|
||||
cp $sys_conf $conf
|
||||
fi
|
||||
|
||||
if [ -f $conf ]; then
|
||||
source $conf
|
||||
fi
|
||||
|
||||
if [ "$os_debug" == "true" ]; then
|
||||
msg_begin "Remounting boot partition read-write"
|
||||
mount -o remount,rw /boot
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
|
||||
echo -n "Remounting root partition read-write: "
|
||||
msg_begin "Remounting root partition read-write: "
|
||||
mount -o remount,rw /
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
fi
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
# make sure root and admin users exist in shadow file
|
||||
@ -14,11 +16,7 @@ case "$1" in
|
||||
|
||||
# set root and admin passwords
|
||||
password=$(/etc/init.d/adminpw)
|
||||
if [ -z "$password" ]; then
|
||||
echo "Setting empty root/admin password"
|
||||
else
|
||||
echo "Setting custom root/admin password"
|
||||
fi
|
||||
msg_begin "Setting root password"
|
||||
|
||||
rm -f /data/etc/shadow+
|
||||
rm -f /data/etc/shadow-
|
||||
@ -28,6 +26,8 @@ case "$1" in
|
||||
|
||||
sed -r -i 's/root:([^:]+):[[:digit:]]+:/root:\1::/' /data/etc/shadow # removes pwd expiration
|
||||
sed -r -i 's/admin:([^:]+):[[:digit:]]+:/admin:\1::/' /data/etc/shadow # removes pwd expiration
|
||||
|
||||
msg_done
|
||||
;;
|
||||
|
||||
stop)
|
||||
|
@ -2,26 +2,35 @@
|
||||
|
||||
sys_conf="/etc/wpa_supplicant.conf"
|
||||
conf="/data/etc/wpa_supplicant.conf"
|
||||
|
||||
log="/var/log/wpa_supplicant.log"
|
||||
prog="/usr/sbin/wpa_supplicant"
|
||||
iface=wlan0
|
||||
driver=wext
|
||||
|
||||
sys_watch_conf="/etc/watch.conf"
|
||||
watch_conf="/data/etc/watch.conf"
|
||||
|
||||
link_watch=yes
|
||||
link_watch_timeout=20
|
||||
|
||||
if [ -f $sys_watch_conf ] && ! [ -f $watch_conf ]; then
|
||||
cp $sys_watch_conf $watch_conf
|
||||
fi
|
||||
|
||||
test -f $watch_conf && source $watch_conf
|
||||
|
||||
if [ -f $sys_conf ] && ! [ -f $conf ]; then
|
||||
cp $sys_conf $conf
|
||||
fi
|
||||
|
||||
test -f $watch_conf || exit 0
|
||||
test -f $conf || exit 0
|
||||
|
||||
ssid=$(cat $conf | grep ssid | grep -v scan_ssid | cut -d '"' -f 2)
|
||||
test -n "$ssid" || exit 0
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
connected() {
|
||||
ip link show dev $iface 2>&1 | grep LOWER_UP &> /dev/null && return 0 || return 1
|
||||
}
|
||||
|
@ -17,6 +17,8 @@ fi
|
||||
|
||||
test -f $conf/modem || exit 0
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
connected() {
|
||||
ifconfig | grep $dev &>/dev/null 2>&1 && return 0 || return 1
|
||||
}
|
||||
|
@ -18,12 +18,13 @@ wlan=wlan0
|
||||
test -r $watch_conf && source $watch_conf
|
||||
|
||||
if [ -f $sys_static_conf ] && ! [ -f $static_conf ]; then
|
||||
mkdir -p $(dirname $static_conf)
|
||||
cp $sys_static_conf $static_conf
|
||||
fi
|
||||
|
||||
test -r $static_conf && source $static_conf
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
watch_eth() {
|
||||
count=0
|
||||
while true; do
|
||||
|
@ -9,6 +9,8 @@ test -f $watch_conf && source $watch_conf || exit 0
|
||||
|
||||
test -z "$netwatch_host" || -z "$netwatch_port" && exit 0
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
watch() {
|
||||
count=0
|
||||
netwatch_retries=$(($netwatch_retries - 1))
|
||||
|
@ -9,6 +9,8 @@ fi
|
||||
|
||||
test -f $conf || exit 0
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
date_timeout=10
|
||||
date_method=http
|
||||
date_host="google.com"
|
||||
@ -41,7 +43,7 @@ set_current_date_ntp() {
|
||||
start_http() {
|
||||
msg_begin "Setting current date using http"
|
||||
set_current_date_http
|
||||
test $? == 0 && msg_done $(date) || msg_fail
|
||||
test $? == 0 && msg_done "$(date)" || msg_fail
|
||||
|
||||
msg_begin "Starting http date updater"
|
||||
while true; do
|
||||
@ -56,7 +58,7 @@ start_ntp() {
|
||||
|
||||
msg_begin "Setting current date using ntp"
|
||||
set_current_date_ntp
|
||||
test $? == 0 && msg_done $(date) || msg_fail
|
||||
test $? == 0 && msg_done "$(date)" || msg_fail
|
||||
|
||||
msg_begin "Starting ntpd"
|
||||
ntpd -g -c /etc/ntp.conf
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
start() {
|
||||
msg_begin "Starting crond"
|
||||
|
||||
|
@ -4,11 +4,17 @@ conf="/etc/sshd_config"
|
||||
|
||||
test -f $conf || exit 0
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
start() {
|
||||
msg_begin "Starting sshd"
|
||||
|
||||
# create any missing keys
|
||||
/usr/bin/ssh-keygen -A
|
||||
if ! /usr/bin/ssh-keygen -A >/dev/null; then
|
||||
msg_fail
|
||||
return 1
|
||||
fi
|
||||
|
||||
umask 077
|
||||
hostname=$(hostname)
|
||||
echo "Welcome to $hostname!" > /var/cache/sshd_banner
|
||||
@ -30,11 +36,11 @@ case "$1" in
|
||||
|
||||
stop)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
|
||||
restart|reload)
|
||||
restart
|
||||
restart)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
|
||||
*)
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
test -f /etc/proftpd.conf || exit 0
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
start() {
|
||||
msg_begin "Starting proftpd"
|
||||
mkdir -p /var/run/proftpd
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
test -f /etc/samba/smb.conf || exit 0
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
start() {
|
||||
msg_begin "Setting smb admin password"
|
||||
|
||||
|
@ -12,6 +12,8 @@ fi
|
||||
|
||||
test -f "$conf" || exit 0
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
opts=$(cat "$conf" | while read line; do echo "--$line"; done)
|
||||
port=$(echo "$opts" | grep -oE 'port [[:digit:]]+' | cut -d ' ' -f 2)
|
||||
|
||||
|
@ -4,6 +4,8 @@ userinit_sh="/data/etc/userinit.sh"
|
||||
|
||||
test -f $userinit_sh || exit 0
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
msg_begin "Executing user init script"
|
||||
|
@ -1,7 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
source /etc/version
|
||||
board_sn=$(/etc/init.d/boardsn)
|
||||
board_name=$(cat /etc/board)
|
||||
|
||||
msg_begin() {
|
||||
echo -n "$1: "
|
||||
echo -n "* $1: "
|
||||
}
|
||||
|
||||
msg_done() {
|
@ -3,14 +3,13 @@
|
||||
boot_log=/var/log/boot.log
|
||||
pid_file=/tmp/rc.pid
|
||||
|
||||
source /etc/init.d/vars
|
||||
source /etc/init.d/functions
|
||||
source /etc/init.d/base
|
||||
|
||||
echo "---- shutting down $os_name $os_version ----" >> $boot_log
|
||||
|
||||
# stop all init scripts in /etc/init.d,
|
||||
# executing them in numerical order.
|
||||
(for i in /etc/init.d/S??*; do
|
||||
# executing them in reverse numerical order.
|
||||
(for i in $(ls -r /etc/init.d/S??*); do
|
||||
[ ! -x "$i" ] && continue
|
||||
[ -f /data/etc/no_$(basename $i) ] && continue
|
||||
|
||||
|
@ -1,19 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
boot_log=/var/log/boot.log
|
||||
tmp_boot_log=/tmp/boot.log
|
||||
pid_file=/tmp/rc.pid
|
||||
|
||||
if ! [ -d /var/log ]; then
|
||||
# at the very first boot,
|
||||
# we won't have the /var/log directory
|
||||
boot_log=/tmp/boot.log
|
||||
tmp_log=yes
|
||||
fi
|
||||
source /etc/init.d/base
|
||||
|
||||
source /etc/init.d/vars
|
||||
source /etc/init.d/functions
|
||||
|
||||
echo "---- booting $os_name $os_version----" >> $boot_log
|
||||
echo "---- booting $os_name $os_version----" >> $tmp_boot_log
|
||||
|
||||
# start all init scripts in /etc/init.d,
|
||||
# executing them in numerical order.
|
||||
@ -26,15 +19,12 @@ echo "---- booting $os_name $os_version----" >> $boot_log
|
||||
set start
|
||||
. $i
|
||||
)
|
||||
done& echo $! > $pid_file) | tee -a $boot_log &
|
||||
done& echo $! > $pid_file) | tee -a $tmp_boot_log &
|
||||
|
||||
pid=$(cat $pid_file)
|
||||
while kill -0 $pid 2>/dev/null; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
if [ -n "$tmp_log" ]; then
|
||||
# persist the boot log at first boot
|
||||
mv $boot_log /var/log
|
||||
fi
|
||||
test -d $(dirname $boot_log) && cat $tmp_boot_log >> $boot_log
|
||||
|
||||
|
@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
source /etc/version
|
||||
board_sn=$(/etc/init.d/boardsn)
|
||||
board_name=$(cat /etc/board)
|
||||
|
@ -26,5 +26,5 @@ tty1::respawn:/sbin/getty -L tty1 115200 vt100
|
||||
|
||||
# Stuff to do before rebooting
|
||||
::shutdown:/etc/init.d/rcK
|
||||
::shutdown:/bin/umount -a -r
|
||||
null::shutdown:/bin/umount -a -r
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
ServerName "motionEye"
|
||||
ServerIdent off
|
||||
ServerType standalone
|
||||
DefaultServer on
|
||||
Port 21
|
||||
|
2
board/common/overlay/etc/syslog.conf
Normal file
2
board/common/overlay/etc/syslog.conf
Normal file
@ -0,0 +1,2 @@
|
||||
syslog.=info /dev/null
|
||||
*.*;syslog.!info /var/log/messages
|
@ -6,10 +6,10 @@ if [ -z "$TARGET" ]; then
|
||||
fi
|
||||
|
||||
# disable startup scripts
|
||||
rm -f $TARGET/etc/init.d/S15watchdog # replaced by S02watchdog
|
||||
rm -f $TARGET/etc/init.d/S49ntp # replaced by S60date
|
||||
rm -f $TARGET/etc/init.d/S50nginx # not needed
|
||||
rm -f $TARGET/etc/init.d/S50proftpd # replaced by S70proftpd
|
||||
rm -f $TARGET/etc/init.d/S01logging
|
||||
rm -f $TARGET/etc/init.d/S15watchdog
|
||||
rm -f $TARGET/etc/init.d/S49ntp
|
||||
rm -f $TARGET/etc/init.d/S50proftpd
|
||||
rm -f $TARGET/etc/init.d/S20urandom
|
||||
rm -f $TARGET/etc/init.d/S80dhcp-relay
|
||||
rm -f $TARGET/etc/init.d/S80dhcp-server
|
||||
|
@ -1,4 +1,4 @@
|
||||
setenv bootargs console=tty1 root=/dev/mmcblk0p2 rootwait panic=10 earlyprintk ${extra}
|
||||
setenv bootargs console=tty1 root=/dev/mmcblk0p2 rootwait panic=10 earlyprintk quiet loglevel=1 ${extra}
|
||||
fatload mmc 0 0x49000000 sun7i-a20-cubietruck.dtb
|
||||
fatload mmc 0 0x46000000 uImage
|
||||
setenv fdt_high ffffffff
|
||||
|
@ -47,7 +47,7 @@ setenv vpu "0"
|
||||
setenv hdmioutput "0"
|
||||
|
||||
# Boot Arguments
|
||||
setenv bootargs "console=ttyS0,115200n8 root=/dev/mmcblk0p2 rootwait ro no_console_suspend vdaccfg=0xa000 logo=osd1,loaded,0x7900000,720p,full dmfc=3 cvbsmode=576cvbs hdmimode=${m} m_bpp=${m_bpp} vout=${vout_mode} ${disableuhs}"
|
||||
setenv bootargs "console=ttyS0,115200n8 root=/dev/mmcblk0p2 rootwait ro no_console_suspend panic=10 quiet loglevel=1 vdaccfg=0xa000 logo=osd1,loaded,0x7900000,720p,full dmfc=3 cvbsmode=576cvbs hdmimode=${m} m_bpp=${m_bpp} vout=${vout_mode} ${disableuhs}"
|
||||
|
||||
# Booting
|
||||
fatload mmc 0:1 0x21000000 uImage
|
||||
|
@ -1 +1 @@
|
||||
dwc_otg.fiq_fix_enable=1 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait ro rootflags=noload
|
||||
dwc_otg.fiq_fix_enable=1 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait ro rootflags=noload panic=10 quiet loglevel=1
|
||||
|
@ -1,10 +1,12 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
gpio=35
|
||||
check_interval=30
|
||||
export=/sys/class/gpio/export
|
||||
read=/sys/class/gpio/gpio$gpio/value
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
configure() {
|
||||
echo $gpio > $export
|
||||
}
|
||||
@ -20,20 +22,20 @@ watch() {
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting brownout detector: "
|
||||
msg_begin "Starting brownout detector"
|
||||
configure
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
watch &
|
||||
echo "done"
|
||||
;;
|
||||
|
||||
stop)
|
||||
echo -n "Stopping brownout detector: "
|
||||
msg_begin "Stopping brownout detector"
|
||||
ps | grep brownout | grep -v $$ | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1 | xargs -r kill
|
||||
echo "done"
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
;;
|
||||
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|restart}"
|
||||
echo $"Usage: $0 {start|stop}"
|
||||
exit 1
|
||||
esac
|
||||
|
@ -1,40 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
MOTIONEYE_CONF_DIR=/data/etc/
|
||||
motioneye_conf_dir="/data/etc/"
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
enabled() {
|
||||
if [ $(ls -1 $MOTIONEYE_CONF_DIR/thread-*.conf 2>/dev/null| wc -l) != 1 ]; then
|
||||
return 1
|
||||
fi
|
||||
test $(ls -1 $motioneye_conf_dir/thread-*.conf 2>/dev/null| wc -l) == 1 || return 1
|
||||
|
||||
if ! grep '# @proto mjpeg' $MOTIONEYE_CONF_DIR/thread-1.conf &>/dev/null; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! grep -E '# @url http://(.*)127.0.0.1:' $MOTIONEYE_CONF_DIR/thread-1.conf &>/dev/null; then
|
||||
return 1
|
||||
fi
|
||||
grep '# @proto mjpeg' $motioneye_conf_dir/thread-1.conf &>/dev/null || return 1
|
||||
|
||||
grep -E '# @url http://(.*)127.0.0.1:' $motioneye_conf_dir/thread-1.conf &>/dev/null || return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
enabled || exit 0
|
||||
|
||||
start() {
|
||||
echo -n "Starting streameye: "
|
||||
msg_begin "Starting streameye"
|
||||
streameye.sh start
|
||||
echo "done"
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n "Shutting down streameye: "
|
||||
msg_begin "Stopping streameye"
|
||||
streameye.sh stop
|
||||
echo "done"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
@ -47,7 +38,8 @@ case "$1" in
|
||||
;;
|
||||
|
||||
restart)
|
||||
restart
|
||||
stop
|
||||
start
|
||||
;;
|
||||
|
||||
*)
|
||||
|
@ -67,7 +67,7 @@ function stop() {
|
||||
sleep 1
|
||||
count=$(($count + 1))
|
||||
done
|
||||
kill -KILL "$pid" &>/dev/null
|
||||
kill -KILL "$pid" &>/dev/null || true
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
@ -1 +1 @@
|
||||
dwc_otg.fiq_fix_enable=1 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait ro rootflags=noload
|
||||
dwc_otg.fiq_fix_enable=1 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait ro rootflags=noload panic=10 quiet loglevel=1
|
||||
|
@ -1,10 +1,12 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
gpio=35
|
||||
check_interval=30
|
||||
export=/sys/class/gpio/export
|
||||
read=/sys/class/gpio/gpio$gpio/value
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
configure() {
|
||||
echo $gpio > $export
|
||||
}
|
||||
@ -20,20 +22,20 @@ watch() {
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting brownout detector: "
|
||||
msg_begin "Starting brownout detector"
|
||||
configure
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
watch &
|
||||
echo "done"
|
||||
;;
|
||||
|
||||
stop)
|
||||
echo -n "Stopping brownout detector: "
|
||||
msg_begin "Stopping brownout detector"
|
||||
ps | grep brownout | grep -v $$ | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1 | xargs -r kill
|
||||
echo "done"
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
;;
|
||||
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|restart}"
|
||||
echo $"Usage: $0 {start|stop}"
|
||||
exit 1
|
||||
esac
|
||||
|
@ -1,40 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
MOTIONEYE_CONF_DIR=/data/etc/
|
||||
motioneye_conf_dir="/data/etc/"
|
||||
|
||||
test -n "$os_version" || source /etc/init.d/base
|
||||
|
||||
enabled() {
|
||||
if [ $(ls -1 $MOTIONEYE_CONF_DIR/thread-*.conf 2>/dev/null| wc -l) != 1 ]; then
|
||||
return 1
|
||||
fi
|
||||
test $(ls -1 $motioneye_conf_dir/thread-*.conf 2>/dev/null| wc -l) == 1 || return 1
|
||||
|
||||
if ! grep '# @proto mjpeg' $MOTIONEYE_CONF_DIR/thread-1.conf &>/dev/null; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! grep -E '# @url http://(.*)127.0.0.1:' $MOTIONEYE_CONF_DIR/thread-1.conf &>/dev/null; then
|
||||
return 1
|
||||
fi
|
||||
grep '# @proto mjpeg' $motioneye_conf_dir/thread-1.conf &>/dev/null || return 1
|
||||
|
||||
grep -E '# @url http://(.*)127.0.0.1:' $motioneye_conf_dir/thread-1.conf &>/dev/null || return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
enabled || exit 0
|
||||
|
||||
start() {
|
||||
echo -n "Starting streameye: "
|
||||
msg_begin "Starting streameye"
|
||||
streameye.sh start
|
||||
echo "done"
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n "Shutting down streameye: "
|
||||
msg_begin "Stopping streameye"
|
||||
streameye.sh stop
|
||||
echo "done"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
@ -47,7 +38,8 @@ case "$1" in
|
||||
;;
|
||||
|
||||
restart)
|
||||
restart
|
||||
stop
|
||||
start
|
||||
;;
|
||||
|
||||
*)
|
||||
|
@ -67,7 +67,7 @@ function stop() {
|
||||
sleep 1
|
||||
count=$(($count + 1))
|
||||
done
|
||||
kill -KILL "$pid" &>/dev/null
|
||||
kill -KILL "$pid" &>/dev/null || true
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
@ -142,15 +142,13 @@ def _set_os_settings(s):
|
||||
line = line.strip()
|
||||
if not line:
|
||||
continue
|
||||
|
||||
|
||||
try:
|
||||
name, _ = line.split(' ', 2)
|
||||
name, _ = line.split('=', 2)
|
||||
|
||||
except:
|
||||
continue
|
||||
|
||||
name = name.replace('_', '-')
|
||||
|
||||
if name == 'os_prereleases':
|
||||
lines[i] = 'os_prereleases="%s"' % str(s.pop('prereleases')).lower()
|
||||
|
||||
@ -217,7 +215,7 @@ def _set_motioneye_settings(s):
|
||||
s = dict(s)
|
||||
s.setdefault('port', 80)
|
||||
s.setdefault('motionBinary', '/usr/bin/motion')
|
||||
s.setdefault('debug', False)
|
||||
debug = s.setdefault('debug', False) # value needed later
|
||||
s.setdefault('motion_keep_alive', False)
|
||||
|
||||
logging.debug('writing motioneye settings to %s: ' % MOTIONEYE_CONF +
|
||||
@ -274,11 +272,11 @@ def _set_motioneye_settings(s):
|
||||
f.write(line)
|
||||
|
||||
# also update debug in os.conf
|
||||
if s['debug']:
|
||||
cmd = "sed -r 's/os_debug=\"?false\"?/os_debug=\"true\"/' %s" % OS_CONF
|
||||
if debug:
|
||||
cmd = "sed -i -r 's/os_debug=\"?false\"?/os_debug=\"true\"/' %s" % OS_CONF
|
||||
|
||||
else:
|
||||
cmd = "sed -r 's/os_debug=\"?true\"?/os_debug=\"false\"/' %s" % OS_CONF
|
||||
cmd = "sed -i -r 's/os_debug=\"?true\"?/os_debug=\"false\"/' %s" % OS_CONF
|
||||
|
||||
if os.system(cmd):
|
||||
logging.error('failed to set debug flag in os.conf')
|
||||
@ -468,8 +466,8 @@ def prereleases():
|
||||
'type': 'bool',
|
||||
'section': 'expertSettings',
|
||||
'advanced': True,
|
||||
'get': _get_motioneye_settings,
|
||||
'set': _set_motioneye_settings,
|
||||
'get': _get_os_settings,
|
||||
'set': _set_os_settings,
|
||||
'get_set_dict': True
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ define MOTIONEYE_INSTALL_TARGET_CMDS
|
||||
echo " 'motioneye': ('/var/log/motioneye.log', 'motioneye.log')," >> /tmp/handlers.py.new; \
|
||||
echo " 'messages': ('/var/log/messages', 'messages.log')," >> /tmp/handlers.py.new; \
|
||||
echo " 'boot': ('/var/log/boot.log', 'boot.log')," >> /tmp/handlers.py.new; \
|
||||
echo " 'dmesg': ('dmesg', 'dmesg.log')," >> /tmp/handlers.py.new; \
|
||||
echo " 'dmesg': ('dmesg -T', 'dmesg.log')," >> /tmp/handlers.py.new; \
|
||||
tail -n +$$(($$lineno + 2)) $(DST_DIR)/handlers.py >> /tmp/handlers.py.new; \
|
||||
mv /tmp/handlers.py.new $(DST_DIR)/handlers.py; \
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user