Update 01-folders.sh

This commit is contained in:
Alexandre
2025-06-25 14:48:02 +02:00
committed by GitHub
parent ff79c2cd0b
commit c1246d9177

View File

@@ -77,14 +77,10 @@ chmod -R 777 /config
# Add directories to dir_whitelist if missing
DIRS_TO_ADD=("/backup" "/media" "/share" "/addons")
for CONFIG_FILE in "$(bashio::config 'config_location')/sync.conf" "/defaults/sync.conf"; do
if [ -f "$CONFIG_FILE" ]; then
echo "Checking dir_whitelist in $CONFIG_FILE"
for DIR in "${DIRS_TO_ADD[@]}"; do
if ! jq -e ".webui.dir_whitelist | index(\"$DIR\")" "$CONFIG_FILE" >/dev/null; then
echo "Adding $DIR to dir_whitelist"
jq ".webui.dir_whitelist += [\"$DIR\"]" "$CONFIG_FILE" | sponge "$CONFIG_FILE"
fi
done
echo "Checking dir_whitelist in /config/sync.json"
for DIR in "${DIRS_TO_ADD[@]}"; do
if ! jq -e ".webui.dir_whitelist | index(\"$DIR\")" /config/sync.json >/dev/null; then
echo "Adding $DIR to dir_whitelist"
jq ".webui.dir_whitelist += [\"$DIR\"]" /config/sync.json | sponge /config/sync.json
fi
done