#!/bin/bash # Log commands to stdout and vicariously /var/log/cloud-init-output.log set -o xtrace # Exit on error set -o errexit # Exit on use of unset variables set -o nounset # Exit and report on pipe failure set -o pipefail # If not running as root, rerun via sudo if [[ $EUID > 0 ]]; then exec sudo "$0" "$@" fi # Let apt know not to error due to lack of Dialog export DEBIAN_FRONTEND=noninteractive # Add Mongo repo to sources tee /etc/apt/sources.list.d/mongodb-org-3.4.list <