X-Git-Url: https://git.archive.openwrt.org/?a=blobdiff_plain;f=scripts%2Fipkg-make-index.sh;h=cbfa450c0a2aa7e4aeab9217a8dd98dd5ea8874c;hb=4d953d3a481dd847524eae78c7aae00153bc7efd;hp=46051045ae072a817898aca26556b83716f0e59f;hpb=eb1c48aeec6f13addccbc6363f52608fa4d8e322;p=openwrt.git diff --git a/scripts/ipkg-make-index.sh b/scripts/ipkg-make-index.sh index 46051045ae..cbfa450c0a 100755 --- a/scripts/ipkg-make-index.sh +++ b/scripts/ipkg-make-index.sh @@ -1,21 +1,25 @@ -#!/bin/sh +#!/usr/bin/env bash set -e pkg_dir=$1 if [ -z $pkg_dir ] || [ ! -d $pkg_dir ]; then - echo "Usage: ipkg-make-index " + echo "Usage: ipkg-make-index " >&2 exit 1 fi -which md5sum 2>&1 >/dev/null || alias md5sum=md5 +which md5sum >/dev/null 2>&1 || alias md5sum=md5 for pkg in `find $pkg_dir -name '*.ipk' | sort`; do + name="${pkg##*/}" + name="${name%%_*}" + [[ "$name" = "kernel" ]] && continue + [[ "$name" = "libc" ]] && continue echo "Generating index for package $pkg" >&2 file_size=$(ls -l $pkg | awk '{print $5}') md5sum=$(md5sum $pkg | awk '{print $1}') # Take pains to make variable value sed-safe - sed_safe_pkg=`echo $pkg | sed -e 's/\\//\\\\\\//g'` + sed_safe_pkg=`echo $pkg | sed -e 's/^\.\///g' -e 's/\\//\\\\\\//g'` tar -xzOf $pkg ./control.tar.gz | tar xzOf - ./control | sed -e "s/^Description:/Filename: $sed_safe_pkg\\ Size: $file_size\\ MD5Sum: $md5sum\\