diff --git a/bootstrap.sh b/bootstrap.sh index 62f07f9..c6d5af9 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -29,7 +29,7 @@ GIT_REPO_BRANCH="${1:-"development"}" GIT_REPO_FILES="${GIT_REPO_BASE}/raw/branch/${GIT_REPO_BRANCH}/files" -GIT_REPO_sudoers_d_hpf="${GIT_REPO_FILES}/sudoers_d_hpf" +GIT_REPO_sudoers_d_hpf="${GIT_REPO_FILES}/etc/sudoers.d/hpf" GIT_REPO_SKEL_ansible_venv_sh="${GIT_REPO_FILES}/etc/skel/.profile.d/ansible-venv.sh" GIT_REPO_SKEL_profile="${GIT_REPO_FILES}/files/etc/skel/.profile" GIT_REPO_ansible_pull_sh="${GIT_REPO_FILES}/ansible_pull_sh" @@ -104,7 +104,11 @@ get_file() { dest_file_permissions="${4}" if [ -e "${dest_file}" ] ; then mv "${dest_file}" "${dest_file}.${TIMESTAMP}" ; fi - curl -o "${dest_file}" "${source_file}" + if ! curl -f -o "${dest_file}" "${source_file}" ; then + echo "ERROR - Unable to download \"${source_file}\"" >&2 + echo " to \"${dest_file}\"." >&2 + exit 4 + fi chown "${dest_file_ownership}" "${dest_file}" chmod "${dest_file_permissions}" "${dest_file}" } @@ -172,23 +176,13 @@ get_file "${GIT_REPO_SKEL_profile}" "${SKEL_profile}" "root:root" "u=rw,go=r" system_useradd hpf-ans 800 add_groups_to_user hpf-sudo-np hpf-ans -# Determine HPF_ANS variables now that the user is created +# Set HPF_ANS variables now that the user is created HPF_ANS_HOME="$(as_hpf_ans 'echo "${HOME}"')" HPF_ANS_ansible_venv="${HPF_ANS_HOME}/.ansible-venv" HPF_ANS_bin="${HPF_ANS_HOME}/bin" HPF_ANS_ansible_pull_sh="${HPF_ANS_bin}/ansible-pull.sh" - - -echo "HPF_ANS_HOME=\"${HPF_ANS_HOME}\"" -echo "HPF_ANS_ansible_venv=\"${HPF_ANS_ansible_venv}\"" -echo "HPF_ANS_bin=\"${HPF_ANS_bin}\"" -echo "HPF_ANS_ansible_pull_sh=\"${HPF_ANS_ansible_pull_sh}\"" -exit 200 - - - -# Make sure .ansible-venv exists +# Make sure /home/hpf-ans/.ansible-venv exists as_hpf_ans "if [ ! -d \"${HPF_ANS_ansible_venv}\" ] ; then virtualenv \"${HPF_ANS_ansible_venv}\" ; fi" # Make sure pip is up to date @@ -197,10 +191,10 @@ as_hpf_ans "pip install --upgrade pip" # Make sure ansible is installed as_hpf_ans "pip install --upgrade ansible" -# Make sure bin exists +# Make sure /home/hpf-ans/bin exists create_directory "${HPF_ANS_bin}" "hpf-ans:hpf-ans" "u=rwx,go=" -# Create ansible-pull.sh +# Get /home/hpf-ans/bin/ansible-pull.sh get_file "${GIT_REPO_ansible_pull_sh}" "${HPF_ANS_ansible_pull_sh}" "hpf-ans:hpf-ans" "u=rwx,go=" # Make sure log directory exists diff --git a/files/sudoers_d_hpf b/files/etc/sudoers.d/hpf similarity index 100% rename from files/sudoers_d_hpf rename to files/etc/sudoers.d/hpf