Ingress addition

This commit is contained in:
Alexandre
2022-05-20 15:16:33 +02:00
parent f27adf81b5
commit 1aa3137392
16 changed files with 255 additions and 11 deletions

View File

@@ -16,7 +16,7 @@ change_folders () {
CONFIGLOCATION=$1
ORIGINALLOCATION=$2
TYPE=$3
# Inform
bashio::log.info "Setting $TYPE to $CONFIGLOCATION"
@@ -26,15 +26,15 @@ change_folders () {
grep -rl "$ORIGINALLOCATION" /etc/services.d | xargs sed -i "s|$ORIGINALLOCATION|$CONFIGLOCATION|g" || true
sed -i "s=$ORIGINALLOCATION=$CONFIGLOCATION=g" /etc/cont-init.d/10-adduser || true
sed -i "s=$ORIGINALLOCATION=$CONFIGLOCATION=g" /defaults/* || true
# Adapt sync.conf
for FILE in "$ORIGINALLOCATION/sync.conf" "$CONFIGLOCATION/sync.conf" "/defaults/sync.conf"; do
if [ "$TYPE" = "config_location" ]; then
if [ "$TYPE" = "config_location" ]; then
[ -f "$FILE" ] && jq --arg variable "$CONFIGLOCATION" '.storage_path = $variable' "$FILE" | sponge "$FILE"
fi
if [ "$TYPE" = "data_location" ]; then
[ -f "$FILE" ] && jq --arg variable "$CONFIGLOCATION" '.directory_root = $variable' "$FILE" | sponge "$FILE"
[ -f "$FILE" ] && jq --arg variable "$CONFIGLOCATION/downloads" '.files_default_path = $variable' "$FILE" | sponge "$FILE"
[ -f "$FILE" ] && jq --arg variable "$CONFIGLOCATION/downloads" '.files_default_path = $variable' "$FILE" | sponge "$FILE"
fi
done
@@ -43,11 +43,11 @@ change_folders () {
for FOLDER in "$CONFIGLOCATION" "$CONFIGLOCATION"/folders "$CONFIGLOCATION"/mounted_folders "$CONFIGLOCATION"/downloads; do
[ ! -d "$FOLDER" ] && echo "Creating $FOLDER" && mkdir -p "$FOLDER"
done
# Set permissions
echo "Setting ownership to $PUID:$PGID"
chown -R "$PUID":"$PGID" "$CONFIGLOCATION"
# Transfer files
if [ -d "$ORIGINALLOCATION" ] && [ "$(ls -A "$ORIGINALLOCATION" 2>/dev/null)" ]; then
echo "Files were existing in $ORIGINALLOCATION, they will be moved to $CONFIGLOCATION"