fix shellcheck

This commit is contained in:
tschettervictor
2025-04-21 16:58:32 -06:00
committed by GitHub
parent 7f1a372baf
commit 78764e581c

View File

@@ -405,30 +405,35 @@ bootstrap_template() {
_url=${BASTILLE_TEMPLATE_URL} _url=${BASTILLE_TEMPLATE_URL}
_user=${BASTILLE_TEMPLATE_USER} _user=${BASTILLE_TEMPLATE_USER}
_repo=${BASTILLE_TEMPLATE_REPO%.*} # Remove the trailing ".git" _repo=${BASTILLE_TEMPLATE_REPO%.*} # Remove the trailing ".git"
_template=${bastille_templatesdir}/${_user}/${_repo} _raw_template_dir=${bastille_templatesdir}/${_user}/${_repo}
## support for non-git ## support for non-git
if ! which -s git; then if ! which -s git; then
error_notify "Git not found." error_notify "Git not found."
error_exit "Not yet implemented." error_exit "Not yet implemented."
else else
if [ ! -d "${_template}/.git" ]; then if [ ! -d "${_raw_template_dir}/.git" ]; then
git clone "${_url}" "${_template}" ||\ git clone "${_url}" "${_raw_template_dir}" ||\
error_notify "Clone unsuccessful." error_notify "Clone unsuccessful."
elif [ -d "${_template}/.git" ]; then elif [ -d "${_raw_template_dir}/.git" ]; then
git -C "${_template}" pull ||\ git -C "${_raw_template_dir}" pull ||\
error_notify "Template update unsuccessful." error_notify "Template update unsuccessful."
fi fi
fi fi
# Extract template in project/template format # Extract template in project/template format
find "${_template}" -type f -name Bastillefile | while read -r _file; do find "${_raw_template_dir}" -type f -name Bastillefile | while read -r _file; do
_project="$(dirname "$(dirname ${_file})")" _project="$(dirname "$(dirname ${_file})")"
_basename="$(basename ${_project})" _template="$(basename ${_project})"
_complete_template=""$(basename ${_project})"/"$(basename "$(dirname ${_file})")"" _complete_template="$(basename ${_project})"/"$(basename "$(dirname ${_file})")"
cp -fR "${_project}" "${bastille_templatesdir}/${_basename}" cp -fR "${_project}" "${bastille_templatesdir}/${_template}"
bastille verify "${_complete_template}" bastille verify "${_complete_template}"
done done
# Remove the cloned repo
if [ -n "${_raw_template_dir}" ]; then
rm -r "${_raw_template_dir}"
fi
} }
# Handle options. # Handle options.