Files
DFWebOS-Apps/paperless/exports.sh

33 lines
1.3 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Убедитесь, что каталоги безбумажного потребления и экспорта созданы с правильными разрешениями.
DFWEBOS_DATA_DIR="${DFWEBOS_ROOT}/data"
DFWEBOS_DATA_STORAGE_DIR="${DFWEBOS_DATA_DIR}/storage"
DFWEBOS_DATA_STORAGE_PAPERLESS_DIR="${DFWEBOS_DATA_STORAGE_DIR}/paperless"
DFWEBOS_DATA_STORAGE_PAPERLESS_CONSUME_DIR="${DFWEBOS_DATA_STORAGE_PAPERLESS_DIR}/consume"
DFWEBOS_DATA_STORAGE_PAPERLESS_EXPORT_DIR="${DFWEBOS_DATA_STORAGE_PAPERLESS_DIR}/export"
DESIRED_OWNER="1000:1000"
if [[ ! -d "${DFWEBOS_DATA_STORAGE_PAPERLESS_CONSUME_DIR}" ]]; then
mkdir -p "${DFWEBOS_DATA_STORAGE_PAPERLESS_CONSUME_DIR}"
fi
if [[ ! -d "${DFWEBOS_DATA_STORAGE_PAPERLESS_EXPORT_DIR}" ]]; then
mkdir -p "${DFWEBOS_DATA_STORAGE_PAPERLESS_EXPORT_DIR}"
fi
set_paperless_correct_permissions() {
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
}
set_paperless_correct_permissions "${DFWEBOS_DATA_STORAGE_DIR}"
set_paperless_correct_permissions "${DFWEBOS_DATA_STORAGE_PAPERLESS_DIR}"
set_paperless_correct_permissions "${DFWEBOS_DATA_STORAGE_PAPERLESS_CONSUME_DIR}"
set_paperless_correct_permissions "${DFWEBOS_DATA_STORAGE_PAPERLESS_EXPORT_DIR}"