mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-28 21:56:31 +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"
|
system_conf="$2"
|
||||||
user_conf="$3"
|
user_conf="$3"
|
||||||
|
|
||||||
if [[ -n "$user_conf" && -f "$user_conf" ]]; then
|
if [[ -n "$user_conf" && -e "$user_conf" ]]; then
|
||||||
cp -f "$user_conf" "$actual_conf"
|
cp -rf "$user_conf" "$actual_conf"
|
||||||
grep -E "/boot .*ro[\s,]" /proc/mounts
|
grep -E "/boot .*ro[\s,]" /proc/mounts
|
||||||
RO=$?
|
RO=$?
|
||||||
test $RO == 0 && mount -o remount,rw /boot
|
test $RO == 0 && mount -o remount,rw /boot
|
||||||
rm -f $user_conf
|
rm -rf $user_conf
|
||||||
test $RO == 0 && mount -o remount,ro /boot
|
test $RO == 0 && mount -o remount,ro /boot
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -f "$actual_conf" && -f "$system_conf" ]]; then
|
if [[ ! -e "$actual_conf" && -e "$system_conf" ]]; then
|
||||||
cp "$system_conf" "$actual_conf"
|
cp "$system_conf" "$actual_conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# we want only Unix newlines in conf files
|
# we want only Unix newlines in conf files
|
||||||
if [[ -f "$actual_conf" ]]; then
|
if [[ -f "$actual_conf" ]]; then
|
||||||
sed -i 's/\r//g' "$actual_conf"
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user