#!/usr/bin/env bash set -euo pipefail DFWEBOS_STORAGE_DOWNLOADS_MUSIC_DIR="${DFWEBOS_ROOT}/data/storage/downloads/music" DESIRED_OWNER="1000:1000" if [[ ! -d "${DFWEBOS_STORAGE_DOWNLOADS_MUSIC_DIR}" ]]; then mkdir -p "${DFWEBOS_STORAGE_DOWNLOADS_MUSIC_DIR}" fi navidrome_correct_permission() { local -r path="${1}" if [[ -d "${path}" ]]; then owner=$(stat -c "%u:%g" "${path}") if [[ "${owner}" != "${DESIRED_OWNER}" ]]; then chown "${DESIRED_OWNER}" "${path}" fi fi } navidrome_correct_permission "${DFWEBOS_STORAGE_DOWNLOADS_MUSIC_DIR}"