mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-29 06:06:32 +00:00
Source in all available os.conf files
This commit is contained in:
parent
df44e16f88
commit
3a06cf48de
@ -5,8 +5,6 @@ test -n "$os_version" || source /etc/init.d/base
|
|||||||
sys_version_file="/etc/version"
|
sys_version_file="/etc/version"
|
||||||
version_file="/data/etc/version"
|
version_file="/data/etc/version"
|
||||||
post_upgrade_dir="/usr/share/post-upgrade"
|
post_upgrade_dir="/usr/share/post-upgrade"
|
||||||
sys_os_conf="/etc/os.conf"
|
|
||||||
os_conf="/data/etc/os.conf"
|
|
||||||
|
|
||||||
hash=$(md5sum $version_file 2>/dev/null | cut -d ' ' -f 1)
|
hash=$(md5sum $version_file 2>/dev/null | cut -d ' ' -f 1)
|
||||||
sys_hash=$(md5sum $sys_version_file 2>/dev/null | cut -d ' ' -f 1)
|
sys_hash=$(md5sum $sys_version_file 2>/dev/null | cut -d ' ' -f 1)
|
||||||
@ -38,23 +36,10 @@ function run_post_upgrade() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_os_conf() {
|
|
||||||
source $sys_os_conf
|
|
||||||
sys_vars=$(cat $sys_os_conf | cut -d '=' -f 1)
|
|
||||||
for var in $sys_vars; do
|
|
||||||
if ! grep "$var=" $os_conf &>/dev/null; then
|
|
||||||
msg_begin "Adding $var to os.conf"
|
|
||||||
echo "$var=\"${!var}\"" >> $os_conf
|
|
||||||
msg_done
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
run_post_upgrade
|
run_post_upgrade
|
||||||
cp $sys_version_file $version_file
|
cp $sys_version_file $version_file
|
||||||
update_os_conf
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
stop)
|
stop)
|
||||||
|
@ -12,36 +12,12 @@ sys_watch_conf="/etc/watch.conf"
|
|||||||
boot_watch_conf="/boot/watch.conf"
|
boot_watch_conf="/boot/watch.conf"
|
||||||
watch_conf="/data/etc/watch.conf"
|
watch_conf="/data/etc/watch.conf"
|
||||||
|
|
||||||
if ! [[ -f $watch_conf ]]; then
|
prepare_conf $watch_conf $sys_watch_conf $boot_watch_conf
|
||||||
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
|
|
||||||
|
|
||||||
source $watch_conf
|
source $watch_conf
|
||||||
|
|
||||||
if [[ -f $boot_conf ]]; then
|
prepare_conf $conf $sys_conf $boot_conf
|
||||||
cp -f $boot_conf $conf
|
|
||||||
grep -E "/boot .*ro[\s,]" /proc/mounts
|
|
||||||
RO=$?
|
|
||||||
test $RO == 0 && mount -o remount,rw /boot
|
|
||||||
rm -f $boot_conf
|
|
||||||
test $RO == 0 && mount -o remount,ro /boot
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! [[ -f $conf ]]; then
|
|
||||||
if [[ -f $sys_conf ]]; then
|
|
||||||
cp $sys_conf $conf
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
test -f $conf || exit 0
|
test -f $conf || exit 0
|
||||||
|
|
||||||
# we want only Unix newlines here
|
|
||||||
sed -i 's/\r//g' $conf
|
|
||||||
|
|
||||||
ssid=$(cat $conf | grep ssid | grep -v scan_ssid | cut -d '"' -f 2)
|
ssid=$(cat $conf | grep ssid | grep -v scan_ssid | cut -d '"' -f 2)
|
||||||
test -n "$ssid" || exit 0
|
test -n "$ssid" || exit 0
|
||||||
|
|
||||||
|
@ -2,28 +2,20 @@
|
|||||||
|
|
||||||
_sys_conf="/etc/os.conf"
|
_sys_conf="/etc/os.conf"
|
||||||
_boot_conf="/boot/os.conf"
|
_boot_conf="/boot/os.conf"
|
||||||
_conf="/data/etc/os.conf"
|
_data_conf="/data/etc/os.conf"
|
||||||
|
|
||||||
if ! [[ -d /data/etc ]]; then
|
# source in all conf files in order of precedence
|
||||||
# use boot/system variants if we don't have the data partition mounted
|
if [[ -f $_sys_conf ]]; then
|
||||||
if [[ -f $_boot_conf ]]; then
|
source $_sys_conf
|
||||||
source $_boot_conf
|
|
||||||
elif [[ -f $_sys_conf ]]; then
|
|
||||||
source $_sys_conf
|
|
||||||
fi
|
|
||||||
|
|
||||||
return
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [[ -f $_conf ]]; then
|
if [[ -f $_data_conf ]]; then
|
||||||
if [[ -f $_boot_conf ]]; then
|
source $_data_conf
|
||||||
cp $_boot_conf $_conf
|
|
||||||
elif [[ -f $_sys_conf ]]; then
|
|
||||||
cp $_sys_conf $_conf
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f $_conf ]]; then
|
if [[ -f $_boot_conf ]]; then
|
||||||
source $_conf
|
source $_boot_conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
unset _sys_conf _boot_conf _data_conf
|
||||||
|
|
||||||
|
@ -35,7 +35,6 @@ fi
|
|||||||
|
|
||||||
SYS_VERSION_FILE=/etc/version
|
SYS_VERSION_FILE=/etc/version
|
||||||
SYS_BOARD_FILE=/etc/board
|
SYS_BOARD_FILE=/etc/board
|
||||||
OS_CONF=/data/etc/os.conf
|
|
||||||
|
|
||||||
MIN_FREE_DISK=$((500*1024)) # 500 MB
|
MIN_FREE_DISK=$((500*1024)) # 500 MB
|
||||||
VER_FILE=version
|
VER_FILE=version
|
||||||
@ -78,7 +77,8 @@ fi
|
|||||||
#### versions ####
|
#### versions ####
|
||||||
|
|
||||||
function show_versions() {
|
function show_versions() {
|
||||||
source $OS_CONF
|
source /etc/init.d/conf # we need this for the os_ vars
|
||||||
|
|
||||||
board=$(cat $SYS_BOARD_FILE)
|
board=$(cat $SYS_BOARD_FILE)
|
||||||
show_json=$1
|
show_json=$1
|
||||||
|
|
||||||
@ -144,7 +144,8 @@ function do_download() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source $OS_CONF
|
source /etc/init.d/conf # we need this for the os_ vars
|
||||||
|
|
||||||
board=$(cat $SYS_BOARD_FILE)
|
board=$(cat $SYS_BOARD_FILE)
|
||||||
url=$1
|
url=$1
|
||||||
version=$1
|
version=$1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user