From 92bd4b031d8ac63928939290c852df64311fc518 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sat, 12 Jan 2019 15:04:16 +0200 Subject: [PATCH] /etc/init.d/base: small prepare_conf optimization --- board/common/overlay/etc/init.d/base | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/board/common/overlay/etc/init.d/base b/board/common/overlay/etc/init.d/base index 1d262a6e7c..b1168c80fd 100644 --- a/board/common/overlay/etc/init.d/base +++ b/board/common/overlay/etc/init.d/base @@ -39,6 +39,14 @@ prepare_conf() { if [[ -n "$user_conf" && -e "$user_conf" ]]; then cp -rf "$user_conf" "$actual_conf" + + # we want only Unix newlines in conf files + if [[ -f "$actual_conf" ]]; then + sed -i 's/\r//g' "$actual_conf" + elif [[ -d "$actual_conf" ]]; then + find "$actual_conf" -type f | xargs -L1 sed -i 's/\r//g' + fi + grep -E "/boot .*ro[\s,]" /proc/mounts &>/dev/null RO=$? test $RO == 0 && mount -o remount,rw /boot @@ -49,12 +57,5 @@ prepare_conf() { if [[ ! -e "$actual_conf" && -e "$system_conf" ]]; then cp "$system_conf" "$actual_conf" fi - - # we want only Unix newlines in conf files - if [[ -f "$actual_conf" ]]; then - sed -i 's/\r//g' "$actual_conf" - elif [[ -d "$actual_conf" ]]; then - find "$actual_conf" -type f | xargs -L1 sed -i 's/\r//g' - fi }