summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/genpkg8
-rwxr-xr-xbin/prepkg17
2 files changed, 18 insertions, 7 deletions
diff --git a/bin/genpkg b/bin/genpkg
index d9ffcc5..8cbd6ba 100755
--- a/bin/genpkg
+++ b/bin/genpkg
@@ -104,7 +104,13 @@ do
PREPSPATH="$prepd" PKGVAR="$vard" prepkg "$pkg" > PKGDATA
ret=$?
case $ret in
- 0) echo "$pkgd/$pkg" ;;
+ 0) echo "$pkgd/$pkg"
+ ;;
+ 101) # 101 from prepkg means cleanup
+ cd
+ rm -r "$pkgd/$pkg"
+ exit 1
+ ;;
*) rm PKGDATA
exit $ret
esac
diff --git a/bin/prepkg b/bin/prepkg
index 9d95a46..22356fa 100755
--- a/bin/prepkg
+++ b/bin/prepkg
@@ -4,8 +4,10 @@ prog=prepkg
err()
{
+ ret=$1
+ shift
echo "$prog: $*" 1>&2
- exit 1
+ exit $ret
}
basicmeta()
@@ -24,11 +26,11 @@ basicmeta()
case $# in
0) echo "usage: $prog [package name]" 1>&2
- exit 1
+ exit 2
esac
case "$PREPSPATH" in
-'') err "set PREPSPATH before calling $prog"
+'') err 2 "set PREPSPATH before calling $prog"
esac
for flav in "$PREPSPATH"/*
@@ -40,11 +42,14 @@ do
case "$prepret" in
100) ;; # loop
+ 101) exit 101 ;; # tell genpkg to cleanup
0) basicmeta
exit 0 ;;
- 1) err "$flav encountered an error" ;;
- *) err "$flav returned error code $prepret" ;;
+ 1) err 1 "$flav encountered an error" ;;
+ *) err 1 "$flav returned error code $prepret" ;;
esac
done
-err "no matching meta generator found for '$1'"
+echo "no matching meta generator found for '$1'" 1>&2
+exit 101
+