summaryrefslogtreecommitdiff
path: root/scripts/ipkg-make-index.sh
blob: ec07dff595a27d47c56360b7b3eb45dcc5a4b3be (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