From e17e87f569621d7f642f75ef83fbbd589ffd8064 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Fri, 11 Jan 2019 13:59:53 +0200 Subject: [PATCH] Adapt prepare_conf for directories --- board/common/overlay/etc/init.d/base | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/board/common/overlay/etc/init.d/base b/board/common/overlay/etc/init.d/base index b6917581f3..e21a61130c 100755 --- a/board/common/overlay/etc/init.d/base +++ b/board/common/overlay/etc/init.d/base @@ -38,22 +38,24 @@ prepare_conf() { system_conf="$2" user_conf="$3" - if [[ -n "$user_conf" && -f "$user_conf" ]]; then - cp -f "$user_conf" "$actual_conf" + if [[ -n "$user_conf" && -e "$user_conf" ]]; then + cp -rf "$user_conf" "$actual_conf" grep -E "/boot .*ro[\s,]" /proc/mounts RO=$? test $RO == 0 && mount -o remount,rw /boot - rm -f $user_conf + rm -rf $user_conf test $RO == 0 && mount -o remount,ro /boot fi - if [[ ! -f "$actual_conf" && -f "$system_conf" ]]; then + 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 }