From a13b358d2eea340feb0609f7baa08bfec18a81a5561b5a5275ac58f3f82ede10 Mon Sep 17 00:00:00 2001 From: Heath Petersen Date: Sun, 5 Jul 2026 16:08:25 -0500 Subject: [PATCH] bootstrap.sh: always download the latest version of files --- bootstrap.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index afe4ac6..e7c2fcb 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -70,6 +70,11 @@ as_hpf_ans () { su --login hpf-ans -c "if [ -r \"${VENV_ACTIVATE}\" ] ; then source \"${VENV_ACTIVATE}\" ; fi ; ${1}" } +# $file_name +backup_file () { + mv "${1}" "${1}.backup-$(date "+%Y%m%d%H%M%S")" +} + # #### PROCESS @@ -102,11 +107,10 @@ add_groups_to_user "hpf-sudo-np" hpf-ans # Create /etc/sudoers.d/hpf f="/etc/sudoers.d/hpf" -if [ ! -f "$f" ] ; then - curl -o "$f" "${GIT_REPO_ETC_SUDOERS_D_HPF}" - chown root:root "$f" - chmod u=rw,g=r,o= "$f" -fi +backup_file "${f}" +curl -o "$f" "${GIT_REPO_ETC_SUDOERS_D_HPF}" +chown root:root "$f" +chmod u=rw,g=r,o= "$f" # Make sure the hpf-ans ansible venv exists as_hpf_ans "if [ ! -d \"${VENV_DIRECTORY}\" ] ; then python3 -m venv \"${VENV_DIRECTORY}\" ; fi" @@ -126,10 +130,9 @@ fi # Create ~hpf-ans/bin/ansible-pull.sh f=~hpf-ans/bin/ansible-pull.sh -if [ ! -f "${f}" ] ; then - as_hpf_ans "curl -o \"${f}\" \"${GIT_REPO_HOME_HPF_ANS_BIN_ANSIBLE_PULL_SH}\"" - as_hpf_ans "chown hpf-ans:hpf-ans \"${f}\"; chmod ug=rwx,o= \"${f}\"" -fi +backup_file "${f}" +as_hpf_ans "curl -o \"${f}\" \"${GIT_REPO_HOME_HPF_ANS_BIN_ANSIBLE_PULL_SH}\"" +as_hpf_ans "chown hpf-ans:hpf-ans \"${f}\"; chmod ug=rwx,o= \"${f}\"" # Run ansible-pull to finish up as_hpf_ans "bin/ansible-pull.sh"