diff options
author | P. J. McDermott <pjm@nac.net> | 2012-01-29 21:58:22 (EST) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2012-01-29 21:58:22 (EST) |
commit | 41d829c1647e42b003fbf3d98c8c600c5e2fdf2a (patch) | |
tree | 31077fc61e3942fe3d1a4d78dbc1adf8e5c3cc2c /src/oh-buildopk | |
parent | 51740fc8e456deba55a0cd240535a22c4fbe816c (diff) |
Use correct architecture name in oh-buildopk.
The interface and logic is changed to resemble that of oh-gencontrol.
Diffstat (limited to 'src/oh-buildopk')
-rw-r--r-- | src/oh-buildopk | 76 |
1 files changed, 64 insertions, 12 deletions
diff --git a/src/oh-buildopk b/src/oh-buildopk index 3d67596..3021aa2 100644 --- a/src/oh-buildopk +++ b/src/oh-buildopk @@ -20,34 +20,86 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. . @@LIBDIR@@/opkhelper/controlfields +. @@LIBDIR@@/opkhelper/architecture print_usage() { - printf 'Usage: %s pkgname...\n' "$1" + printf 'Usage: %s -s | pkgname...\n' "$1" } -if [ ${#} -eq 0 ]; then - print_usage ${0} >&2 - exit 1 +opts=$(getopt -n "${0}" -o 's' -- "${@}") +if [ ${?} -ne 0 ]; then + print_usage "${0}" >&2 + exit 1; fi +eval set -- "${opts}" +while true; do + case "${1}" in + -s) + is_srcpkg=true + shift + ;; + --) + shift + break + ;; + *) + print_usage "${0}" >&2 + exit 1 + ;; + esac +done -# Iterate over packages. -while [ ${#} -gt 0 ]; do - printf 'oh-buildopk: Packing package "%s"...\n' "${1}" +if [ -n "${is_srcpkg}" ]; then + pkg="${OH_SRCPKG}-src" # Write debian-binary. echo '2.0' > debian-binary || exit 2 + # Pack data.tar.gz. - cd ${1}.data + cd ${pkg}.data tar -czf ../data.tar.gz . || exit 2 cd .. + # Pack control.tar.gz. - cd ${1}.control + cd ${pkg}.control tar -czf ../control.tar.gz . || exit 2 cd .. + # Pack opk file. - tar -czf ../../${1}_$(oh_get_field Version)_arch.opk \ + tar -czf ../../${pkg}_${OH_PKGVER}-${OH_PKGREV}_all.opk \ debian-binary data.tar.gz control.tar.gz || exit 2 rm -Rf debian-binary control data.tar.gz control.tar.gz || exit 2 - shift -done +else + if [ ${#} -eq 0 ]; then + print_usage ${0} >&2 + exit 1 + fi + + # Iterate over packages. + while [ ${#} -gt 0 ]; do + printf 'oh-buildopk: Packing package "%s"...\n' "${1}" + + arch="$(oh_get_package_architecture ${1})" + + # Write debian-binary. + echo '2.0' > debian-binary || exit 2 + + # Pack data.tar.gz. + cd ${1}.data + tar -czf ../data.tar.gz . || exit 2 + cd .. + + # Pack control.tar.gz. + cd ${1}.control + tar -czf ../control.tar.gz . || exit 2 + cd .. + + # Pack opk file. + tar -czf ../../${1}_${OH_PKGVER}-${OH_PKGREV}_${arch}.opk \ + debian-binary data.tar.gz control.tar.gz || exit 2 + rm -Rf debian-binary control data.tar.gz control.tar.gz || exit 2 + + shift + done +fi |