bootstrap.sh: always download the latest version of files
This commit is contained in:
+7
-4
@@ -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
|
||||
backup_file "${f}"
|
||||
curl -o "$f" "${GIT_REPO_ETC_SUDOERS_D_HPF}"
|
||||
chown root:root "$f"
|
||||
chmod u=rw,g=r,o= "$f"
|
||||
fi
|
||||
|
||||
# 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
|
||||
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}\""
|
||||
fi
|
||||
|
||||
# Run ansible-pull to finish up
|
||||
as_hpf_ans "bin/ansible-pull.sh"
|
||||
|
||||
Reference in New Issue
Block a user