Introduce DOKKU_ROOT and import now in git plugin

This commit is contained in:
Alexander committed 2013-11-14 23:51:35 +01:00
1 parent 682229baae
commit 2219044114
5 files changed
+27 -8

No files matched your search

+1
View File
@@ -3,6 +3,7 @@ VERSION="$1"
BASE_DIR="$2" BASE_DIR="$2"
cat; cat;
[[ -f $BASE_DIR/.sshcommand ]] && echo "$BASE_DIR/.sshcommand"
[[ -f $BASE_DIR/.ssh/authorized_keys ]] && echo "$BASE_DIR/.ssh/authorized_keys" [[ -f $BASE_DIR/.ssh/authorized_keys ]] && echo "$BASE_DIR/.ssh/authorized_keys"
[[ -f $BASE_DIR/HOSTNAME ]] && echo "$BASE_DIR/HOSTNAME" [[ -f $BASE_DIR/HOSTNAME ]] && echo "$BASE_DIR/HOSTNAME"
[[ -f $BASE_DIR/VHOST ]] && echo "$BASE_DIR/VHOST" [[ -f $BASE_DIR/VHOST ]] && echo "$BASE_DIR/VHOST"
+1
View File
@@ -3,6 +3,7 @@ VERSION="$1"
IMPORT_DIR="$2" IMPORT_DIR="$2"
TARGET_DIR="$3" TARGET_DIR="$3"
[[ -f $IMPORT_DIR/.sshcommand ]] && mv $IMPORT_DIR/.sshcommand $TARGET_DIR/.sshcommand
if [[ -f $IMPORT_DIR/.ssh/authorized_keys ]]; then if [[ -f $IMPORT_DIR/.ssh/authorized_keys ]]; then
mkdir $TARGET_DIR/.ssh mkdir $TARGET_DIR/.ssh
mv $IMPORT_DIR/.ssh/authorized_keys $TARGET_DIR/.ssh/authorized_keys mv $IMPORT_DIR/.ssh/authorized_keys $TARGET_DIR/.ssh/authorized_keys
+7 -7
View File
@@ -3,7 +3,7 @@ CURRENT_BACKUP_VERSION=1
set -e; case "$1" in set -e; case "$1" in
backup:export) backup:export)
OUTPUT_FILE="$2" OUTPUT_FILE="$2"
BACKUP_DIR=/home/git BACKUP_DIR="$DOKKU_ROOT"
BACKUP_TMP_DIR=$(mktemp -d) BACKUP_TMP_DIR=$(mktemp -d)
BACKUP_TMP_FILE="$BACKUP_TMP_DIR/backup.tar" BACKUP_TMP_FILE="$BACKUP_TMP_DIR/backup.tar"
@@ -11,7 +11,7 @@ set -e; case "$1" in
pluginhook backup-export 1 $BACKUP_DIR | tar -cf $BACKUP_TMP_FILE --files-from - pluginhook backup-export 1 $BACKUP_DIR | tar -cf $BACKUP_TMP_FILE --files-from -
pushd $BACKUP_DIR > /dev/null pushd $BACKUP_DIR > /dev/null
ls -d */ > "$BACKUP_TMP_DIR/.dokku_backup_apps" ls -d */ | grep -oE '[^/]+' > "$BACKUP_TMP_DIR/.dokku_backup_apps"
popd > /dev/null popd > /dev/null
# we want to insert the files in the root of the tar # we want to insert the files in the root of the tar
@@ -50,14 +50,14 @@ set -e; case "$1" in
exit 1 exit 1
fi fi
BACKUP_ROOT="$BACKUP_TMP_DIR/home/git" BACKUP_ROOT="$BACKUP_TMP_DIR""$DOKKU_ROOT"
TARGET_DIR="/home/git" TARGET_DIR="$DOKKU_ROOT"
# create all the app repositories # create all the app directories
while read app; do git init --bare "$TARGET_DIR/$app"; done < $BACKUP_TMP_DIR/.dokku_backup_apps > /dev/null while read app; do mkdir "$TARGET_DIR/$app"; done < $BACKUP_TMP_DIR/.dokku_backup_apps > /dev/null
# have the plugins import their stuff # have the plugins import their stuff
pluginhook backup-import $VERSION "$BACKUP_ROOT" $TARGET_DIR pluginhook backup-import $VERSION "$BACKUP_ROOT" $TARGET_DIR "$BACKUP_TMP_DIR/.dokku_backup_apps"
rm -rf $BACKUP_TMP_DIR rm -rf $BACKUP_TMP_DIR
;; ;;
+1 -1
View File
@@ -5,5 +5,5 @@ TARGET_DIR="$3"
cd $IMPORT_DIR cd $IMPORT_DIR
for file in `find . -regex ".*/ENV"`; do for file in `find . -regex ".*/ENV"`; do
cp $file $TARGET_DIR$file cp $file "$TARGET_DIR/$file"
done done
+17
View File
@@ -0,0 +1,17 @@
#!/bin/bash
VERSION="$1"
IMPORT_DIR="$2"
TARGET_DIR="$3"
APPS="$4"
while read APP; do
APP_PATH="$TARGET_DIR/$APP";
git init --bare $APP_PATH > /dev/null
PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
cat > $PRERECEIVE_HOOK <<EOF
#!/usr/bin/env bash
set -e; set -o pipefail;
cat | DOKKU_ROOT="$DOKKU_ROOT" dokku git-hook $APP
EOF
chmod +x $PRERECEIVE_HOOK
done < $APPS > /dev/null