#!/usr/bin/env bash # shellcheck disable=all # This is a handlerbars template, so ignore issues set -euo pipefail checksum_file=".dotter/cache/pre_deploy.checksum" if [[ -e "$checksum_file" ]] && sha256sum --check "$checksum_file" >/dev/null 2>&1; then echo "Pre deploy script has not changed, skiping script execution" echo "To override this, remove the checksum file: $checksum_file" exit 0 fi {{!~ Detect the distribution ~}} {{~ assign "distro" (trim (command_output "awk -F= '/^ID=/ {print $2}' /etc/os-release | tr -d '\"'")) ~}} {{ header "Running pre deploy script for distro" (to_title_case distro) }} {{ #if (is_executable "sudo") }} {{ header "Configuring sudo" }} SUDOERS_FILE="/etc/sudoers.d/01-user" if [[ -e "${SUDOERS_FILE}" ]]; then echo "Sudo configuration already exists, to override it remove the file: ${SUDOERS_FILE}" exit 0 else sudo -B tee "${SUDOERS_FILE}" <