# Pack binary package files into an opk file # # Copyright (C) 2012 Patrick McDermott # # This file is part of opkbuild. # # opkbuild is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # opkbuild is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with opkbuild. If not, see . set -eu build_opk() { local binary="${1}" local version="${2}" local arch="${3}" local plat="${4}" shift 4 ob_info "$(ob_get_msg 'build_opk')" \ "${binary}_${version}_${arch}_${plat}.opk" (cd -- "${binary}.data" && tar -czf '../data.tar.gz' '.') (cd -- "${binary}.control" && tar -czf '../control.tar.gz' '.') tar -czf "../../${binary}_${version}_${arch}_${plat}.opk" \ 'debian-binary' 'data.tar.gz' 'control.tar.gz' rm -Rf 'data.tar.gz' 'control.tar.gz' return 0 } main() { local pkg= local arch= local plat= if ! ob_set_text_domain 'opkbuild'; then printf '%s: Error: Failed to load locale messages\n' \ "${0##*/}" >&2 return 1 fi ob_init_package '..' || return 1 printf '2.0\n' >'debian-binary' if [ x"${OB_DO_SOURCE:+set}" = x'set' ]; then build_opk "src-${OPK_SOURCE}" "${OPK_SOURCE_VERSION}" \ 'src' 'all' else for pkg in ${OPK_PACKAGES_REDUCED}; do arch="$(ob_get_binary_parameter "${pkg}" \ 'Architecture')" [ x"${arch}" != x'all' ] && arch="${OPK_HOST_ARCH}" plat="$(ob_get_binary_parameter "${pkg}" 'Platform')" [ x"${plat}" != x'all' ] && plat="${OPK_HOST_PLAT}" build_opk "${pkg}" "${OPK_BINARY_VERSION}" \ "${arch}" "${plat}" done fi rm 'debian-binary' return 0 }