summaryrefslogtreecommitdiffstats
path: root/src/ob-unpacksource.sh
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2019-03-13 13:42:06 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2019-03-13 13:42:06 (EDT)
commit8850981d7362f95623b58d5af34343f1f8395eb6 (patch)
tree319a192daf5d5e6315ca6c72197a06ebe29f3243 /src/ob-unpacksource.sh
parent176161e071d50ee2f4873d21f8396c03a929c45d (diff)
ob-*: Add return statements after ob_error() calls
Diffstat (limited to 'src/ob-unpacksource.sh')
-rw-r--r--src/ob-unpacksource.sh38
1 files changed, 30 insertions, 8 deletions
diff --git a/src/ob-unpacksource.sh b/src/ob-unpacksource.sh
index 76bb174..e90c6c0 100644
--- a/src/ob-unpacksource.sh
+++ b/src/ob-unpacksource.sh
@@ -29,7 +29,12 @@ upstream_ar_dir=
unpack_native()
{
ob_info "$(ob_get_msg 'unpacking_native')"
- cp -Rp '../src' 'src' || ob_error "$(ob_get_msg 'cant_unpack_native')"
+ if ! cp -Rp '../src' 'src'; then
+ ob_error "$(ob_get_msg 'cant_unpack_native')"
+ return 1
+ fi
+
+ return 0
}
get_upstream_archive()
@@ -43,6 +48,7 @@ get_upstream_archive()
;;
*' '*)
ob_error "$(ob_get_msg 'multiple_upstream_sources')"
+ return 1
;;
*)
return 0
@@ -72,8 +78,11 @@ get_upstream_compression()
*)
ob_error "$(ob_get_msg 'unsupported_archive_compression')" \
"${z_ext}"
+ return 1
;;
esac
+
+ return 0
}
get_upstream_dir()
@@ -87,28 +96,39 @@ get_upstream_dir()
case "${dir_count}" in
0)
ob_error "$(ob_get_msg 'no_upstream_dirs')"
+ return 1
;;
1)
;;
*)
ob_error "$(ob_get_msg 'multiple_top_upstream_dirs')"
+ return 1
esac
+
+ return 0
}
extract_upstream()
{
ob_info "$(ob_get_msg 'unpacking_upstream')"
- tar "-x${upstream_ar_z}f" "${upstream_ar}" || \
+ if ! tar "-x${upstream_ar_z}f" "${upstream_ar}"; then
ob_error "$(ob_get_msg 'cant_unpack_upstream')"
- mv "${upstream_ar_dir}" 'src' || \
+ return 1
+ fi
+ if ! mv "${upstream_ar_dir}" 'src'; then
ob_error "$(ob_get_msg 'cant_move_native')"
+ return 1
+ fi
+
+ return 0
}
unpack_upstream()
{
- get_upstream_compression
- get_upstream_dir
- extract_upstream
+ get_upstream_compression || return 1
+ get_upstream_dir || return 1
+ extract_upstream || return 1
+ return 0
}
main()
@@ -122,11 +142,13 @@ main()
ob_info "$(ob_get_msg 'already_unpacked')"
else
if [ -d '../src' ]; then
- unpack_native
+ unpack_native || return 1
elif get_upstream_archive; then
- unpack_upstream
+ unpack_upstream || return 1
fi
fi
+
+ return 0
}
main "${@}"