coreutils: update to 9.5
[openadk.git] / scripts / ipkg-make-index.sh
blob5738e9983ee7e623612753961d812b3d4ef3daae
1 set -e
3 pkg_dir=$1
5 if [[ -z $pkg_dir || ! -d $pkg_dir ]]; then
6 echo "Usage: ipkg-make-index.sh <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