build/release/src: handle errors in subshells

Signed-off-by: Leah Rowe <leah@libreboot.org>
fsdg20230625
Leah Rowe 2023-05-20 18:59:59 +01:00
parent 16f878e882
commit 1cdf1c7cf0
1 changed files with 21 additions and 15 deletions

View File

@ -113,41 +113,47 @@ copy_blobs()
purge_files() purge_files()
{ {
( (
cd "${srcdir}/coreboot/" cd "${srcdir}/coreboot/" || err "cd1"
for i in *; do for i in *; do
[ ! -d "${i}" ] && \ [ ! -d "${i}" ] && \
continue continue
( (
cd "${i}/" cd "${i}/" || err "cd2"
make distclean make distclean || err "make-distclean1"
) )
make clean -BC default/util/kbc1126/ make clean -BC default/util/kbc1126/ || err "make-clean1"
done done
) )
( (
cd "${srcdir}/" cd "${srcdir}/" || err "cd3"
./build clean all ./build clean all || err "build-clean1"
make clean -BC util/nvmutil make clean -BC util/nvmutil || err "make-clean2"
make clean -BC util/ich9utils make clean -BC util/ich9utils || err "make-clean3"
rm -Rf coreboot/coreboot/ rm -Rf coreboot/coreboot/ || err "rm-rf1"
rm -Rf .git .gitignore */.git* coreboot/*/.git* coreboot/*/3rdparty/*/.git* rm -Rf .git .gitignore */.git* coreboot/*/.git* \
rm -Rf coreboot/*/util/nvidia/cbootimage/.git* coreboot/*/3rdparty/*/.git* || err "rm-rf2"
rm -Rf u-boot/u-boot/ u-boot/*/.git* rm -Rf coreboot/*/util/nvidia/cbootimage/.git* || err "rm-rf3"
rm -Rf u-boot/u-boot/ u-boot/*/.git* || err "rm-rf4"
) )
} }
create_release_archive() create_release_archive()
{ {
( (
cd "${reldir}/" cd "${reldir}/" || err "cd4"
printf "%s\n" "${version}" > "${dirname}/version" printf "%s\n" "${version}" > "${dirname}/version"
printf "%s\n" "${versiondate}" > "${dirname}/versiondate" printf "%s\n" "${versiondate}" > "${dirname}/versiondate"
printf "%s\n" "${projectname}" > "${dirname}/projectname" printf "%s\n" "${projectname}" > "${dirname}/projectname"
tar -c "${dirname}/" | xz -9e >"${dirname}.tar.xz" tar -c "${dirname}/" | xz -9e >"${dirname}.tar.xz" || err "tar"
rm -Rf "${dirname}/" rm -Rf "${dirname}/" || err "rm-rf5"
) )
} }
err()
{
printf "%s: %s\n" $0 $1
}
main $@ main $@