mirror of
https://github.com/hackacad/bastille.git
synced 2025-12-20 09:10:15 +01:00
Added bootstrap checksum validation and minor fixes
This commit is contained in:
@@ -262,18 +262,32 @@ bootstrap_release() {
|
||||
echo -e "${COLOR_GREEN}Extracting FreeBSD ${RELEASE} ${_archive}.txz.${COLOR_RESET}"
|
||||
/usr/bin/tar -C "${bastille_releasesdir}/${RELEASE}" -xf "${bastille_cachedir}/${RELEASE}/${_archive}.txz"
|
||||
else
|
||||
for _archive in ${bastille_bootstrap_archives}; do
|
||||
## get the manifest for dist files checksum validation
|
||||
if [ ! -f "${bastille_cachedir}/${RELEASE}/MANIFEST" ]; then
|
||||
fetch ${UPSTREAM_URL}/MANIFEST -o ${bastille_cachedir}/${RELEASE}/MANIFEST
|
||||
fi
|
||||
|
||||
## fetch for missing dist files
|
||||
if [ ! -f "${bastille_cachedir}/${RELEASE}/${_archive}.txz" ]; then
|
||||
fetch ${UPSTREAM_URL}/${_archive}.txz -o ${bastille_cachedir}/${RELEASE}/${_archive}.txz
|
||||
fi
|
||||
|
||||
## compare checksums on the fetched dist files
|
||||
if [ -f "${bastille_cachedir}/${RELEASE}/${_archive}.txz" ]; then
|
||||
SHA256_DIST=$(grep -w "${_archive}.txz" ${bastille_cachedir}/${RELEASE}/MANIFEST | awk '{print $2}')
|
||||
SHA256_FILE=$(sha256 -q ${bastille_cachedir}/${RELEASE}/${_archive}.txz)
|
||||
if [ "${SHA256_FILE}" != "${SHA256_DIST}" ]; then
|
||||
echo -e "${COLOR_RED}Failed validation for ${_archive}.txz, please retry bootstrap!${COLOR_RESET}"
|
||||
rm ${bastille_cachedir}/${RELEASE}/${_archive}.txz
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
## extract the fetched dist files
|
||||
if [ -f "${bastille_cachedir}/${RELEASE}/${_archive}.txz" ]; then
|
||||
echo -e "${COLOR_GREEN}Extracting FreeBSD ${RELEASE} ${_archive}.txz.${COLOR_RESET}"
|
||||
/usr/bin/tar -C "${bastille_releasesdir}/${RELEASE}" -xf "${bastille_cachedir}/${RELEASE}/${_archive}.txz"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
echo
|
||||
|
||||
@@ -79,6 +79,11 @@ destroy_jail() {
|
||||
|
||||
destroy_rel() {
|
||||
bastille_rel_base="${bastille_releasesdir}/${NAME}" ## dir
|
||||
## check if this release have containers child
|
||||
if grep -qwo "${NAME}" ${bastille_jailsdir}/*/fstab 2>/dev/null; then
|
||||
echo -e "${COLOR_RED} ${NAME} base appears to have containers child.${COLOR_RESET}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "${bastille_rel_base}" ]; then
|
||||
echo -e "${COLOR_RED}Release base not found.${COLOR_RESET}"
|
||||
|
||||
@@ -47,23 +47,28 @@ if [ $# -gt 0 ]; then
|
||||
usage
|
||||
;;
|
||||
release|releases)
|
||||
REL_LIST=$(ls "${bastille_releasesdir}" | sed "s/\n//g")
|
||||
for _REL in ${REL_LIST}; do
|
||||
if [ -f "${bastille_releasesdir}/${_REL}/root/.profile" ]; then
|
||||
echo "${bastille_releasesdir}/${_REL}"
|
||||
fi
|
||||
done
|
||||
if [ -d "${bastille_releasesdir}" ]; then
|
||||
REL_LIST=$(ls "${bastille_releasesdir}" | sed "s/\n//g")
|
||||
for _REL in ${REL_LIST}; do
|
||||
if [ -f "${bastille_releasesdir}/${_REL}/root/.profile" ]; then
|
||||
#echo "${bastille_releasesdir}/${_REL}"
|
||||
echo "${_REL}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
;;
|
||||
template|templates)
|
||||
find "${bastille_templatesdir}" -type d -maxdepth 2
|
||||
;;
|
||||
jail|jails)
|
||||
JAIL_LIST=$(ls "${bastille_jailsdir}" | sed "s/\n//g")
|
||||
for _JAIL in ${JAIL_LIST}; do
|
||||
if [ -f "${bastille_jailsdir}/${_JAIL}/jail.conf" ]; then
|
||||
echo "${_JAIL}"
|
||||
fi
|
||||
done
|
||||
if [ -d "${bastille_jailsdir}" ]; then
|
||||
JAIL_LIST=$(ls "${bastille_jailsdir}" | sed "s/\n//g")
|
||||
for _JAIL in ${JAIL_LIST}; do
|
||||
if [ -f "${bastille_jailsdir}/${_JAIL}/jail.conf" ]; then
|
||||
echo "${_JAIL}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
;;
|
||||
log|logs)
|
||||
find "${bastille_logsdir}" -type f -maxdepth 1
|
||||
|
||||
Reference in New Issue
Block a user