Use 2 spaces for formatting bash
Also remove extra trailing newlines
This commit is contained in:
@@ -16,4 +16,3 @@ for app in $APPS; do
|
||||
done
|
||||
|
||||
exit $ret
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ TARGET_DIR="$3"
|
||||
|
||||
[[ -f $IMPORT_DIR/.sshcommand ]] && mv $IMPORT_DIR/.sshcommand $TARGET_DIR/.sshcommand
|
||||
if [[ -f $IMPORT_DIR/.ssh/authorized_keys ]]; then
|
||||
mkdir -p $TARGET_DIR/.ssh
|
||||
cat $IMPORT_DIR/.ssh/authorized_keys $TARGET_DIR/.ssh/authorized_keys | uniq > $TARGET_DIR/.ssh/authorized_keys
|
||||
chmod 0700 $TARGET_DIR/.ssh
|
||||
chmod 0600 $TARGET_DIR/.ssh/*
|
||||
mkdir -p $TARGET_DIR/.ssh
|
||||
cat $IMPORT_DIR/.ssh/authorized_keys $TARGET_DIR/.ssh/authorized_keys | uniq > $TARGET_DIR/.ssh/authorized_keys
|
||||
chmod 0700 $TARGET_DIR/.ssh
|
||||
chmod 0600 $TARGET_DIR/.ssh/*
|
||||
fi
|
||||
[[ -f $IMPORT_DIR/HOSTNAME ]] && mv $IMPORT_DIR/HOSTNAME $TARGET_DIR/HOSTNAME
|
||||
[[ -f $IMPORT_DIR/VHOST ]] && mv $IMPORT_DIR/VHOST $TARGET_DIR/VHOST
|
||||
|
||||
@@ -31,13 +31,13 @@ case "$1" in
|
||||
|
||||
run)
|
||||
if [[ -z $2 ]]; then
|
||||
echo "Please specify an app to run the command on"
|
||||
exit 1
|
||||
echo "Please specify an app to run the command on"
|
||||
exit 1
|
||||
fi
|
||||
APP="$2"; IMAGE="dokku/$APP"
|
||||
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
|
||||
echo "App $APP does not exist"
|
||||
exit 1
|
||||
echo "App $APP does not exist"
|
||||
exit 1
|
||||
fi
|
||||
shift 2
|
||||
|
||||
@@ -48,8 +48,8 @@ case "$1" in
|
||||
url)
|
||||
APP="$2";
|
||||
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
|
||||
echo "App $APP does not exist"
|
||||
exit 1
|
||||
echo "App $APP does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -f "$DOKKU_ROOT/$APP/URL" ]]; then
|
||||
@@ -74,4 +74,3 @@ EOF
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
if [[ ! -f "$DOKKU_ROOT/HOSTNAME" ]]; then
|
||||
echo $(hostname -f) > $DOKKU_ROOT/HOSTNAME
|
||||
echo $(hostname -f) > $DOKKU_ROOT/HOSTNAME
|
||||
fi
|
||||
|
||||
# temporary hack for https://github.com/progrium/dokku/issues/82
|
||||
|
||||
@@ -68,4 +68,3 @@ EOF
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
CURRENT_BACKUP_VERSION=1
|
||||
set -e; case "$1" in
|
||||
|
||||
case "$1" in
|
||||
backup:export)
|
||||
OUTPUT_FILE="$2"
|
||||
BACKUP_DIR="$DOKKU_ROOT"
|
||||
@@ -25,9 +26,9 @@ set -e; case "$1" in
|
||||
|
||||
# if no file specified, output to stdout
|
||||
if [[ -z $OUTPUT_FILE ]]; then
|
||||
cat $BACKUP_TMP_FILE
|
||||
cat $BACKUP_TMP_FILE
|
||||
else
|
||||
mv $BACKUP_TMP_FILE $OUTPUT_FILE
|
||||
mv $BACKUP_TMP_FILE $OUTPUT_FILE
|
||||
fi
|
||||
|
||||
rm -rf $BACKUP_TMP_DIR
|
||||
@@ -49,14 +50,14 @@ set -e; case "$1" in
|
||||
tar xf $INPUT_FILE --directory=$BACKUP_TMP_DIR
|
||||
|
||||
if [[ ! -f $BACKUP_TMP_DIR/.dokku_backup_version ]]; then
|
||||
echo "Unable to determine backup version"
|
||||
exit 1
|
||||
echo "Unable to determine backup version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=$(< $BACKUP_TMP_DIR/.dokku_backup_version)
|
||||
if [[ $VERSION -ne 1 ]]; then
|
||||
echo "Unknown format version $VERSION"
|
||||
exit 1
|
||||
echo "Unknown format version $VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Importing a version $VERSION backup..."
|
||||
@@ -92,4 +93,3 @@ EOF
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
|
||||
@@ -28,23 +28,23 @@ WAIT="${DOKKU_CHECKS_WAIT:-5}"
|
||||
# after successfully copying the file. Thus, we suppress stderr.
|
||||
# ref: https://github.com/dotcloud/docker/issues/3986
|
||||
if [[ ! -f "$FILENAME" ]] ; then
|
||||
echo " check-deploy: $FILENAME not found. attempting to retrieve it from container ..."
|
||||
TMPDIR=$(mktemp -d /tmp/CHECKS.XXXXX)
|
||||
docker cp $CONTAINERID:/app/CHECKS $TMPDIR 2> /dev/null || true
|
||||
if [[ ! -s "${TMPDIR}/CHECKS" ]] ; then
|
||||
echo " CHECKS file not found in container. skipping checks."
|
||||
rm -rf $TMPDIR
|
||||
exit 0
|
||||
else
|
||||
echo " CHECKS file found in container"
|
||||
FILENAME=${TMPDIR}/CHECKS
|
||||
echo " check-deploy: $FILENAME not found. attempting to retrieve it from container ..."
|
||||
TMPDIR=$(mktemp -d /tmp/CHECKS.XXXXX)
|
||||
docker cp $CONTAINERID:/app/CHECKS $TMPDIR 2> /dev/null || true
|
||||
if [[ ! -s "${TMPDIR}/CHECKS" ]] ; then
|
||||
echo " CHECKS file not found in container. skipping checks."
|
||||
rm -rf $TMPDIR
|
||||
exit 0
|
||||
else
|
||||
echo " CHECKS file found in container"
|
||||
FILENAME=${TMPDIR}/CHECKS
|
||||
|
||||
function cleanup() {
|
||||
echo " removing CHECKS file copied from container"
|
||||
rm -rf $TMPDIR
|
||||
}
|
||||
trap cleanup EXIT
|
||||
fi
|
||||
function cleanup() {
|
||||
echo " removing CHECKS file copied from container"
|
||||
rm -rf $TMPDIR
|
||||
}
|
||||
trap cleanup EXIT
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Waiting $WAIT seconds ..."
|
||||
|
||||
@@ -8,5 +8,5 @@ TARGET_DIR="$3"
|
||||
|
||||
cd $IMPORT_DIR
|
||||
for file in */ENV; do
|
||||
cp $file "$TARGET_DIR/$file"
|
||||
cp $file "$TARGET_DIR/$file"
|
||||
done
|
||||
|
||||
@@ -75,7 +75,6 @@ config_write() {
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
||||
config)
|
||||
APP="$2"
|
||||
|
||||
@@ -186,4 +185,3 @@ EOF
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
|
||||
@@ -6,15 +6,15 @@ 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
|
||||
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
|
||||
chmod +x $PRERECEIVE_HOOK
|
||||
done < $APPS > /dev/null
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
git_archive_all() {
|
||||
APP=$1; REV=$2
|
||||
TMP_WORK_DIR=$(mktemp -d)
|
||||
chmod 755 $TMP_WORK_DIR
|
||||
unset GIT_DIR GIT_WORK_TREE
|
||||
git clone $DOKKU_ROOT/$APP $TMP_WORK_DIR &> /dev/null
|
||||
pushd $TMP_WORK_DIR > /dev/null
|
||||
git config advice.detachedHead false
|
||||
git checkout $REV &> /dev/null
|
||||
git submodule update --init --recursive &> /dev/null
|
||||
find -name .git -prune -exec rm -rf {} \; > /dev/null
|
||||
tar c .
|
||||
popd > /dev/null
|
||||
rm -rf $TMP_WORK_DIR > /dev/null
|
||||
APP=$1; REV=$2
|
||||
TMP_WORK_DIR=$(mktemp -d)
|
||||
chmod 755 $TMP_WORK_DIR
|
||||
unset GIT_DIR GIT_WORK_TREE
|
||||
git clone $DOKKU_ROOT/$APP $TMP_WORK_DIR &> /dev/null
|
||||
pushd $TMP_WORK_DIR > /dev/null
|
||||
git config advice.detachedHead false
|
||||
git checkout $REV &> /dev/null
|
||||
git submodule update --init --recursive &> /dev/null
|
||||
find -name .git -prune -exec rm -rf {} \; > /dev/null
|
||||
tar c .
|
||||
popd > /dev/null
|
||||
rm -rf $TMP_WORK_DIR > /dev/null
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
@@ -31,7 +31,6 @@ case "$1" in
|
||||
echo $'\e[1G\e[K'"-----> WARNING: deploy did not complete, you must push to master."
|
||||
echo $'\e[1G\e[K'"-----> for example, try 'git push <dokku> ${refname/refs\/heads\/}:master'"
|
||||
fi
|
||||
|
||||
done
|
||||
;;
|
||||
|
||||
@@ -40,15 +39,15 @@ case "$1" in
|
||||
APP_PATH=$DOKKU_ROOT/$APP
|
||||
|
||||
if [[ $1 == "git-receive-pack" && ! -d "$APP_PATH/refs" ]]; then
|
||||
git init --bare $APP_PATH > /dev/null
|
||||
PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
|
||||
cat > $PRERECEIVE_HOOK <<EOF
|
||||
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
|
||||
chmod +x $PRERECEIVE_HOOK
|
||||
fi
|
||||
|
||||
args=$@
|
||||
@@ -58,5 +57,5 @@ EOF
|
||||
help)
|
||||
cat
|
||||
;;
|
||||
esac
|
||||
|
||||
esac
|
||||
|
||||
@@ -9,6 +9,6 @@ TARGET_DIR="$3"
|
||||
cd $IMPORT_DIR
|
||||
|
||||
for file in */tls/server.*; do
|
||||
mkdir -p $(dirname $TARGET_DIR$file)
|
||||
cp $file $TARGET_DIR$file
|
||||
mkdir -p $(dirname $TARGET_DIR$file)
|
||||
cp $file $TARGET_DIR$file
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user