diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-26 00:23:06 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-26 00:23:06 (EDT) |
commit | 60c649cedcbfa024f0ffe9567717b5a53982adf3 (patch) | |
tree | dd5b0ef527786f3912b4750c4fb4bcf41fd1343f /src/cmd/build.sh | |
parent | 0342fc284e3d2500dc29f2ed083141c758f67e1e (diff) |
src/cmd/build.sh: Define functions before references
Diffstat (limited to 'src/cmd/build.sh')
-rw-r--r-- | src/cmd/build.sh | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/src/cmd/build.sh b/src/cmd/build.sh index 273f76d..24aff29 100644 --- a/src/cmd/build.sh +++ b/src/cmd/build.sh @@ -22,6 +22,52 @@ cmd_build_root= cmd_build_pkg_dir= cmd_build_build_deps= +cmd_build_make_deps_pkg() +{ + local pkg_dir= + + pkg_dir="${cmd_build_root}$(session_dir)/builddeps" + mkdir -p "${pkg_dir}/control" "${pkg_dir}/data" + printf '2.0\n' >"${pkg_dir}/debian-binary" + cat >"${pkg_dir}/control/control" <<-EOF + Package: prokit-builddeps-$(session_id) + Source: prokit + Version: 1.0 + Architecture: all + Platform: all + Depends: ${cmd_build_build_deps} + Description: Build dependencies metapackage generated by prokit + EOF + (cd "${pkg_dir}/data"; tar -czf ../data.tar.gz .) + (cd "${pkg_dir}/control"; tar -czf ../control.tar.gz .) + (cd "${pkg_dir}"; tar -czf ../builddeps.opk \ + 'debian-binary' 'data.tar.gz' 'control.tar.gz') + rm -Rf "${pkg_dir}" +} + +cmd_build_fini() +{ + local session_dir= + local f= + + session_dir="$(session_dir)" + + if [ "x${cmd_build_build_deps}" != 'x' ]; then + session_exec opkg --autoremove remove \ + prokit-builddeps-$(session_id) + rm -f "${cmd_build_root}${session_dir}/builddeps.opk" + # Hack to avoid this code branch if the function is called again + # in response to a signal. + cmd_build_build_deps='' + fi + + for f in "${cmd_build_root}${session_dir}/"*; do + [ -e "${f}" ] || continue + [ "x${f##*/}" = 'xwd' ] && continue + mv "${f}" "${cmd_build_pkg_dir}/.." + done +} + cmd_build_main() { local root= @@ -112,52 +158,6 @@ cmd_build_main() return 0 } -cmd_build_make_deps_pkg() -{ - local pkg_dir= - - pkg_dir="${cmd_build_root}$(session_dir)/builddeps" - mkdir -p "${pkg_dir}/control" "${pkg_dir}/data" - printf '2.0\n' >"${pkg_dir}/debian-binary" - cat >"${pkg_dir}/control/control" <<-EOF - Package: prokit-builddeps-$(session_id) - Source: prokit - Version: 1.0 - Architecture: all - Platform: all - Depends: ${cmd_build_build_deps} - Description: Build dependencies metapackage generated by prokit - EOF - (cd "${pkg_dir}/data"; tar -czf ../data.tar.gz .) - (cd "${pkg_dir}/control"; tar -czf ../control.tar.gz .) - (cd "${pkg_dir}"; tar -czf ../builddeps.opk \ - 'debian-binary' 'data.tar.gz' 'control.tar.gz') - rm -Rf "${pkg_dir}" -} - -cmd_build_fini() -{ - local session_dir= - local f= - - session_dir="$(session_dir)" - - if [ "x${cmd_build_build_deps}" != 'x' ]; then - session_exec opkg --autoremove remove \ - prokit-builddeps-$(session_id) - rm -f "${cmd_build_root}${session_dir}/builddeps.opk" - # Hack to avoid this code branch if the function is called again - # in response to a signal. - cmd_build_build_deps='' - fi - - for f in "${cmd_build_root}${session_dir}/"*; do - [ -e "${f}" ] || continue - [ "x${f##*/}" = 'xwd' ] && continue - mv "${f}" "${cmd_build_pkg_dir}/.." - done -} - cmd_build_register() { register_cmd 'build' |