From c962fa6ab912eb5240f6e4b16a8aa987c7b33622 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Sun, 20 Feb 2022 11:39:08 +0100 Subject: [PATCH] Update 00-data_location.sh --- .../rootfs/etc/cont-init.d/00-data_location.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/webtop_kde/rootfs/etc/cont-init.d/00-data_location.sh b/webtop_kde/rootfs/etc/cont-init.d/00-data_location.sh index a23c18d18..3117ca8ca 100644 --- a/webtop_kde/rootfs/etc/cont-init.d/00-data_location.sh +++ b/webtop_kde/rootfs/etc/cont-init.d/00-data_location.sh @@ -7,11 +7,26 @@ PGID=$(bashio::config "PGID") # Check data location LOCATION=$(bashio::config 'data_location') + if [[ "$LOCATION" = "null" || -z "$LOCATION" ]]; then # Default location LOCATION="/share/webtop_kde" else bashio::log.warning "Warning : a custom data location was selected, but the previous folder will NOT be copied. You need to do it manually" + + # Check if config is located in an acceptable location + LOCATIONOK="" + for location in "/share" "/config" "/data" "/mnt"; do + if [[ "$LOCATION" == "$location"* ]]; then + LOCATIONOK=true + fi + done + + if [ -z "$LOCATIONOK" ]; then + LOCATION=/config/addons_config/${HOSTNAME#*-} + bashio::log.fatal "Your data_location value can only be set in /share, /config or /data (internal to addon). It will be reset to the default location : $LOCATION" + fi + fi # Set data location