diff --git a/plugins/00_dokku-standard/backup-check b/plugins/00_dokku-standard/backup-check index b80e108f1..aae373832 100755 --- a/plugins/00_dokku-standard/backup-check +++ b/plugins/00_dokku-standard/backup-check @@ -16,4 +16,3 @@ for app in $APPS; do done exit $ret - diff --git a/plugins/00_dokku-standard/backup-import b/plugins/00_dokku-standard/backup-import index 23af3913b..eca5228b3 100755 --- a/plugins/00_dokku-standard/backup-import +++ b/plugins/00_dokku-standard/backup-import @@ -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 diff --git a/plugins/00_dokku-standard/commands b/plugins/00_dokku-standard/commands index 325beb1dc..8e4c36cb9 100755 --- a/plugins/00_dokku-standard/commands +++ b/plugins/00_dokku-standard/commands @@ -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 - diff --git a/plugins/00_dokku-standard/install b/plugins/00_dokku-standard/install index bc804f546..9625e8fdc 100755 --- a/plugins/00_dokku-standard/install +++ b/plugins/00_dokku-standard/install @@ -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 diff --git a/plugins/apps/commands b/plugins/apps/commands index c98546ab5..770f772f4 100755 --- a/plugins/apps/commands +++ b/plugins/apps/commands @@ -68,4 +68,3 @@ EOF ;; esac - diff --git a/plugins/backup/commands b/plugins/backup/commands index 0571ed867..4c41037fc 100755 --- a/plugins/backup/commands +++ b/plugins/backup/commands @@ -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 - diff --git a/plugins/checks/check-deploy b/plugins/checks/check-deploy index e69182990..00346af5b 100755 --- a/plugins/checks/check-deploy +++ b/plugins/checks/check-deploy @@ -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 ..." diff --git a/plugins/config/backup-import b/plugins/config/backup-import index 22c1d9324..7652df515 100755 --- a/plugins/config/backup-import +++ b/plugins/config/backup-import @@ -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 diff --git a/plugins/config/commands b/plugins/config/commands index 441e5fec5..724fb58c9 100755 --- a/plugins/config/commands +++ b/plugins/config/commands @@ -75,7 +75,6 @@ config_write() { } case "$1" in - config) APP="$2" @@ -186,4 +185,3 @@ EOF ;; esac - diff --git a/plugins/git/backup-import b/plugins/git/backup-import index 81c169a9d..8d40fd316 100755 --- a/plugins/git/backup-import +++ b/plugins/git/backup-import @@ -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 < /dev/null + PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive" + cat > $PRERECEIVE_HOOK < /dev/null diff --git a/plugins/git/commands b/plugins/git/commands index 224fcbede..0b90005e5 100755 --- a/plugins/git/commands +++ b/plugins/git/commands @@ -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 ${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 < /dev/null + PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive" + cat > $PRERECEIVE_HOOK <