mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-22 07:16:06 +02:00
Update 00-folders.sh
This commit is contained in:
@@ -75,17 +75,16 @@ if [[ ! -e "$(bashio::config 'config_location')"/sync.conf ]]; then
|
|||||||
cp /defaults/sync.conf "$(bashio::config 'config_location')"/sync.conf
|
cp /defaults/sync.conf "$(bashio::config 'config_location')"/sync.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add /backup and /media to dir_whitelist if missing
|
# 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
|
for CONFIG_FILE in "$(bashio::config 'config_location')/sync.conf" "/defaults/sync.conf"; do
|
||||||
if [ -f "$CONFIG_FILE" ]; then
|
if [ -f "$CONFIG_FILE" ]; then
|
||||||
echo "Checking dir_whitelist in $CONFIG_FILE"
|
echo "Checking dir_whitelist in $CONFIG_FILE"
|
||||||
if ! jq -e '.webui.dir_whitelist | index("/backup")' "$CONFIG_FILE" >/dev/null; then
|
for DIR in "${DIRS_TO_ADD[@]}"; do
|
||||||
echo "Adding /backup to dir_whitelist"
|
if ! jq -e ".webui.dir_whitelist | index(\"$DIR\")" "$CONFIG_FILE" > /dev/null; then
|
||||||
jq '.webui.dir_whitelist += ["/backup"]' "$CONFIG_FILE" | sponge "$CONFIG_FILE"
|
echo "Adding $DIR to dir_whitelist"
|
||||||
fi
|
jq ".webui.dir_whitelist += [\"$DIR\"]" "$CONFIG_FILE" | sponge "$CONFIG_FILE"
|
||||||
if ! jq -e '.webui.dir_whitelist | index("/media")' "$CONFIG_FILE" >/dev/null; then
|
fi
|
||||||
echo "Adding /media to dir_whitelist"
|
done
|
||||||
jq '.webui.dir_whitelist += ["/media"]' "$CONFIG_FILE" | sponge "$CONFIG_FILE"
|
fi
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user