diff options
author | P. J. McDermott <pjm@nac.net> | 2012-02-16 11:25:00 (EST) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2012-02-16 11:25:00 (EST) |
commit | 6c3b5042da7341afc94b03098b508f36653eedce (patch) | |
tree | ea5ba6bc0901e411b0cb4c69e0d324ec96822a11 /src | |
parent | 30ccdcc3eaa22288bc954e53d808e24fec2f4440 (diff) |
Fix archive extraction error handling.
opkbuild should clean up the work area on any error.
Diffstat (limited to 'src')
-rw-r--r-- | src/opkbuild | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/opkbuild b/src/opkbuild index c4f834f..2c0d3f0 100644 --- a/src/opkbuild +++ b/src/opkbuild @@ -30,9 +30,9 @@ print_usage() error() { - printf 'opkbuild: [%s] Error\n' "${1}" >&2 + [ ${#} -eq 1 ] && printf 'opkbuild: [%s] Error\n' "${1}" >&2 if ${dbg}; then - printf 'opkbuild: Starting debugging shell...' >&2 + printf 'opkbuild: Starting debugging shell...\n' >&2 /bin/sh fi cd .. @@ -193,37 +193,37 @@ for binpkgdir in ../*.pkg/; do case ${?} in 1) printf 'opkbuild: Error: No source archive found\n' >&2 - exit 1 + error ;; 2) printf 'opkbuild: Error: Multiple source archives found\n' \ >&2 - exit 1 + error ;; 3) printf 'opkbuild: Error: %s\n' \ 'Unsupported archive compression format detected' >&2 - exit 1 + error ;; 4) printf 'opkbuild: Error: %s\n' \ 'No directories found in source archive' >&2 - exit 1 + error ;; 5) printf 'opkbuild: Error: %s\n' \ 'Multiple top-level directories found in source archive' >&2 - exit 1 + error ;; 6) printf 'opkbuild: Error: %s\n' \ 'Failed to extract source archive' >&2 - exit 1 + error ;; 7) printf 'opkbuild: Error: %s\n' \ 'Failed to move extracted sources' >&2 - exit 1 + error ;; esac fi |