- Improved error handling.

- Changed "foo; if [ $? -eg 0 ]; then" to "if foo; then" in three places.
This commit is contained in:
rillig 2005-11-08 22:12:42 +00:00
parent f651bf444c
commit 0be3c5b4d8

View file

@ -1,5 +1,5 @@
#!/bin/sh
# $NetBSD: build,v 1.71 2005/11/08 21:57:59 rillig Exp $
# $NetBSD: build,v 1.72 2005/11/08 22:12:42 rillig Exp $
#
# Copyright (c) 1999, 2000 Hubert Feyrer <hubertf@NetBSD.org>
@ -360,13 +360,14 @@ echo "Starting actual build using the order specified in $ORDERFILE..."
# can make a progress-meter very simple to add!
# make sure we have something to grep in in the build loop
touch "${BUILDLOG}"
touch "${BUILDLOG}" || die "Cannot write to ${pkgsrc_dir}/${BUILDLOG}."
tot=`wc -l $ORDERFILE | ${AWK} '{print $1}'`
for pkgdir in `cat $ORDERFILE`
do
${GREP} -q "^${pkgdir}\$" $BUILDLOG
if [ $? -ne 0 ]; then
if ${GREP} -q "^${pkgdir}\$" "${BUILDLOG}"; then
: "skip this package"
else
built=`wc -l $BUILDLOG | ${AWK} '{print $1}'`
percent=`echo $built $tot | ${AWK} '{printf("%4.1f%%",$1*100/$2);}'`
( cd "${pkgsrc_dir}/${pkgdir}" \
@ -380,8 +381,7 @@ done
echo "Build finished. Removing all installed packages left over from build..."
for pkgname in `${PKG_TOOLS_BIN}/pkg_info -e \*`
do
${PKG_TOOLS_BIN}/pkg_info -qe $pkgname
if [ $? -eq 0 ]; then
if ${PKG_TOOLS_BIN}/pkg_info -qe $pkgname; then
pkgdir=`${AWK} "/ $pkgname /"'{print $1}{}' $INDEXFILE`
case "${BULK_PREREQ}" in
*$pkgdir* )
@ -390,8 +390,7 @@ do
* )
echo ${PKG_TOOLS_BIN}/pkg_delete -r $pkgname
${PKG_TOOLS_BIN}/pkg_delete -r $pkgname
${PKG_TOOLS_BIN}/pkg_info -qe $pkgname
if [ $? -eq 0 ]; then
if ${PKG_TOOLS_BIN}/pkg_info -qe $pkgname; then
echo "$pkgname ($pkgdir) did not deinstall nicely. Forcing the deinstall"
${PKG_TOOLS_BIN}/pkg_delete -f $pkgname || true
fi