Skip to content

Commit

Permalink
set -eux
Browse files Browse the repository at this point in the history
  • Loading branch information
johnko committed Apr 19, 2019
1 parent 946e4ae commit b65759c
Show file tree
Hide file tree
Showing 14 changed files with 59 additions and 63 deletions.
4 changes: 1 addition & 3 deletions bin/_ssh-keygen.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env bash
set -e
set -x
set -u
set -eux

# OUTFILE="${HOME}/.ssh/id_rsanopass"
# if [ ! -f "${OUTFILE}" ]; then
Expand Down
4 changes: 1 addition & 3 deletions bin/bitbucket.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env bash
set -e
set -x
set -u
set -eux

MY_TMP_CONTEXT="${HOME}/docker-files/bitbucket"

Expand Down
4 changes: 1 addition & 3 deletions bin/confluence.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env bash
set -e
set -x
set -u
set -eux

MY_TMP_CONTEXT="${HOME}/docker-files/confluence"

Expand Down
3 changes: 1 addition & 2 deletions bin/create-macos-media.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env bash
set -e
set -eu
set +x
set -u

##########

Expand Down
4 changes: 1 addition & 3 deletions bin/gitea.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env bash
set -e
set -x
set -u
set -eux

MY_TMP_CONTEXT="${HOME}/docker-files/gitea"

Expand Down
4 changes: 1 addition & 3 deletions bin/gitlab-ce.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env bash
set -e
set -x
set -u
set -eux

MY_TMP_CONTEXT="${HOME}/docker-files/gitlab-ce"

Expand Down
4 changes: 1 addition & 3 deletions bin/jenkins-lts.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env bash
set -e
set -x
set -u
set -eux

MY_TMP_CONTEXT="${HOME}/docker-files/jenkins-lts"

Expand Down
4 changes: 1 addition & 3 deletions bin/macos-version.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env bash
set -e
set -x
set -u
set -eux

sw_vers
softwareupdate --list
4 changes: 1 addition & 3 deletions bin/rebase-example.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env bash
set -e
set -x
set -u
set -eux

git stash
git checkout johnko
Expand Down
71 changes: 46 additions & 25 deletions bin/setup-ansible.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env bash
set -e
set -x
set -euo pipefail

if which apt-get; then
# Debian / Ubuntu
if command -v apt-get >/dev/null 2>&1 ; then
echo "=> Detected apt-get..."
export DEBIAN_FRONTEND=noninteractive
# Dependency for virtualenv
sudo apt-get install --yes build-essential python-dev libffi-dev
Expand All @@ -11,29 +12,49 @@ if which apt-get; then
sudo apt-get install --yes libssl-dev
fi

if ! which virtualenv; then
if which pip; then
pip install virtualenv
fi
fi
echo "=> Detecting pip3, pip2 or pip..."
# Last one wins
command -v pip >/dev/null 2>&1 && PIP_BIN="pip"
command -v pip2 >/dev/null 2>&1 && PIP_BIN="pip2"
command -v pip3 >/dev/null 2>&1 && PIP_BIN="pip3"
# Last one wins
command -v python >/dev/null 2>&1 && PY_BIN="python"
command -v python2 >/dev/null 2>&1 && PY_BIN="python2"
command -v python2.7 >/dev/null 2>&1 && PY_BIN="python2.7"
command -v python3 >/dev/null 2>&1 && PY_BIN="python3"
command -v python3.7 >/dev/null 2>&1 && PY_BIN="python3.7"

if ! which virtualenv; then
if which easy_install; then
sudo easy_install virtualenv
fi
echo "=> Installing virtualenv..."
if ! command -v virtualenv >/dev/null 2>&1 ; then
[ -n "${PIP_BIN}" ] && \
${PIP_BIN} install virtualenv 2>&1 | awk '{print " "$0}'
fi
if ! command -v virtualenv >/dev/null 2>&1 ; then
command -v easy_install >/dev/null 2>&1 && \
easy_install virtualenv 2>&1 | awk '{print " "$0}'
fi
if ! command -v virtualenv >/dev/null 2>&1 ; then
echo "!! Failed to install virtualenv"
exit 1
fi

# Install ansible in a virtualenv
VENV_FOLDER="venv"
virtualenv ${VENV_FOLDER}
. ${VENV_FOLDER}/bin/activate
curl https://bootstrap.pypa.io/get-pip.py | python
pip install --upgrade ansible
# Install dev tools in a virtualenv
VENV_FOLDER="venv-ansible"
virtualenv "${VENV_FOLDER}" | awk '{print " "$0}'
source "${VENV_FOLDER}/bin/activate"

echo "=> Installing latest pip..."
curl -s https://bootstrap.pypa.io/get-pip.py | ${PY_BIN} 2>&1 | awk '{print " "$0}'

echo "=> Installing python development tools..."
${PIP_BIN} install --upgrade \
yamllint \
yq \
ansible \
2>&1 | awk '{print " "$0}'
echo "=> Installion complete!"

# Instructions to user
set +x
echo "======================================"
echo "Ansible setup complete!"
echo "Now you can:"
echo " source ${VENV_FOLDER}/bin/activate"
echo " ansible-playbook ..."
echo " To activate, run:"
echo " source ${VENV_FOLDER}/bin/activate"
echo " ansible-playbook ..."
echo "=> Setup is complete!"
4 changes: 1 addition & 3 deletions bin/setup-macos.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env bash
set -e
set -x
set -u
set -eux

##########

Expand Down
4 changes: 1 addition & 3 deletions bin/setup-zfs-macos.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env bash
set -e
set -x
set -u
set -eux

create_default_zpool() {
## See https://openzfsonosx.org/wiki/Zpool#Creating_a_pool
Expand Down
4 changes: 1 addition & 3 deletions bin/timemachine-backup-now.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env bash
set -e
set -x
set -u
set -eux

# Mac OS Extended (Case-sensitive, Journaled, Encrypted)

Expand Down
4 changes: 1 addition & 3 deletions bin/ubuntu-16.04.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env bash
set -e
set -x
set -u
set -eux

MY_DOCKER_IMAGE=git-ubuntu:16.04
MY_TMP_CONTEXT="${HOME}/docker-files/ubuntu/16.04"
Expand Down

0 comments on commit b65759c

Please sign in to comment.