From d9730197219dda09ba7a0d5321c399e0d11d23e7 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 1 Dec 2010 22:42:20 +0100 Subject: fix ipkg and ipkg tools, consolidate mdev.conf cpio under macosx or bsd creates tar archives via stdin while using find . with leading ./. heirloom cpio shipped with OpenADK does remove the leading ./. Adopt ipkg busybox applet to work without ./. Fix ipkg-build to be faster and to use included cpio for inner tar creation. Dependency to GNU tar can now be dropped. --- scripts/ipkg-build | 57 +++++++++++++----------------------------------------- 1 file changed, 13 insertions(+), 44 deletions(-) (limited to 'scripts/ipkg-build') diff --git a/scripts/ipkg-build b/scripts/ipkg-build index a94593944..47158c409 100644 --- a/scripts/ipkg-build +++ b/scripts/ipkg-build @@ -1,12 +1,9 @@ #!/usr/bin/env bash - # ipkg-build -- construct a .ipk from a directory +# Waldemar Brodkorb +# use cpio instead of tar for uid/gid handling # Carl Worth -# based on a script by Steve Redler IV, steve@sr-tech.com 5-21-2001 -# 2003-04-25 rea@sr.unh.edu -# Updated to work on Familiar Pre0.7rc1, with busybox tar. -# Note it Requires: binutils-ar (since the busybox ar can't create) -# For UID debugging it needs a better "find". +# based on a script by Steve Redler IV set -e version=1.0 @@ -47,19 +44,6 @@ pkg_appears_sane() { PKG_ERROR=0 - cvs_dirs=`find . -name 'CVS'` - if [ -n "$cvs_dirs" ]; then - if [ "$noclean" = "1" ]; then - echo "*** Warning: The following CVS directories where found. -You probably want to remove them: " >&2 - ls -ld $cvs_dirs - echo >&2 - else - echo "*** Removing the following files: $cvs_dirs" - rm -rf "$cvs_dirs" - fi - fi - tilde_files=`find . -name '*~'` if [ -n "$tilde_files" ]; then if [ "$noclean" = "1" ]; then @@ -162,20 +146,10 @@ You probably want to remove them: " >&2 ### # ipkg-build "main" ### -ogargs="" -outer=ar noclean=0 -usage="Usage: $0 [-c] [-C] [-o owner] [-g group] []" -while getopts "cg:ho:v" opt; do +usage="Usage: $0 [-C] []" +while getopts ":h:v" opt; do case $opt in - o ) owner=$OPTARG - ogargs="--owner=$owner" - ;; - g ) group=$OPTARG - ogargs="$ogargs --group=$group" - ;; - c ) outer=tar - ;; C ) noclean=1 ;; v ) echo $version @@ -186,7 +160,6 @@ while getopts "cg:ho:v" opt; do esac done - shift $(($OPTIND - 1)) # continue on to process additional arguments @@ -232,22 +205,18 @@ fi tmp_dir=$dest_dir/IPKG_BUILD.$$ mkdir $tmp_dir -echo $CONTROL > $tmp_dir/tarX -( cd $pkg_dir && tar $ogargs -X $tmp_dir/tarX -czf $tmp_dir/data.tar.gz . ) -( cd $pkg_dir/$CONTROL && tar $ogargs -czf $tmp_dir/control.tar.gz . ) -rm $tmp_dir/tarX +( cd $pkg_dir && find . | grep -v $CONTROL | \ + sed "s#\(.*\)#:0:0::::::\1#" | \ + sort | cpio -o -Hustar -P | gzip -n9 > $tmp_dir/data.tar.gz ) -echo "2.0" > $tmp_dir/debian-binary +( cd $pkg_dir/$CONTROL && find . | \ + sed "s#\(.*\)#:0:0::::::\1#" | \ + sort | cpio -o -Hustar -P | gzip -n9 > $tmp_dir/control.tar.gz ) +echo "2.0" > $tmp_dir/debian-binary pkg_file=$dest_dir/${pkg}_${version}_${arch}.ipk rm -f $pkg_file -if [ "$outer" = "ar" ] ; then - ( cd $tmp_dir && ar -crf $pkg_file ./debian-binary ./data.tar.gz ./control.tar.gz ) -else - ( cd $tmp_dir && tar -zcf $pkg_file ./debian-binary ./data.tar.gz ./control.tar.gz ) -fi - +( cd $tmp_dir && tar -zcf $pkg_file ./debian-binary ./data.tar.gz ./control.tar.gz ) rm $tmp_dir/debian-binary $tmp_dir/data.tar.gz $tmp_dir/control.tar.gz rmdir $tmp_dir - echo "Packaged contents of $pkg_dir into $pkg_file" -- cgit v1.2.3