mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-28 13:46:32 +00:00
Adapt prepare_conf for directories
This commit is contained in:
parent
89bf6b9720
commit
e17e87f569
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user