summaryrefslogtreecommitdiff
path: root/scripts/ipkg-make-index.sh
blob: 927e67b93578ca1283abbf0d031744ee9c217870 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
set -e

pkg_dir=$1

if [[ -z $pkg_dir || ! -d $pkg_dir ]]; then
	echo "Usage: ipkg-make-index <package_directory>"
	exit 1
fi

find "$pkg_dir" -name '*.ipk' | sort | while IFS= read pkg; do
	dpkg=${pkg##*/}
	#echo "Generating index for package $dpkg" >&2
	file_size=$(ls -l $pkg | awk '{print $5}')
	md5sum=$(md5sum $pkg)
	tar -xzOf "$pkg" ./control.tar.gz | \
	    tar -xzOf - ./control | \
	    sed -e "s^Description:Filename: $dpkg\\
Size: $file_size\\
MD5Sum: ${md5sum%% *}\\
Description:"
	echo ""
done
exit 0