#!/bin/sh set -eu usage() { cat <<-'EOF' Usage: deploy deploy -h EOF } help() { cat <<-'EOF' Options: -h, --help show this message Do a blue/green deployment of the main service. It makes sure that the new service is up and running before shutting down the old one. Examples: Just do the deploy: $ deploy EOF } for flag in "$@"; do case "$flag" in --) break ;; --help) usage help exit ;; *) ;; esac done while getopts 'h' flag; do case "$flag" in h) usage help exit ;; *) usage >&2 exit 2 ;; esac done shift $((OPTIND - 1)) if [ "$(id -un)" != 'root' ]; then printf 'This script must be run as root.\n\n' >&2 usage >&2 exit 2 fi echo FIXME