Add more error handling

This commit is contained in:
Nils Freydank 2023-10-01 18:50:24 +02:00
parent e51a145cca
commit 5238124f3b
Signed by: nfr
GPG Key ID: 0F1DEAB2D36AD112
2 changed files with 8 additions and 6 deletions

View File

@ -59,11 +59,12 @@ _mkdir "${DISTFILES}"
_mkdir "${BINPKG}"
_mkdir "${LOGDIR}"
podman pull gentoo/stage3:amd64-nomultilib-systemd
podman build "${PODMAN_BUILD_ARGS[@]}"
podman pull gentoo/stage3:amd64-nomultilib-systemd || exit_err "Could not fetch the image."
podman build "${PODMAN_BUILD_ARGS[@]}" || exit_err "Build failed."
# Update the tag 'latest'.
podman tag rm "${REGISTRY}:latest"
podman tag "${REGISTRY}:${VERSION}" "${REGISTRY}:latest"
podman tag rm "${REGISTRY}:latest" # Do not exit_err here. At least on first run
# there is no latest tag to delete.
podman tag "${REGISTRY}:${VERSION}" "${REGISTRY}:latest" || exit_err "Could not tag new image as 'latest'."
# vim:fileencoding=utf-8:ts=4:syntax=bash:expandtab

View File

@ -58,8 +58,9 @@ _mkdir "${LOGDIR}"
podman run "${PODMAN_BUILD_ARGS[@]}" "${REGISTRY}:${VERSION}" \
bash -c "emerge --usepkg --newuse --keep-going --oneshot --deep --update @world \
&& emerge @golang-rebuild @rust-rebuild \
&& eclean-pkg --deep"
&& eclean-pkg --deep" \
|| exit_err "Could not build packages."
podman unshare chown -R "0:0" "${LOGDIR}"
podman unshare chown -R "0:0" "${LOGDIR}" || exit_err "Could not fix access right post build."
# vim:fileencoding=utf-8:ts=4:syntax=bash:expandtab