summaryrefslogtreecommitdiffstats
path: root/src/ob-unpacksource.sh
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2018-12-25 16:11:38 (EST)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2018-12-25 16:11:38 (EST)
commit888b97fbda8aa867816770fb495dad105411a3eb (patch)
tree4539b5a79f562838355a80b44173050e4063153a /src/ob-unpacksource.sh
parent0f5c59fee40bfcbcb85da69c7633366e304c77bc (diff)
ob-*: Move function definitions before points of use
Diffstat (limited to 'src/ob-unpacksource.sh')
-rw-r--r--src/ob-unpacksource.sh50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/ob-unpacksource.sh b/src/ob-unpacksource.sh
index 478fa17..26bb537 100644
--- a/src/ob-unpacksource.sh
+++ b/src/ob-unpacksource.sh
@@ -24,37 +24,12 @@ upstream_ar=
upstream_ar_z=
upstream_ar_dir=
-main()
-{
- ob_set_text_domain 'opkbuild'
-
- ob_init_package '..' || exit 1
- ob_parse_package_metadata -c '.opkbuild.cache' || exit 1
-
- if [ -d 'src' ]; then
- ob_info "$(ob_get_msg 'already_unpacked')"
- else
- if [ -d '../src' ]; then
- unpack_native
- elif get_upstream_archive; then
- unpack_upstream
- fi
- fi
-}
-
unpack_native()
{
ob_info "$(ob_get_msg 'unpacking_native')"
cp -Rp '../src' 'src' || ob_error "$(ob_get_msg 'cant_unpack_native')"
}
-unpack_upstream()
-{
- get_upstream_compression
- get_upstream_dir
- extract_upstream
-}
-
get_upstream_archive()
{
upstream_ar_base="${OPK_SOURCE}-${OPK_SOURCE_VERSION_UPSTREAM}.orig.tar"
@@ -123,4 +98,29 @@ extract_upstream()
ob_error "$(ob_get_msg 'cant_move_native')"
}
+unpack_upstream()
+{
+ get_upstream_compression
+ get_upstream_dir
+ extract_upstream
+}
+
+main()
+{
+ ob_set_text_domain 'opkbuild'
+
+ ob_init_package '..' || exit 1
+ ob_parse_package_metadata -c '.opkbuild.cache' || exit 1
+
+ if [ -d 'src' ]; then
+ ob_info "$(ob_get_msg 'already_unpacked')"
+ else
+ if [ -d '../src' ]; then
+ unpack_native
+ elif get_upstream_archive; then
+ unpack_upstream
+ fi
+ fi
+}
+
main "${@}"