From de4775cab7e381fd95a8f654df2372203f40417b Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sat, 9 Apr 2016 18:37:59 +0300 Subject: [PATCH] some config files are now looked up in /boot as well --- board/common/overlay/etc/init.d/S01mountall | 9 +++++++-- board/common/overlay/etc/init.d/S03hostname | 11 +++++++++-- board/common/overlay/etc/init.d/S35wifi | 18 ++++++++++++++---- board/common/overlay/etc/init.d/S36ppp | 9 +++++++-- board/common/overlay/etc/init.d/S40network | 9 +++++++-- board/common/overlay/etc/init.d/S50date | 9 +++++++-- board/common/overlay/etc/init.d/S85motioneye | 9 +++++++-- board/common/overlay/etc/init.d/rcK | 2 +- board/raspberrypi/overlay/usr/bin/streameye.sh | 2 +- .../raspberrypi2/overlay/usr/bin/streameye.sh | 2 +- .../raspberrypi3/overlay/usr/bin/streameye.sh | 2 +- 11 files changed, 62 insertions(+), 20 deletions(-) diff --git a/board/common/overlay/etc/init.d/S01mountall b/board/common/overlay/etc/init.d/S01mountall index 1dc871ee3d..481c65f543 100755 --- a/board/common/overlay/etc/init.d/S01mountall +++ b/board/common/overlay/etc/init.d/S01mountall @@ -1,6 +1,7 @@ #!/bin/bash sys_conf="/etc/os.conf" +boot_conf="/boot/os.conf" conf="/data/etc/os.conf" test -n "$os_version" || source /etc/init.d/base @@ -10,8 +11,12 @@ mount_fs() { /bin/mount -a test $? == 0 && msg_done || msg_fail - if [ -f $sys_conf ] && ! [ -f $conf ]; then - cp $sys_conf $conf + if ! [ -f $conf ]; then + if [ -f $boot_conf ]; then + cp $boot_conf $conf + elif [ -f $sys_conf ]; then + cp $sys_conf $conf + fi fi if [ -f $conf ]; then diff --git a/board/common/overlay/etc/init.d/S03hostname b/board/common/overlay/etc/init.d/S03hostname index fed489d840..dc1a56e345 100755 --- a/board/common/overlay/etc/init.d/S03hostname +++ b/board/common/overlay/etc/init.d/S03hostname @@ -1,6 +1,7 @@ #!/bin/bash sys_hostname_file="/etc/hostname" +boot_hostname_file="/boot/hostname" hostname_file="/data/etc/hostname" test -n "$os_version" || source /etc/init.d/base @@ -9,10 +10,16 @@ case "$1" in start) msg_begin "Setting hostname" + if ! [ -f $hostname_file ]; then + if [ -f $boot_hostname_file ]; then + cp $boot_hostname_file $hostname_file + elif [ -f $sys_hostname_file ]; then + cp $sys_hostname_file $hostname_file + fi + fi + if [ -f $hostname_file ]; then hostname=$(cat $hostname_file) - elif [ -f $sys_hostname_file ]; then - hostname=$(cat $sys_hostname_file) else hostname="$os_prefix-$board_sn" fi diff --git a/board/common/overlay/etc/init.d/S35wifi b/board/common/overlay/etc/init.d/S35wifi index 87429a3243..61cb4f78c2 100755 --- a/board/common/overlay/etc/init.d/S35wifi +++ b/board/common/overlay/etc/init.d/S35wifi @@ -1,6 +1,7 @@ #!/bin/bash sys_conf="/etc/wpa_supplicant.conf" +boot_conf="/boot/wpa_supplicant.conf" conf="/data/etc/wpa_supplicant.conf" log="/var/log/wpa_supplicant.log" @@ -9,19 +10,28 @@ iface=wlan0 driver=wext sys_watch_conf="/etc/watch.conf" +boot_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 +if ! [ -f $watch_conf ]; then + if [ -f $boot_watch_conf ]; then + cp $boot_watch_conf $watch_conf + elif [ -f $sys_watch_conf ]; then + cp $sys_watch_conf $watch_conf + fi fi test -f $watch_conf && source $watch_conf -if [ -f $sys_conf ] && ! [ -f $conf ]; then - cp $sys_conf $conf +if ! [ -f $conf ]; then + if [ -f $boot_conf ]; then + cp $boot_conf $conf + elif [ -f $sys_conf ]; then + cp $sys_conf $conf + fi fi test -f $conf || exit 0 diff --git a/board/common/overlay/etc/init.d/S36ppp b/board/common/overlay/etc/init.d/S36ppp index 002419dfab..18913f6dfe 100755 --- a/board/common/overlay/etc/init.d/S36ppp +++ b/board/common/overlay/etc/init.d/S36ppp @@ -1,6 +1,7 @@ #!/bin/bash sys_conf="/etc/ppp/default" +boot_conf="/boot/ppp/default" conf="/data/etc/ppp" prog="/usr/sbin/pppd" @@ -11,8 +12,12 @@ watch_conf="/data/etc/watch.conf" test -f $watch_conf && source $watch_conf -if [ -d $sys_conf ] && ! [ -d $conf ]; then - cp -r $sys_conf $conf +if ! [ -d $conf ]; then + if [ -d $boot_conf ]; then + cp -r $boot_conf $conf + elif [ -d $sys_conf ]; then + cp -r $sys_conf $conf + fi fi test -f $conf/modem || exit 0 diff --git a/board/common/overlay/etc/init.d/S40network b/board/common/overlay/etc/init.d/S40network index 2c3eff3be4..164083a0dc 100755 --- a/board/common/overlay/etc/init.d/S40network +++ b/board/common/overlay/etc/init.d/S40network @@ -3,6 +3,7 @@ mkdir -p /var/lib/dhcp dh_conf="/var/cache/dhclient.conf" sys_static_conf="/etc/static_ip.conf" +boot_static_conf="/boot/static_ip.conf" static_conf="/data/etc/static_ip.conf" watch_conf="/data/etc/watch.conf" @@ -17,8 +18,12 @@ wlan=wlan0 test -r $watch_conf && source $watch_conf -if [ -f $sys_static_conf ] && ! [ -f $static_conf ]; then - cp $sys_static_conf $static_conf +if ! [ -f $static_conf ]; then + if [ -f $boot_static_conf ]; then + cp $boot_static_conf $static_conf + elif [ -f $sys_static_conf ]; then + cp $sys_static_conf $static_conf + fi fi test -r $static_conf && source $static_conf diff --git a/board/common/overlay/etc/init.d/S50date b/board/common/overlay/etc/init.d/S50date index 44736eb86b..0f25df310e 100755 --- a/board/common/overlay/etc/init.d/S50date +++ b/board/common/overlay/etc/init.d/S50date @@ -1,10 +1,15 @@ #!/bin/bash sys_conf="/etc/date.conf" +boot_conf="/boot/date.conf" conf="/data/etc/date.conf" -if [ -f $sys_conf ] && ! [ -f $conf ]; then - cp $sys_conf $conf +if ! [ -f $conf ]; then + if [ -f $boot_conf ]; then + cp $boot_conf $conf + elif [ -f $sys_conf ]; then + cp $sys_conf $conf + fi fi test -f $conf || exit 0 diff --git a/board/common/overlay/etc/init.d/S85motioneye b/board/common/overlay/etc/init.d/S85motioneye index 4ff55d5b33..79716402c4 100755 --- a/board/common/overlay/etc/init.d/S85motioneye +++ b/board/common/overlay/etc/init.d/S85motioneye @@ -1,6 +1,7 @@ #!/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" @@ -10,8 +11,12 @@ meyewatch_disable="" dev_v4l_by_id="/dev/v4l/by-id/" media_dir="/data/output" -if [ -f $sys_conf ] && ! [ -f $conf ]; then - cp $sys_conf $conf +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 -f "$conf" || exit 0 diff --git a/board/common/overlay/etc/init.d/rcK b/board/common/overlay/etc/init.d/rcK index 57424ee304..90d77ec140 100755 --- a/board/common/overlay/etc/init.d/rcK +++ b/board/common/overlay/etc/init.d/rcK @@ -12,7 +12,7 @@ echo "---- shutting down $os_name $os_version ----" >> $boot_log (for i in $(ls -r /etc/init.d/S??*); do [ ! -x "$i" ] && continue [ -f /data/etc/no_$(basename $i) ] && continue - $i stop || break + $i stop done& echo $! > $pid_file) | tee -a $boot_log & pid=$(cat $pid_file) diff --git a/board/raspberrypi/overlay/usr/bin/streameye.sh b/board/raspberrypi/overlay/usr/bin/streameye.sh index 62e99a0a2a..29e5b79d8b 100755 --- a/board/raspberrypi/overlay/usr/bin/streameye.sh +++ b/board/raspberrypi/overlay/usr/bin/streameye.sh @@ -53,7 +53,7 @@ function start() { function stop() { # stop the streameye background watch process - ps | grep streameye | grep -v $$ | grep -v S94streameye| grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1 | xargs -r kill + ps | grep streameye.sh | grep -v $$ | grep -v S94streameye| grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1 | xargs -r kill # stop the raspimjpeg process pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1) diff --git a/board/raspberrypi2/overlay/usr/bin/streameye.sh b/board/raspberrypi2/overlay/usr/bin/streameye.sh index 7178f93e00..8ab060182b 100755 --- a/board/raspberrypi2/overlay/usr/bin/streameye.sh +++ b/board/raspberrypi2/overlay/usr/bin/streameye.sh @@ -53,7 +53,7 @@ function start() { function stop() { # stop the streameye background watch process - ps | grep streameye | grep -v $$ | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1 | xargs -r kill + ps | grep streameye.sh | grep -v $$ | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1 | xargs -r kill # stop the raspimjpeg process pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1) diff --git a/board/raspberrypi3/overlay/usr/bin/streameye.sh b/board/raspberrypi3/overlay/usr/bin/streameye.sh index 7178f93e00..8ab060182b 100755 --- a/board/raspberrypi3/overlay/usr/bin/streameye.sh +++ b/board/raspberrypi3/overlay/usr/bin/streameye.sh @@ -53,7 +53,7 @@ function start() { function stop() { # stop the streameye background watch process - ps | grep streameye | grep -v $$ | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1 | xargs -r kill + ps | grep streameye.sh | grep -v $$ | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1 | xargs -r kill # stop the raspimjpeg process pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1)