From 9736ee4bceb46384309b7b5754a6de5dbb2b230a Mon Sep 17 00:00:00 2001 From: Hyperling Date: Sun, 19 Feb 2023 10:33:25 -0600 Subject: [PATCH] Fixes (#37) * Don't create doas config if failed to install. * Fix it better, previous change made it so that a value was required, could not just run setup.sh.. --- setup.sh | 11 ++++++----- tasks/general/acct_mgmt/doas.yml | 7 ++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/setup.sh b/setup.sh index 7f6c8fb..4dc45af 100755 --- a/setup.sh +++ b/setup.sh @@ -52,16 +52,17 @@ while getopts ":lb:h" arg; do esac done +# Alert on historic usage of `setup.sh BRANCH`. +if [[ ! -z $1 && $1 != "-"* ]]; then + echo "ERROR: '$1' is not a valid option, please check your parameters and try again." + usage 1 +fi + if [[ $branch == "" ]]; then echo "Using default branch $BRANCH." branch="$BRANCH" fi -if [[ $1 != "-"* ]]; then - echo "ERROR: '$1' is not a valid option, please check your parameters and try again." - usage 1 -fi - ## Main ## os="$(cat /etc/os-release)" diff --git a/tasks/general/acct_mgmt/doas.yml b/tasks/general/acct_mgmt/doas.yml index a971895..f703b31 100644 --- a/tasks/general/acct_mgmt/doas.yml +++ b/tasks/general/acct_mgmt/doas.yml @@ -14,6 +14,7 @@ package: name: - doas + register: doas_install ignore_errors: yes - name: General | Software | DoAs | Configure [Linux] @@ -25,7 +26,7 @@ state: present create: yes backup: yes - when: ansible_system in ("Linux") + when: not doas_install.failed and ansible_system in ("Linux") - name: General | Software | DoAs | Configure [BSD] blockinfile: @@ -36,7 +37,7 @@ state: present create: yes backup: yes - when: ansible_system in ("FreeBSD") + when: not doas_install.failed and ansible_system in ("FreeBSD") - name: General | Software | DoAs | Configure [Other] blockinfile: @@ -50,4 +51,4 @@ loop: - "{{ doas_conf_file_linux }}" - "{{ doas_conf_file_bsd }}" - when: ansible_system not in ("Linux", "FreeBSD") + when: not doas_install.failed and ansible_system not in ("Linux", "FreeBSD")