mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-19 02:58:11 +01:00
Check data directory validity
This commit is contained in:
@@ -13,13 +13,16 @@ chown -R "$PUID:$PGID" "/data/config"
|
||||
# Check current version
|
||||
if [ -f /data/config/www/nextcloud/config/config.php ]; then
|
||||
datadirectory="$(sed -n "s|.*datadirectory' => '*\(.*[^ ]\) *',.*|\1|p" /data/config/www/nextcloud/config/config.php)"
|
||||
echo "... Data directory detected : $datadirectory"
|
||||
|
||||
echo "... Data directory detected : $datadirectory"
|
||||
else
|
||||
datadirectory=/share/nextcloud
|
||||
fi
|
||||
|
||||
|
||||
# Is the directory valid
|
||||
if [[ "$datadirectory" == *"/mnt/"* ]] && [ ! -f "$datadirectory"/index.html ]; then
|
||||
bashio::log.fatal "Data directory does not seem to be valid. Is your drive connected? Stopping to avoid corrupting the data directory."
|
||||
bashio::addon.stop
|
||||
fi
|
||||
|
||||
mkdir -p "$datadirectory"
|
||||
chmod 755 -R "$datadirectory"
|
||||
|
||||
Reference in New Issue
Block a user