umbrel-apps/file-browser/exports.sh
Steven Briscoe fb3e468beb
App Submission: File Browser (#169)
Co-authored-by: Steven Briscoe <me@stevenbriscoe.com>
Co-authored-by: Mayank Chhabra <mayank@umbrel.com>
2022-09-28 12:11:29 +02:00

22 lines
546 B
Bash

UMBREL_DATA_DIR="${UMBREL_ROOT}/data"
UMBREL_DATA_STORAGE_DIR="${UMBREL_DATA_DIR}/storage"
DESIRED_OWNER="1000:1000"
if [[ ! -d "${UMBREL_DATA_STORAGE_DIR}" ]]; then
mkdir -p "${UMBREL_DATA_STORAGE_DIR}"
fi
filebrowser_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
}
filebrowser_correct_permission "${UMBREL_DATA_DIR}"
filebrowser_correct_permission "${UMBREL_DATA_STORAGE_DIR}"