diff --git a/board/bananapi/boot.cmd b/board/bananapi/boot.cmd index fe18ea35a0..d071846d4f 100644 --- a/board/bananapi/boot.cmd +++ b/board/bananapi/boot.cmd @@ -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 diff --git a/board/common/busybox-1.22.x.config b/board/common/busybox-1.22.x.config index 13ce081b61..9f53a24f1a 100644 --- a/board/common/busybox-1.22.x.config +++ b/board/common/busybox-1.22.x.config @@ -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 diff --git a/board/common/overlay/etc/init.d/S01hostname b/board/common/overlay/etc/init.d/S01hostname index de378e7e7c..fed489d840 100755 --- a/board/common/overlay/etc/init.d/S01hostname +++ b/board/common/overlay/etc/init.d/S01hostname @@ -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" diff --git a/board/common/overlay/etc/init.d/S02modules b/board/common/overlay/etc/init.d/S02modules index 4ddeeba0f9..62660890dc 100755 --- a/board/common/overlay/etc/init.d/S02modules +++ b/board/common/overlay/etc/init.d/S02modules @@ -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) diff --git a/board/common/overlay/etc/init.d/S03logging b/board/common/overlay/etc/init.d/S03logging index c618089b2f..e77fdc0877 100755 --- a/board/common/overlay/etc/init.d/S03logging +++ b/board/common/overlay/etc/init.d/S03logging @@ -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 $? diff --git a/board/common/overlay/etc/init.d/S10watchdog b/board/common/overlay/etc/init.d/S10watchdog index 9ece91787f..8018a92651 100755 --- a/board/common/overlay/etc/init.d/S10watchdog +++ b/board/common/overlay/etc/init.d/S10watchdog @@ -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" diff --git a/board/common/overlay/etc/init.d/S11datapart b/board/common/overlay/etc/init.d/S11datapart index e4094388c1..22da4eee86 100755 --- a/board/common/overlay/etc/init.d/S11datapart +++ b/board/common/overlay/etc/init.d/S11datapart @@ -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" diff --git a/board/common/overlay/etc/init.d/S12udev b/board/common/overlay/etc/init.d/S12udev index 1e243eab3f..2c2bbdd61b 100755 --- a/board/common/overlay/etc/init.d/S12udev +++ b/board/common/overlay/etc/init.d/S12udev @@ -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 diff --git a/board/common/overlay/etc/init.d/S13mountall b/board/common/overlay/etc/init.d/S13mountall index 4ee2629f96..8a229e23af 100755 --- a/board/common/overlay/etc/init.d/S13mountall +++ b/board/common/overlay/etc/init.d/S13mountall @@ -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 diff --git a/board/common/overlay/etc/init.d/S21passwd b/board/common/overlay/etc/init.d/S21passwd index d3398e577c..f75a069b4b 100755 --- a/board/common/overlay/etc/init.d/S21passwd +++ b/board/common/overlay/etc/init.d/S21passwd @@ -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) diff --git a/board/common/overlay/etc/init.d/S35wifi b/board/common/overlay/etc/init.d/S35wifi index 277a386f43..ce09558d03 100755 --- a/board/common/overlay/etc/init.d/S35wifi +++ b/board/common/overlay/etc/init.d/S35wifi @@ -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 } diff --git a/board/common/overlay/etc/init.d/S36ppp b/board/common/overlay/etc/init.d/S36ppp index fd79a2717d..002419dfab 100755 --- a/board/common/overlay/etc/init.d/S36ppp +++ b/board/common/overlay/etc/init.d/S36ppp @@ -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 } diff --git a/board/common/overlay/etc/init.d/S40network b/board/common/overlay/etc/init.d/S40network index ec8566b5f2..170380f292 100755 --- a/board/common/overlay/etc/init.d/S40network +++ b/board/common/overlay/etc/init.d/S40network @@ -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 diff --git a/board/common/overlay/etc/init.d/S41netwatch b/board/common/overlay/etc/init.d/S41netwatch index 8031f02599..925681a782 100755 --- a/board/common/overlay/etc/init.d/S41netwatch +++ b/board/common/overlay/etc/init.d/S41netwatch @@ -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)) diff --git a/board/common/overlay/etc/init.d/S50date b/board/common/overlay/etc/init.d/S50date index e0adb2bd61..e2a565399e 100755 --- a/board/common/overlay/etc/init.d/S50date +++ b/board/common/overlay/etc/init.d/S50date @@ -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 diff --git a/board/common/overlay/etc/init.d/S51crond b/board/common/overlay/etc/init.d/S51crond index 4c109d659c..9ede66b829 100755 --- a/board/common/overlay/etc/init.d/S51crond +++ b/board/common/overlay/etc/init.d/S51crond @@ -1,5 +1,7 @@ #!/bin/bash +test -n "$os_version" || source /etc/init.d/base + start() { msg_begin "Starting crond" diff --git a/board/common/overlay/etc/init.d/S60sshd b/board/common/overlay/etc/init.d/S60sshd index 025faadb07..7adcb58270 100755 --- a/board/common/overlay/etc/init.d/S60sshd +++ b/board/common/overlay/etc/init.d/S60sshd @@ -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 ;; *) diff --git a/board/common/overlay/etc/init.d/S61proftpd b/board/common/overlay/etc/init.d/S61proftpd index 5effec7b3c..550f05dcf8 100755 --- a/board/common/overlay/etc/init.d/S61proftpd +++ b/board/common/overlay/etc/init.d/S61proftpd @@ -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 diff --git a/board/common/overlay/etc/init.d/S62smb b/board/common/overlay/etc/init.d/S62smb index d7ff9d659e..379e34c2ca 100755 --- a/board/common/overlay/etc/init.d/S62smb +++ b/board/common/overlay/etc/init.d/S62smb @@ -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" diff --git a/board/common/overlay/etc/init.d/S85motioneye b/board/common/overlay/etc/init.d/S85motioneye index 862ee9f559..141ecf8a90 100755 --- a/board/common/overlay/etc/init.d/S85motioneye +++ b/board/common/overlay/etc/init.d/S85motioneye @@ -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) diff --git a/board/common/overlay/etc/init.d/S99userinit b/board/common/overlay/etc/init.d/S99userinit index d79a7728b6..ffaf1dfb10 100755 --- a/board/common/overlay/etc/init.d/S99userinit +++ b/board/common/overlay/etc/init.d/S99userinit @@ -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" diff --git a/board/common/overlay/etc/init.d/functions b/board/common/overlay/etc/init.d/base similarity index 59% rename from board/common/overlay/etc/init.d/functions rename to board/common/overlay/etc/init.d/base index d3dc896465..eb9711b43b 100755 --- a/board/common/overlay/etc/init.d/functions +++ b/board/common/overlay/etc/init.d/base @@ -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() { diff --git a/board/common/overlay/etc/init.d/rcK b/board/common/overlay/etc/init.d/rcK index 44e5cb49b0..825b6f3437 100755 --- a/board/common/overlay/etc/init.d/rcK +++ b/board/common/overlay/etc/init.d/rcK @@ -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 diff --git a/board/common/overlay/etc/init.d/rcS b/board/common/overlay/etc/init.d/rcS index bb0dc01c76..f8a3eddca1 100755 --- a/board/common/overlay/etc/init.d/rcS +++ b/board/common/overlay/etc/init.d/rcS @@ -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 diff --git a/board/common/overlay/etc/init.d/vars b/board/common/overlay/etc/init.d/vars deleted file mode 100755 index 334a017596..0000000000 --- a/board/common/overlay/etc/init.d/vars +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -source /etc/version -board_sn=$(/etc/init.d/boardsn) -board_name=$(cat /etc/board) - diff --git a/board/common/overlay/etc/inittab b/board/common/overlay/etc/inittab index f9c98a75cb..3a51a40451 100644 --- a/board/common/overlay/etc/inittab +++ b/board/common/overlay/etc/inittab @@ -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 diff --git a/board/common/overlay/etc/proftpd.conf b/board/common/overlay/etc/proftpd.conf index 8f29f458e8..054e36c9e1 100644 --- a/board/common/overlay/etc/proftpd.conf +++ b/board/common/overlay/etc/proftpd.conf @@ -1,4 +1,4 @@ -ServerName "motionEye" +ServerIdent off ServerType standalone DefaultServer on Port 21 diff --git a/board/common/overlay/etc/syslog.conf b/board/common/overlay/etc/syslog.conf new file mode 100644 index 0000000000..38e2e9a33e --- /dev/null +++ b/board/common/overlay/etc/syslog.conf @@ -0,0 +1,2 @@ +syslog.=info /dev/null +*.*;syslog.!info /var/log/messages diff --git a/board/common/startup-scripts.sh b/board/common/startup-scripts.sh index 53bc4e10d4..2835c9f4e9 100755 --- a/board/common/startup-scripts.sh +++ b/board/common/startup-scripts.sh @@ -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 diff --git a/board/cubietruck/boot.cmd b/board/cubietruck/boot.cmd index b39b45c784..bf1ead30f6 100644 --- a/board/cubietruck/boot.cmd +++ b/board/cubietruck/boot.cmd @@ -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 diff --git a/board/odroidc1/boot.ini b/board/odroidc1/boot.ini index f8712bd45b..f360b69316 100644 --- a/board/odroidc1/boot.ini +++ b/board/odroidc1/boot.ini @@ -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 diff --git a/board/raspberrypi/cmdline.txt b/board/raspberrypi/cmdline.txt index 5f1250d798..79f7e0ae94 100644 --- a/board/raspberrypi/cmdline.txt +++ b/board/raspberrypi/cmdline.txt @@ -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 diff --git a/board/raspberrypi/overlay/etc/init.d/S05brownout b/board/raspberrypi/overlay/etc/init.d/S04brownout similarity index 66% rename from board/raspberrypi/overlay/etc/init.d/S05brownout rename to board/raspberrypi/overlay/etc/init.d/S04brownout index 118cc1d78f..215e307d97 100755 --- a/board/raspberrypi/overlay/etc/init.d/S05brownout +++ b/board/raspberrypi/overlay/etc/init.d/S04brownout @@ -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 diff --git a/board/raspberrypi/overlay/etc/init.d/S84streameye b/board/raspberrypi/overlay/etc/init.d/S84streameye index c386f053d4..81e2e2c896 100755 --- a/board/raspberrypi/overlay/etc/init.d/S84streameye +++ b/board/raspberrypi/overlay/etc/init.d/S84streameye @@ -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 ;; *) diff --git a/board/raspberrypi/overlay/usr/bin/streameye.sh b/board/raspberrypi/overlay/usr/bin/streameye.sh index a1dc4e9310..62e99a0a2a 100755 --- a/board/raspberrypi/overlay/usr/bin/streameye.sh +++ b/board/raspberrypi/overlay/usr/bin/streameye.sh @@ -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 diff --git a/board/raspberrypi2/cmdline.txt b/board/raspberrypi2/cmdline.txt index 5f1250d798..79f7e0ae94 100644 --- a/board/raspberrypi2/cmdline.txt +++ b/board/raspberrypi2/cmdline.txt @@ -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 diff --git a/board/raspberrypi2/overlay/etc/init.d/S05brownout b/board/raspberrypi2/overlay/etc/init.d/S04brownout similarity index 66% rename from board/raspberrypi2/overlay/etc/init.d/S05brownout rename to board/raspberrypi2/overlay/etc/init.d/S04brownout index 118cc1d78f..215e307d97 100755 --- a/board/raspberrypi2/overlay/etc/init.d/S05brownout +++ b/board/raspberrypi2/overlay/etc/init.d/S04brownout @@ -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 diff --git a/board/raspberrypi2/overlay/etc/init.d/S84streameye b/board/raspberrypi2/overlay/etc/init.d/S84streameye index c386f053d4..81e2e2c896 100755 --- a/board/raspberrypi2/overlay/etc/init.d/S84streameye +++ b/board/raspberrypi2/overlay/etc/init.d/S84streameye @@ -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 ;; *) diff --git a/board/raspberrypi2/overlay/usr/bin/streameye.sh b/board/raspberrypi2/overlay/usr/bin/streameye.sh index ebc54082ef..7178f93e00 100755 --- a/board/raspberrypi2/overlay/usr/bin/streameye.sh +++ b/board/raspberrypi2/overlay/usr/bin/streameye.sh @@ -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 diff --git a/package/motioneye/extractl.py b/package/motioneye/extractl.py index 531a8254af..7c79d1f728 100644 --- a/package/motioneye/extractl.py +++ b/package/motioneye/extractl.py @@ -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 } diff --git a/package/motioneye/motioneye.mk b/package/motioneye/motioneye.mk index 685f2f6e2e..6a87650a00 100644 --- a/package/motioneye/motioneye.mk +++ b/package/motioneye/motioneye.mk @@ -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