summaryrefslogtreecommitdiff
path: root/scripts/ipkg-make-index.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/ipkg-make-index.sh')
-rw-r--r--scripts/ipkg-make-index.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/ipkg-make-index.sh b/scripts/ipkg-make-index.sh
new file mode 100644
index 000000000..ec07dff59
--- /dev/null
+++ b/scripts/ipkg-make-index.sh
@@ -0,0 +1,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