Init scripts: fix sourcing order

This commit is contained in:
Calin Crisan 2019-01-11 14:09:33 +02:00
parent ef11ee161a
commit 6ac44f70cf
8 changed files with 25 additions and 32 deletions

View File

@ -4,6 +4,7 @@ sys_modules_file="/etc/modules"
boot_modules_file="/boot/modules"
modules_file="/data/etc/modules"
test -n "$os_version" || source /etc/init.d/base
case "$1" in

View File

@ -4,6 +4,7 @@ sys_hostname_file="/etc/hostname"
boot_hostname_file="/boot/hostname"
hostname_file="/data/etc/hostname"
test -n "$os_version" || source /etc/init.d/base
case "$1" in

View File

@ -12,12 +12,14 @@ watch_conf="/data/etc/watch.conf"
link_watch=yes
link_watch_timeout=20
test -f $watch_conf && source $watch_conf
test -n "$os_version" || source /etc/init.d/base
prepare_conf $conf $sys_conf $boot_conf
test -f $conf || exit 0
test -n "$os_version" || source /etc/init.d/base
test -f $watch_conf && source $watch_conf
running() {
killall -0 hostapd &> /dev/null

View File

@ -12,6 +12,9 @@ sys_watch_conf="/etc/watch.conf"
boot_watch_conf="/boot/watch.conf"
watch_conf="/data/etc/watch.conf"
test -n "$os_version" || source /etc/init.d/base
prepare_conf $watch_conf $sys_watch_conf $boot_watch_conf
source $watch_conf
@ -21,10 +24,10 @@ 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
test "$os_networkless" == "true" && exit 0
connected() {
ip link show dev $os_wlan 2>&1 | grep LOWER_UP &> /dev/null && return 0 || return 1
}

View File

@ -9,17 +9,19 @@ provider="mobile"
watch_conf="/data/etc/watch.conf"
source $watch_conf
test -n "$os_version" || source /etc/init.d/base
prepare_conf $conf $sys_conf $boot_conf
test -e $conf/modem || exit 0
test -e $conf/apn || exit 0
test -n "$os_version" || source /etc/init.d/base
source $watch_conf
test "$os_networkless" == "true" && exit 0
connected() {
ifconfig | grep $os_ppp &>/dev/null && return 0 || return 1
}

View File

@ -4,6 +4,8 @@ sys_conf="/etc/bluetooth.conf"
boot_conf="/boot/bluetooth.conf"
conf="/data/etc/bluetooth.conf"
test -n "$os_version" || source /etc/init.d/base
prepare_conf $conf $sys_conf $boot_conf
test -f $conf || exit 0
@ -15,7 +17,6 @@ run_conf=/var/lib/bluetooth.conf
test -x $bluetoothd || exit 0
test -n "$os_version" || source /etc/init.d/base
configure() {
mkdir -p $run_data_dir

View File

@ -7,18 +7,13 @@ conf="/data/etc/dnsmasq.conf"
log="/var/log/dnsmasq.log"
prog="/usr/sbin/dnsmasq"
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
test -n "$os_version" || source /etc/init.d/base
prepare_conf $conf $sys_conf $boot_conf
test -f $conf || exit 0
start() {
msg_begin "Starting dnsmasq"

View File

@ -11,26 +11,14 @@ sys_ntp_conf="/etc/ntp.conf"
boot_ntp_conf="/boot/ntp.conf"
ntp_conf="/data/etc/ntp.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 $ntp_conf ]]; then
if [[ -f $boot_ntp_conf ]]; then
cp $boot_ntp_conf $ntp_conf
elif [[ -f $sys_ntp_conf ]]; then
cp $sys_ntp_conf $ntp_conf
fi
fi
test -f $conf || exit 0
test -n "$os_version" || source /etc/init.d/base
prepare_conf $conf $sys_conf $boot_conf
prepare_conf $ntp_conf $sys_ntp_conf $boot_ntp_conf
test -f $conf || exit 0
test "$os_networkless" == "true" && exit 0
date_timeout=10