mirror of
https://github.com/dokku/dokku.git
synced 2026-09-02 12:10:09 +02:00
`storage:create` and `storage:set` accept a `--mode` flag that sets the octal permissions of a docker-local host directory, and `storage:destroy` accepts a `--destroy-host-dir` flag that removes the directory along with its contents. A docker-local entry also honors `--reclaim-policy Delete` at destroy time now, matching how that policy governs a k3s PersistentVolume. Both are limited to the default `/var/lib/dokku/data/storage/<name>` location, the same restriction `--chown` already carries. `storage:set` applies `--chown` and `--mode` to the directory rather than only recording them.
28 lines
671 B
Bash
Executable File
28 lines
671 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eo pipefail
|
|
[[ $DOKKU_TRACE ]] && set -x
|
|
|
|
main() {
|
|
declare desc="chmods a storage directory"
|
|
declare DIRECTORY="$1" MODE="$2"
|
|
|
|
if [[ -z "$DIRECTORY" ]]; then
|
|
echo " ! Please specify a directory to chmod" 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! "$DIRECTORY" =~ ^[A-Za-z0-9\\_-]+$ ]]; then
|
|
echo " ! Directory can only contain the following set of characters: [A-Za-z0-9_-]" 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! "$MODE" =~ ^[0-7]{3,4}$ ]]; then
|
|
echo " ! Unsupported directory mode. Value must be a 3 or 4 digit octal mode, such as 0755" 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
chmod "$MODE" "${DOKKU_LIB_ROOT}/data/storage/$DIRECTORY"
|
|
}
|
|
|
|
main "$@"
|