diff options
author | Justin Davis <jrcd83@gmail.com> | 2012-06-15 02:43:22 +0200 |
---|---|---|
committer | Justin Davis <jrcd83@gmail.com> | 2012-06-15 02:43:22 +0200 |
commit | 8f294e9fb0e139d54cafcdba791875ef4fea4c20 (patch) | |
tree | 565ef93a7cb521a74cb2892174ad1d2030f7360b /bin | |
parent | 3e761dc5ad3699c24c182400a76ed3d532e1e7d5 (diff) | |
download | genpkg-8f294e9fb0e139d54cafcdba791875ef4fea4c20.tar.gz genpkg-8f294e9fb0e139d54cafcdba791875ef4fea4c20.tar.xz |
Cleanup pkg/dest when package is not found.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/genpkg | 8 | ||||
-rwxr-xr-x | bin/prepkg | 17 |
2 files changed, 18 insertions, 7 deletions
@@ -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 @@ -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 + |