mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
32 lines
1.0 KiB
Bash
Executable File
32 lines
1.0 KiB
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"
|
|
local mode="0440"
|
|
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"
|
|
mode="0600"
|
|
;;
|
|
esac
|
|
|
|
chmod "$mode" "$STORAGE_SUDOERS_FILE"
|
|
}
|
|
|
|
trigger-storage-install "$@"
|