diff --git a/scripts/generate-certificate-files.sh b/scripts/generate-certificate-files.sh index cb7b0b7..4744588 100644 --- a/scripts/generate-certificate-files.sh +++ b/scripts/generate-certificate-files.sh @@ -1,9 +1,9 @@ -#/usr/bin/env bash +#!/usr/bin/env bash set -o errexit set -o nounset set -o pipefail -cat << EOF > openssl.cnf +cat <openssl.cnf [req] req_extensions = v3_req distinguished_name = req_distinguished_name @@ -35,4 +35,4 @@ openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out s openssl verify -CAfile ca.crt server.crt # Clean Up -rm openssl.cnf server.csr \ No newline at end of file +rm openssl.cnf server.csr diff --git a/scripts/generate-server-certificate.sh b/scripts/generate-server-certificate.sh index c32b3f7..beeaeee 100644 --- a/scripts/generate-server-certificate.sh +++ b/scripts/generate-server-certificate.sh @@ -1,4 +1,4 @@ -#/usr/bin/env bash +#!/usr/bin/env bash set -o errexit set -o nounset set -o pipefail @@ -30,44 +30,44 @@ root="$(git rev-parse --show-toplevel)" while [[ $# -gt 0 ]]; do case $1 in - -h|--help) - print_help_and_exit - ;; - -H|--host) - shift # past argument - host=$1 - shift # past value - ;; - -p|--password-path) - shift # past argument - password_path=$1 - shift # past value - ;; - -r|--root) - shift # past argument - root=$1 - shift # past value - ;; - -*) - echo "Unknown option $1" - print_help_and_exit - ;; - *) - domain_names+=("$1") # save domain name - shift # past argument - ;; + -h | --help) + print_help_and_exit + ;; + -H | --host) + shift # past argument + host=$1 + shift # past value + ;; + -p | --password-path) + shift # past argument + password_path=$1 + shift # past value + ;; + -r | --root) + shift # past argument + root=$1 + shift # past value + ;; + -*) + echo "Unknown option $1" + print_help_and_exit + ;; + *) + domain_names+=("$1") # save domain name + shift # past argument + ;; esac done -if [[ -z "$host" ]]; then +if [[ -z $host ]]; then printf -- "--host required\n" print_help_and_exit -elif [[ -z "$password_path" ]]; then +elif [[ -z $password_path ]]; then printf -- "--password_path required\n" print_help_and_exit fi -if [[ "${#domain_names[@]}" -eq 0 ]]; then +if [[ ${#domain_names[@]} -eq 0 ]]; then print_help_and_exit fi @@ -75,7 +75,7 @@ first_safe=$(mk_safe "${domain_names[0]}") pushd "$(mktemp -d)" -cat << EOF > openssl.cnf +cat <openssl.cnf [req] req_extensions = v3_req distinguished_name = req_distinguished_name @@ -91,12 +91,12 @@ subjectAltName = @alt_names EOF for key in "${!domain_names[@]}"; do - echo "DNS.$((key+1)) = ${domain_names[$key]}" >> openssl.cnf + echo "DNS.$((key + 1)) = ${domain_names[$key]}" >>openssl.cnf done # Get ca.key and ca.crt from pass -pass "$password_path/ca.key" > ca.key -pass "$password_path/ca.crt" > ca.crt +pass "$password_path/ca.key" >ca.key +pass "$password_path/ca.crt" >ca.crt # Generate private key for certificate openssl ecparam -name prime256v1 -genkey -out server.key diff --git a/scripts/rebuild.sh b/scripts/rebuild.sh index 5bac2a1..ace981d 100644 --- a/scripts/rebuild.sh +++ b/scripts/rebuild.sh @@ -23,26 +23,26 @@ BUILD_HOST= while [[ $# -gt 0 ]]; do case $1 in - -h|--help) - print_help_and_exit - ;; - -x|--external) - EXTERNAL=yes - shift # past argument - ;; - -b|--build) - shift # past argument - BUILD_HOST=$1 - shift # past value - ;; - -*) - echo "Unknown option $1" - print_help_and_exit - ;; - *) - POSITIONAL_ARGS+=("$1") # save positional arg - shift # past argument - ;; + -h | --help) + print_help_and_exit + ;; + -x | --external) + EXTERNAL=yes + shift # past argument + ;; + -b | --build) + shift # past argument + BUILD_HOST=$1 + shift # past value + ;; + -*) + echo "Unknown option $1" + print_help_and_exit + ;; + *) + POSITIONAL_ARGS+=("$1") # save positional arg + shift # past argument + ;; esac done @@ -54,12 +54,12 @@ fi TARGET_HOST=${POSITIONAL_ARGS[1]:-} case "$ACTION" in - "switch" | "boot" | "test") - SUDO=sudo - ;; - *) - SUDO= - ;; +"switch" | "boot" | "test") + SUDO=sudo + ;; +*) + SUDO= + ;; esac ARGS=("$ACTION")