fix some bluetooth packaging bugs
[openadk.git] / scripts / ipkg-make-index.sh
blobec07dff595a27d47c56360b7b3eb45dcc5a4b3be
1 set -e
3 pkg_dir=$1
5 if [[ -z $pkg_dir || ! -d $pkg_dir ]]; then
6 echo "Usage: ipkg-make-index <package_directory>"
7 exit 1
8 fi
10 find "$pkg_dir" -name '*.ipk' | sort | while IFS= read pkg; do
11 dpkg=${pkg##*/}
12 echo "Generating index for package $dpkg" >&2
13 file_size=$(ls -l $pkg | awk '{print $5}')
14 md5sum=$(md5sum $pkg)
15 tar -xzOf "$pkg" ./control.tar.gz | \
16 tar -xzOf - ./control | \
17 sed -e "s\x01^Description:\x01Filename: $dpkg\\
18 Size: $file_size\\
19 MD5Sum: ${md5sum%% *}\\
20 Description:\x01"
21 echo ""
22 done
23 exit 0