Init scripts: use test -s to test conf file sizes

This commit is contained in:
Calin Crisan 2019-06-30 18:21:25 +03:00
parent 68d509147d
commit 49139f3d61
18 changed files with 24 additions and 24 deletions

View File

@ -28,7 +28,7 @@ case "$1" in
done
# source os_conf again, as it might have changed after restore
test -f /etc/init.d/os_conf && source /etc/init.d/os_conf
test -s /etc/init.d/os_conf && source /etc/init.d/os_conf
if [[ "${OS_DEBUG}" != "true" ]]; then
mount -o remount,ro /boot
fi

View File

@ -17,9 +17,9 @@ fi
case "$1" in
start)
msg_begin "Applying sysctl parameters"
test -f ${SYS_CONF} && sysctl -q -p ${SYS_CONF}
test -f ${CONF} && sysctl -q -p ${CONF}
test -f ${BOOT_CONF} && sysctl -q -p ${BOOT_CONF}
test -s ${SYS_CONF} && sysctl -q -p ${SYS_CONF}
test -s ${CONF} && sysctl -q -p ${CONF}
test -s ${BOOT_CONF} && sysctl -q -p ${BOOT_CONF}
msg_done
;;

View File

@ -6,7 +6,7 @@ PROG_UA="/sbin/udevadm"
test -f ${PROG} || exit 0
test -f ${CONF} || exit 0
test -s ${CONF} || exit 0
test -n "${OS_VERSION}" || source /etc/init.d/base

View File

@ -12,7 +12,7 @@ PROG_UA="/usr/bin/udevadm"
test -x ${PROG} || exit 0
# dbus is currently only used by bluez
test -f ${BTCONF} || test -f ${BOOT_BTCONF} || test -f ${SYS_BTCONF} || exit 0
test -s ${BTCONF} || test -s ${BOOT_BTCONF} || test -s ${SYS_BTCONF} || exit 0
test -n "${OS_VERSION}" || source /etc/init.d/base

View File

@ -18,9 +18,9 @@ test -x ${PROG} || exit 0
test -n "${OS_VERSION}" || source /etc/init.d/base
prepare_conf ${CONF} ${SYS_CONF} ${BOOT_CONF}
test -f ${CONF} || exit 0
test -s ${CONF} || exit 0
test -f ${WATCH_CONF} && source ${WATCH_CONF}
test -s ${WATCH_CONF} && source ${WATCH_CONF}
running() {

View File

@ -21,7 +21,7 @@ prepare_conf ${WATCH_CONF} ${SYS_WATCH_CONF} ${BOOT_WATCH_CONF}
source ${WATCH_CONF}
prepare_conf ${CONF} ${SYS_CONF} ${BOOT_CONF}
test -f ${CONF} || exit 0
test -s ${CONF} || exit 0
ssid=$(cat ${CONF} | grep ssid | grep -v scan_ssid | cut -d '"' -f 2)
test -n "${ssid}" || exit 0

View File

@ -17,7 +17,7 @@ test -x ${PROG} || exit 0
test -n "${OS_VERSION}" || source /etc/init.d/base
prepare_conf ${CONF} ${SYS_CONF} ${BOOT_CONF}
test -f ${CONF} || exit 0
test -s ${CONF} || exit 0
configure() {
@ -26,7 +26,7 @@ configure() {
cp ${CONF} ${RUN_CONF}
# if no specific name configured, use hostname
if ! grep -E 'Name\s*=' ${RUN_CONF} &>/dev/null; then
if ! grep -E 'Name\s*=' ${RUN_CONF} &>/dev/null; then
sed -ri "s/(\[General\])/\1\nName = $(hostname)/" ${RUN_CONF}
fi

View File

@ -8,7 +8,7 @@ NETWATCH_INTERVAL=20
# watch configuration is already prepared by wifi init script
test -f ${CONF} || exit 0
test -s ${CONF} || exit 0
source ${CONF}
test -n "${NETWATCH_HOST}" || exit 0

View File

@ -8,7 +8,7 @@ CONF="/data/etc/firewall.sh"
test -n "${OS_VERSION}" || source /etc/init.d/base
prepare_conf ${CONF} ${SYS_CONF} ${BOOT_CONF}
test -f ${CONF} || exit 0
test -s ${CONF} || exit 0
start() {

View File

@ -13,7 +13,7 @@ test -x ${PROG} || exit 0
test -n "${OS_VERSION}" || source /etc/init.d/base
prepare_conf ${CONF} ${SYS_CONF} ${BOOT_CONF}
test -f ${CONF} || exit 0
test -s ${CONF} || exit 0
start() {

View File

@ -18,7 +18,7 @@ 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 -s ${CONF} || exit 0
test "${OS_NETWORKLESS}" == "true" && exit 0

View File

@ -10,7 +10,7 @@ test -x ${PROG} || exit 0
test -n "${OS_VERSION}" || source /etc/init.d/base
test -f ${CONF} || exit 0
test -s ${CONF} || exit 0
test "${OS_NETWORKLESS}" == "true" && exit 0

View File

@ -9,7 +9,7 @@ test -x ${PROG} || exit 0
test -n "${OS_VERSION}" || source /etc/init.d/base
test -n "${OS_DEBUG}" || source /etc/init.d/conf
test -f ${CONF} || exit 0
test -s ${CONF} || exit 0
test "${OS_NETWORKLESS}" == "true" && exit 0

View File

@ -11,7 +11,7 @@ test -x ${PROG} || exit 0
test -n "${OS_VERSION}" || source /etc/init.d/base
test -n "${OS_DEBUG}" || source /etc/init.d/conf
test -f ${CONF} || exit 0
test -s ${CONF} || exit 0
test "${OS_NETWORKLESS}" == "true" && exit 0

View File

@ -12,7 +12,7 @@ test -x ${PROG} || exit 0
test -n "${OS_VERSION}" || source /etc/init.d/base
prepare_conf ${CONF} ${SYS_CONF} ${BOOT_CONF}
test -f ${CONF} || exit 0
test -s ${CONF} || exit 0
start() {

View File

@ -12,7 +12,7 @@ test -x ${PROG} || exit 0
test -n "${OS_VERSION}" || source /etc/init.d/base
prepare_conf ${CONF} ${SYS_CONF} ${BOOT_CONF}
test -f ${CONF} || exit 0
test -s ${CONF} || exit 0
start() {

View File

@ -3,7 +3,7 @@
USERINIT="/data/etc/userinit.sh"
test -f ${USERINIT} || exit 0
test -s ${USERINIT} || exit 0
test -n "${OS_VERSION}" || source /etc/init.d/base

View File

@ -5,9 +5,9 @@ TMP_BOOT_LOG=/tmp/_boot.log
PID_FILE=/tmp/rc.pid
set -a
test -f /etc/environment && source /etc/environment
test -f /data/etc/environment && source /data/etc/environment
test -f /boot/etc/environment && source /boot/etc/environment
test -s /etc/environment && source /etc/environment
test -s /data/etc/environment && source /data/etc/environment
test -s /boot/etc/environment && source /boot/etc/environment
set +a
source /etc/init.d/base