mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
30 lines
981 B
Bash
Executable File
30 lines
981 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eo pipefail
|
|
[[ $DOKKU_TRACE ]] && set -x
|
|
|
|
trigger-storage-install() {
|
|
declare desc="storage install trigger"
|
|
declare trigger="install"
|
|
local storage_directory="${DOKKU_LIB_ROOT}/data/storage"
|
|
mkdir -p "${storage_directory}"
|
|
chown dokku:dokku "${storage_directory}"
|
|
|
|
STORAGE_SUDOERS_FILE="/etc/sudoers.d/dokku-storage"
|
|
|
|
case "$DOKKU_DISTRO" in
|
|
arch | debian | opensuse | raspbian | ubuntu)
|
|
echo "%dokku ALL=(ALL) NOPASSWD:$PLUGIN_AVAILABLE_PATH/storage/bin/chown-storage-dir *" >"$STORAGE_SUDOERS_FILE"
|
|
echo "Defaults env_keep += \"DOKKU_LIB_ROOT\"" >>"$STORAGE_SUDOERS_FILE"
|
|
;;
|
|
|
|
centos | fedora | rhel)
|
|
echo "%dokku ALL=(ALL) NOPASSWD:$PLUGIN_AVAILABLE_PATH/storage/bin/chown-storage-dir *" >"$STORAGE_SUDOERS_FILE"
|
|
echo "Defaults:dokku !requiretty" >>"$STORAGE_SUDOERS_FILE"
|
|
echo "Defaults env_keep += \"DOKKU_LIB_ROOT\"" >>"$STORAGE_SUDOERS_FILE"
|
|
|
|
;;
|
|
esac
|
|
}
|
|
|
|
trigger-storage-install "$@"
|