diff options
Diffstat (limited to 'scripts/ipkg-build')
-rw-r--r-- | scripts/ipkg-build | 57 |
1 files changed, 13 insertions, 44 deletions
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 <wbx@openadk.org> +# use cpio instead of tar for uid/gid handling # Carl Worth <cworth@east.isi.edu> -# 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 <steve@sr-tech.com> 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] <pkg_directory> [<destination_directory>]" -while getopts "cg:ho:v" opt; do +usage="Usage: $0 [-C] <pkg_directory> [<destination_directory>]" +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" |