fix(storage): allow custom chown values in chown-storage-dir script

This commit is contained in:
RichardDorian
2026-07-08 08:29:13 +02:00
parent a0361d59c1
commit 06bedebce3

View File

@@ -16,13 +16,15 @@ main() {
exit 1
fi
case "$CHOWN_ID" in
0 | 1000 | 2000 | 32767 | 165536 | 166536 | 167536 | 198303) ;;
*)
echo " ! Unsupported chown permissions. Supported values: 0, 1000, 2000, 32767 (and user namespace offset variants)" 1>&2
exit 1
;;
esac
if [[ ! "$CHOWN_ID" =~ ^[0-9]+$ ]]; then
echo " ! Unsupported chown permissions. Value must be a non-negative integer." 1>&2
exit 1
fi
if ((CHOWN_ID > 65535 && (CHOWN_ID < 165536 || CHOWN_ID > 231071))); then
echo " ! Unsupported chown permissions. Supported values: 0-65535 (and user namespace offset variants, 165536-231071)" 1>&2
exit 1
fi
chown -R "$CHOWN_ID:$CHOWN_ID" "${DOKKU_LIB_ROOT}/data/storage/$DIRECTORY"
}