fix: only rsync existing directories

Additionally, pin the chown to just the top-level dir for the services dir
This commit is contained in:
josegonzalez
2023-02-17 19:10:14 -05:00
committed by GitHub
parent 7834f353f1
commit 54d88eec7e

View File

@@ -41,13 +41,15 @@ main() {
if [[ ! -e "$dir" ]]; then
log-info "Copying ${dir} skel into place"
mkdir -p "/mnt/dokku${dir}"
if [[ -d "$dir" ]]; then
if [[ -d "/skel${dir}" ]]; then
rsync -a "/skel${dir}/" "${dir}/" || log-fail "Unable to copy ${dir} skel into place"
fi
fi
# chown mount directories to "dokku:dokku"
if [[ "$dir" != "/etc/ssh" ]]; then
if [[ "$dir" == "/var/lib/dokku/services" ]]; then
chown dokku:dokku /var/lib/dokku/services
elif [[ "$dir" != "/etc/ssh" ]]; then
find "$dir" -print0 | xargs -0 chown -h dokku:dokku
fi
done