Convert all os_ variables to uppercase

This commit is contained in:
Calin Crisan 2019-01-12 14:00:33 +02:00
parent 014684880c
commit d6a5e148e2
6 changed files with 40 additions and 44 deletions

View File

@ -2,10 +2,10 @@
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 test -n "$OS_DEBUG" || source /etc/init.d/conf
test "$os_networkless" == "true" && exit 0 test "$OS_NETWORKLESS" == "true" && exit 0
start() { start() {
msg_begin "Starting proftpd" msg_begin "Starting proftpd"

View File

@ -2,10 +2,10 @@
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 test -n "$OS_DEBUG" || source /etc/init.d/conf
test "$os_networkless" == "true" && exit 0 test "$OS_NETWORKLESS" == "true" && exit 0
start() { start() {
mkdir -p /var/log/samba mkdir -p /var/log/samba

View File

@ -1,31 +1,26 @@
#!/bin/bash #!/bin/bash
sys_conf="/etc/motioneye.conf" SYS_CONF="/etc/motioneye.conf"
boot_conf="/boot/motioneye.conf" BOOT_CONF="/boot/motioneye.conf"
conf="/data/etc/motioneye.conf" CONF="/data/etc/motioneye.conf"
motion_conf="/data/etc/motion.conf" 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="false" 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"
if ! [ -f $conf ]; then test -n "$OS_VERSION" || source /etc/init.d/base
if [ -f $boot_conf ]; then
cp $boor_conf $conf
elif [ -f $sys_conf ]; then
cp $sys_conf $conf
fi
fi
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) port=$(echo "$opts" | grep -oE 'port [[:digit:]]+' | cut -d ' ' -f 2)
responsive() { responsive() {
@ -39,10 +34,10 @@ watch() {
if responsive; then if responsive; then
count=0 count=0
else else
if [ $count -lt $meyewatch_timeout ]; then if [ $count -lt $MEYEWATCH_TIMEOUT ]; then
count=$(($count + 5)) count=$(($count + 5))
else else
logger -t motioneye -s "not responding for $meyewatch_timeout seconds, rebooting" logger -t motioneye -s "not responding for $MEYEWATCH_TIMEOUT seconds, rebooting"
reboot reboot
fi fi
fi fi
@ -52,12 +47,12 @@ watch() {
find_persistent_device() { find_persistent_device() {
device=$1 device=$1
if ! [ -d $dev_v4l_by_id ]; then if ! [ -d $DEV_V4L_BY_ID ]; then
echo $device echo $device
return return
fi fi
for p in $dev_v4l_by_id/*; do for p in $DEV_V4L_BY_ID/*; do
if [ $(realpath "$p") == $device ]; then if [ $(realpath "$p") == $device ]; then
echo $p | sed 's#//*#/#g' echo $p | sed 's#//*#/#g'
return return
@ -116,8 +111,8 @@ add_v4l2_cameras() {
start() { start() {
msg_begin "Starting motioneye" msg_begin "Starting motioneye"
mkdir -p $media_dir mkdir -p $MEDIA_DIR
meyectl startserver -b -c $conf -l meyectl startserver -b -c $CONF -l
count=0 count=0
while true; do while true; do
@ -127,9 +122,9 @@ start() {
break break
fi fi
if [ $count -gt $meyewatch_timeout ]; then if [ $count -gt $MEYEWATCH_TIMEOUT ]; then
msg_fail msg_fail
test "$meyewatch_disable" == "false" && reboot test "$MEYEWATCH_DISABLE" == "false" && reboot
return 1 return 1
fi fi
@ -137,12 +132,12 @@ start() {
done done
# add connected camera(s) with default settings # 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 add_mmal_cameras || add_v4l2_cameras
sync sync
fi fi
if [ "$meyewatch_disable" == "false" ]; then if [ "$MEYEWATCH_DISABLE" == "false" ]; then
watch & watch &
fi fi
@ -151,7 +146,7 @@ start() {
stop() { stop() {
msg_begin "Stopping motioneye" msg_begin "Stopping motioneye"
meyectl stopserver -c $conf &>/dev/null meyectl stopserver -c $CONF &>/dev/null
test $? == 0 && msg_done || msg_fail 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 ps | grep motioneye | grep -v $$ | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1 | xargs -r kill
} }

View File

@ -1,15 +1,16 @@
#!/bin/sh #!/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() { 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 return 0
} }

View File

@ -2,7 +2,7 @@
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() { 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

View File

@ -2,7 +2,7 @@
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() { 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