You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

31 lines
617 B

#!/usr/bin/env bash
set -euo pipefail
APP_DATA_DIR="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/../data)"
ORDINALS_DATA_DIR="${APP_DATA_DIR}/ord"
DESIRED_OWNER="1000:1000"
set_correct_permissions() {
local -r path="${1}"
if [[ -d "${path}" ]]; then
owner=$(stat -c "%u:%g" "${path}")
if [[ "${owner}" != "${DESIRED_OWNER}" ]]; then
chown -R "${DESIRED_OWNER}" "${path}"
fi
fi
}
if [[ -f "${APP_DATA_DIR}/index.redb" ]]; then
rm -f "${APP_DATA_DIR}/index.redb"
mkdir -p "${ORDINALS_DATA_DIR}"
# set correct permissions for both data and ord
set_correct_permissions "${APP_DATA_DIR}"
fi