From d6a5e148e26276b35635268e717d78a18e297b4f Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sat, 12 Jan 2019 14:00:33 +0200 Subject: [PATCH] Convert all os_ variables to uppercase --- board/common/overlay/etc/init.d/S61proftpd | 6 +- board/common/overlay/etc/init.d/S62smb | 6 +- board/common/overlay/etc/init.d/S85motioneye | 57 +++++++++---------- .../overlay/etc/init.d/S84streameye | 11 ++-- .../overlay/etc/init.d/S84streameye | 2 +- .../overlay/etc/init.d/S84streameye | 2 +- 6 files changed, 40 insertions(+), 44 deletions(-) diff --git a/board/common/overlay/etc/init.d/S61proftpd b/board/common/overlay/etc/init.d/S61proftpd index 92ad723780..2d50405cc1 100755 --- a/board/common/overlay/etc/init.d/S61proftpd +++ b/board/common/overlay/etc/init.d/S61proftpd @@ -2,10 +2,10 @@ test -f /etc/proftpd.conf || exit 0 -test -n "$os_version" || source /etc/init.d/base -test -n "$os_debug" || source /etc/init.d/conf +test -n "$OS_VERSION" || source /etc/init.d/base +test -n "$OS_DEBUG" || source /etc/init.d/conf -test "$os_networkless" == "true" && exit 0 +test "$OS_NETWORKLESS" == "true" && exit 0 start() { msg_begin "Starting proftpd" diff --git a/board/common/overlay/etc/init.d/S62smb b/board/common/overlay/etc/init.d/S62smb index 061ee3cb35..733a39a0d2 100755 --- a/board/common/overlay/etc/init.d/S62smb +++ b/board/common/overlay/etc/init.d/S62smb @@ -2,10 +2,10 @@ test -f /etc/samba/smb.conf || exit 0 -test -n "$os_version" || source /etc/init.d/base -test -n "$os_debug" || source /etc/init.d/conf +test -n "$OS_VERSION" || source /etc/init.d/base +test -n "$OS_DEBUG" || source /etc/init.d/conf -test "$os_networkless" == "true" && exit 0 +test "$OS_NETWORKLESS" == "true" && exit 0 start() { mkdir -p /var/log/samba diff --git a/board/common/overlay/etc/init.d/S85motioneye b/board/common/overlay/etc/init.d/S85motioneye index 0c9a09071e..ba36f92e33 100755 --- a/board/common/overlay/etc/init.d/S85motioneye +++ b/board/common/overlay/etc/init.d/S85motioneye @@ -1,31 +1,26 @@ #!/bin/bash -sys_conf="/etc/motioneye.conf" -boot_conf="/boot/motioneye.conf" -conf="/data/etc/motioneye.conf" -motion_conf="/data/etc/motion.conf" -watch_conf="/data/etc/watch.conf" +SYS_CONF="/etc/motioneye.conf" +BOOT_CONF="/boot/motioneye.conf" +CONF="/data/etc/motioneye.conf" +MOTION_CONF="/data/etc/motion.conf" +WATCH_CONF="/data/etc/watch.conf" -meyewatch_timeout=120 -meyewatch_disable="false" -dev_v4l_by_id="/dev/v4l/by-id/" -media_dir="/data/output" +MEYEWATCH_TIMEOUT=120 +MEYEWATCH_DISABLE="false" +DEV_V4L_BY_ID="/dev/v4l/by-id/" +MEDIA_DIR="/data/output" -if ! [ -f $conf ]; then - if [ -f $boot_conf ]; then - cp $boor_conf $conf - elif [ -f $sys_conf ]; then - cp $sys_conf $conf - fi -fi +test -n "$OS_VERSION" || source /etc/init.d/base -test -f "$conf" || exit 0 +prepare_conf $CONF $SYS_CONF $BOOT_CONF -test -r $watch_conf && source $watch_conf +test -f "$CONF" || exit 0 -test -n "$os_version" || source /etc/init.d/base +test -r $WATCH_CONF && source $WATCH_CONF -opts=$(cat "$conf" | while read line; do echo "--$line"; done) + +opts=$(cat "$CONF" | while read line; do echo "--$line"; done) port=$(echo "$opts" | grep -oE 'port [[:digit:]]+' | cut -d ' ' -f 2) responsive() { @@ -39,10 +34,10 @@ watch() { if responsive; then count=0 else - if [ $count -lt $meyewatch_timeout ]; then + if [ $count -lt $MEYEWATCH_TIMEOUT ]; then count=$(($count + 5)) else - logger -t motioneye -s "not responding for $meyewatch_timeout seconds, rebooting" + logger -t motioneye -s "not responding for $MEYEWATCH_TIMEOUT seconds, rebooting" reboot fi fi @@ -52,12 +47,12 @@ watch() { find_persistent_device() { device=$1 - if ! [ -d $dev_v4l_by_id ]; then + if ! [ -d $DEV_V4L_BY_ID ]; then echo $device return fi - for p in $dev_v4l_by_id/*; do + for p in $DEV_V4L_BY_ID/*; do if [ $(realpath "$p") == $device ]; then echo $p | sed 's#//*#/#g' return @@ -116,8 +111,8 @@ add_v4l2_cameras() { start() { msg_begin "Starting motioneye" - mkdir -p $media_dir - meyectl startserver -b -c $conf -l + mkdir -p $MEDIA_DIR + meyectl startserver -b -c $CONF -l count=0 while true; do @@ -127,9 +122,9 @@ start() { break fi - if [ $count -gt $meyewatch_timeout ]; then + if [ $count -gt $MEYEWATCH_TIMEOUT ]; then msg_fail - test "$meyewatch_disable" == "false" && reboot + test "$MEYEWATCH_DISABLE" == "false" && reboot return 1 fi @@ -137,12 +132,12 @@ start() { done # add connected camera(s) with default settings - if responsive && ! [ -f $motion_conf ]; then + if responsive && ! [ -f $MOTION_CONF ]; then add_mmal_cameras || add_v4l2_cameras sync fi - if [ "$meyewatch_disable" == "false" ]; then + if [ "$MEYEWATCH_DISABLE" == "false" ]; then watch & fi @@ -151,7 +146,7 @@ start() { stop() { msg_begin "Stopping motioneye" - meyectl stopserver -c $conf &>/dev/null + meyectl stopserver -c $CONF &>/dev/null test $? == 0 && msg_done || msg_fail ps | grep motioneye | grep -v $$ | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1 | xargs -r kill } diff --git a/board/raspberrypi/overlay/etc/init.d/S84streameye b/board/raspberrypi/overlay/etc/init.d/S84streameye index 81e2e2c896..2fb45a691c 100755 --- a/board/raspberrypi/overlay/etc/init.d/S84streameye +++ b/board/raspberrypi/overlay/etc/init.d/S84streameye @@ -1,15 +1,16 @@ #!/bin/sh -motioneye_conf_dir="/data/etc/" +MOTIONEYE_CONF_DIR="/data/etc/" -test -n "$os_version" || source /etc/init.d/base + +test -n "$OS_VERSION" || source /etc/init.d/base enabled() { - test $(ls -1 $motioneye_conf_dir/thread-*.conf 2>/dev/null| wc -l) == 1 || return 1 + test $(ls -1 $MOTIONEYE_CONF_DIR/thread-*.conf 2>/dev/null| wc -l) == 1 || return 1 - grep '# @proto mjpeg' $motioneye_conf_dir/thread-1.conf &>/dev/null || return 1 + 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 + grep -E '# @url http://(.*)127.0.0.1:' $MOTIONEYE_CONF_DIR/thread-1.conf &>/dev/null || return 1 return 0 } diff --git a/board/raspberrypi2/overlay/etc/init.d/S84streameye b/board/raspberrypi2/overlay/etc/init.d/S84streameye index 81e2e2c896..39904572c5 100755 --- a/board/raspberrypi2/overlay/etc/init.d/S84streameye +++ b/board/raspberrypi2/overlay/etc/init.d/S84streameye @@ -2,7 +2,7 @@ motioneye_conf_dir="/data/etc/" -test -n "$os_version" || source /etc/init.d/base +test -n "$OS_VERSION" || source /etc/init.d/base enabled() { test $(ls -1 $motioneye_conf_dir/thread-*.conf 2>/dev/null| wc -l) == 1 || return 1 diff --git a/board/raspberrypi3/overlay/etc/init.d/S84streameye b/board/raspberrypi3/overlay/etc/init.d/S84streameye index 81e2e2c896..39904572c5 100755 --- a/board/raspberrypi3/overlay/etc/init.d/S84streameye +++ b/board/raspberrypi3/overlay/etc/init.d/S84streameye @@ -2,7 +2,7 @@ motioneye_conf_dir="/data/etc/" -test -n "$os_version" || source /etc/init.d/base +test -n "$OS_VERSION" || source /etc/init.d/base enabled() { test $(ls -1 $motioneye_conf_dir/thread-*.conf 2>/dev/null| wc -l) == 1 || return 1