fix(deploy): deploy-nas.sh 전체 런타임 디렉토리에 chown+chmod 일괄 적용
서비스별 개별 처리 대신 $DST 전체에 대해 chown -R + chmod -R 755 수행. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -62,28 +62,9 @@ rsync -rl --no-owner --no-group "$SRC/docker-compose.yml" "$DST/docker-compose.y
|
||||
fi
|
||||
}
|
||||
|
||||
# 파일 권한 설정 — numeric UID/GID + idempotent (이미 맞으면 skip) + silent
|
||||
# Synology ACL이 chown을 거부할 수 있어도 파일이 이미 올바른 소유자면 문제없음
|
||||
echo "Setting ownership ${DEPLOY_UID}:${DEPLOY_GID} and mode ${DEPLOY_MODE}..."
|
||||
chown_if_needed() {
|
||||
local target="$1"
|
||||
[ -e "$target" ] || return 0
|
||||
local cur
|
||||
cur=$(stat -c '%u:%g' "$target" 2>/dev/null || echo "")
|
||||
if [ "$cur" = "${DEPLOY_UID}:${DEPLOY_GID}" ]; then
|
||||
return 0
|
||||
fi
|
||||
chown "${DEPLOY_UID}:${DEPLOY_GID}" "$target" 2>/dev/null || true
|
||||
}
|
||||
|
||||
for dir in $SERVICES; do
|
||||
[ -e "$DST/$dir" ] || continue
|
||||
# 재귀: 디렉토리/파일 각각 idempotent chown (find로 mismatch만 시도)
|
||||
find "$DST/$dir" \( ! -uid "$DEPLOY_UID" -o ! -gid "$DEPLOY_GID" \) \
|
||||
-exec chown "${DEPLOY_UID}:${DEPLOY_GID}" {} + 2>/dev/null || true
|
||||
chmod -R "$DEPLOY_MODE" "$DST/$dir" 2>/dev/null || true
|
||||
done
|
||||
chown_if_needed "$DST/docker-compose.yml"
|
||||
chmod "$DEPLOY_MODE" "$DST/docker-compose.yml" 2>/dev/null || true
|
||||
# 파일 권한 설정 — 전체 런타임 디렉토리에 일괄 적용
|
||||
echo "Setting ownership ${DEPLOY_UID}:${DEPLOY_GID} and mode ${DEPLOY_MODE} on $DST ..."
|
||||
chown -R "${DEPLOY_UID}:${DEPLOY_GID}" "$DST" 2>/dev/null || true
|
||||
chmod -R "$DEPLOY_MODE" "$DST" 2>/dev/null || true
|
||||
|
||||
echo "SYNC_OK"
|
||||
|
||||
Reference in New Issue
Block a user