From 1ee3e91e9e50f5f636ccba6425cd7da4f705c388 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Wed, 18 May 2022 12:02:08 +0200 Subject: [PATCH] Update 00-folders.sh --- .../rootfs/etc/cont-init.d/00-folders.sh | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/resiliosync/rootfs/etc/cont-init.d/00-folders.sh b/resiliosync/rootfs/etc/cont-init.d/00-folders.sh index 634c2fc7b..d69f95db6 100644 --- a/resiliosync/rootfs/etc/cont-init.d/00-folders.sh +++ b/resiliosync/rootfs/etc/cont-init.d/00-folders.sh @@ -1,4 +1,35 @@ -#!/bin/bash +#!/usr/bin/with-contenv bashio +# shellcheck shell=bash + +#Disable script +echo "script is not enabled yet" +exit 0 + +# Define user +PUID=$(bashio::config "PUID") +PGID=$(bashio::config "PGID") + +# Check data location +DATALOCATION=$(bashio::config 'data_location') +if [[ "$DATALOCATION" = "null" || -z "$DATALOCATION" ]]; then DATALOCATION=/config/addons_config/${HOSTNAME#*-}; fi + +# Check config location +LOCATION=$(bashio::config 'config_location') +if [[ "$CONFIGLOCATION" = "null" || -z "$CONFIGLOCATION" ]]; then CONFIGLOCATION=/config/addons_config/${HOSTNAME#*-}_config; fi + + +# Set data location +bashio::log.info "Setting data location to $LOCATION" +sed -i "s|/config|$LOCATION|g" /etc/services.d/jellyfin/run +sed -i "s|/config|$LOCATION|g" /etc/cont-init.d/10-adduser +sed -i "s|/config|$LOCATION|g" /etc/cont-init.d/30-config + +echo "Creating $LOCATION" +mkdir -p "$LOCATION" + +bashio::log.info "Setting ownership to $PUID:$PGID" +chown "$PUID":"$PGID" "$LOCATION" + echo "Checking folders" LOCATION="/share/resiliosync"