Files
dokku/plugins/git/post-app-clone-setup
2025-09-08 02:08:33 -04:00

23 lines
758 B
Bash
Executable File

#!/usr/bin/env bash
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
trigger-git-post-app-clone-setup() {
declare desc="modifies git-hook"
declare trigger="post-app-clone-setup"
declare OLD_APP="$1" NEW_APP="$2"
if [[ -f "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive" ]]; then
sed -i -e "s/git-hook $OLD_APP/git-hook $NEW_APP/g" "$DOKKU_ROOT/$NEW_APP/hooks/pre-receive"
fi
fn-plugin-property-clone "git" "$OLD_APP" "$NEW_APP"
pushd "$DOKKU_ROOT/$OLD_APP/." >/dev/null
find ./* \( -name ".cache" -o -name "cache" -o -name "VHOST" \) -prune -o -print | cpio -pdmu --quiet "$DOKKU_ROOT/$NEW_APP"
popd &>/dev/null || pushd "/tmp" >/dev/null
}
trigger-git-post-app-clone-setup "$@"