mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2024-12-21 14:21:35 +00:00
b993b68b6c
Before this commit, it was assumed that mkhash is in the PATH. While this was fine for the normal build workflow, this led to some issues if make TOPDIR="$(pwd)" -C "$pkgdir" compile was called manually. In most of the cases, I just saw warnings like this: make: Entering directory '/home/.../package/gluon-status-page' bash: line 1: mkhash: command not found bash: line 1: mkhash: command not found bash: line 1: mkhash: command not found bash: line 1: mkhash: command not found bash: line 1: mkhash: command not found bash: line 1: mkhash: command not found bash: line 1: mkhash: command not found bash: line 1: mkhash: command not found [...] While these were only warnings and the package still compiled sucessfully, I also observed that some package even fail to build because of this. After applying this commit, the variable $(MKHASH) is introduced. This variable points to $(STAGING_DIR_HOST)/bin/mkhash, which is always the correct path. Signed-off-by: Leonardo Mörlein <me@irrelefant.net>
32 lines
773 B
Bash
Executable File
32 lines
773 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
pkg_dir=$1
|
|
|
|
if [ -z $pkg_dir ] || [ ! -d $pkg_dir ]; then
|
|
echo "Usage: ipkg-make-index <package_directory>" >&2
|
|
exit 1
|
|
fi
|
|
|
|
empty=1
|
|
|
|
for pkg in `find $pkg_dir -name '*.ipk' | sort`; do
|
|
empty=
|
|
name="${pkg##*/}"
|
|
name="${name%%_*}"
|
|
[[ "$name" = "kernel" ]] && continue
|
|
[[ "$name" = "libc" ]] && continue
|
|
echo "Generating index for package $pkg" >&2
|
|
file_size=$(stat -L -c%s $pkg)
|
|
sha256sum=$($MKHASH sha256 $pkg)
|
|
# Take pains to make variable value sed-safe
|
|
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\\
|
|
SHA256sum: $sha256sum\\
|
|
Description:/"
|
|
echo ""
|
|
done
|
|
[ -n "$empty" ] && echo
|
|
exit 0
|