summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2010-12-01 22:42:20 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2010-12-01 22:42:20 +0100
commitd9730197219dda09ba7a0d5321c399e0d11d23e7 (patch)
tree25e92753ba3a5beeb2785fe9508bdafa11538ea2 /scripts
parentb252f7521306c28b8c46f3981cf4ea26d7993625 (diff)
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.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/ipkg-build57
-rw-r--r--scripts/ipkg-make-index.sh4
2 files changed, 15 insertions, 46 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"
diff --git a/scripts/ipkg-make-index.sh b/scripts/ipkg-make-index.sh
index 927e67b93..5738e9983 100644
--- a/scripts/ipkg-make-index.sh
+++ b/scripts/ipkg-make-index.sh
@@ -3,7 +3,7 @@ set -e
pkg_dir=$1
if [[ -z $pkg_dir || ! -d $pkg_dir ]]; then
- echo "Usage: ipkg-make-index <package_directory>"
+ echo "Usage: ipkg-make-index.sh <package_directory>"
exit 1
fi
@@ -13,7 +13,7 @@ find "$pkg_dir" -name '*.ipk' | sort | while IFS= read pkg; do
file_size=$(ls -l $pkg | awk '{print $5}')
md5sum=$(md5sum $pkg)
tar -xzOf "$pkg" ./control.tar.gz | \
- tar -xzOf - ./control | \
+ tar -xzOf - control | \
sed -e "s^Description:Filename: $dpkg\\
Size: $file_size\\
MD5Sum: ${md5sum%% *}\\