diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-09-08 00:36:35 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-09-08 00:36:35 +0000 |
commit | 699876fa6b30be6a3fa11db92bce249d090aeb85 (patch) | |
tree | f2b33d2ee119f51b173d4bfc3be71d4fcc116690 /target/imagebuilder/files/opkg-generate-config.sh | |
parent | 91118a9500eec1bededcdb8e2f0058368ca7f8b7 (diff) | |
download | upstream-699876fa6b30be6a3fa11db92bce249d090aeb85.tar.gz upstream-699876fa6b30be6a3fa11db92bce249d090aeb85.tar.bz2 upstream-699876fa6b30be6a3fa11db92bce249d090aeb85.zip |
- add a helper script to generate opkg.conf, attempt to detect package architecture from packages/ - fix package defaults when no package override is given, IB previously aggregated the defautls of all profiles - introduce a repositories.conf, allows using remote opkg repositories in imagebuilder
SVN-Revision: 22978
Diffstat (limited to 'target/imagebuilder/files/opkg-generate-config.sh')
-rwxr-xr-x | target/imagebuilder/files/opkg-generate-config.sh | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/target/imagebuilder/files/opkg-generate-config.sh b/target/imagebuilder/files/opkg-generate-config.sh new file mode 100755 index 0000000000..a385d9fa9b --- /dev/null +++ b/target/imagebuilder/files/opkg-generate-config.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +TOPDIR="$(pwd)" +TARGETDIR="${1}" + +[ -f "$TOPDIR/scripts/${0##*/}" ] || { + echo "Please execute within the toplevel directory" >&2 + exit 1 +} + +# Try to find package architecture from packages directory +PKGARCH= +for pkg in $TOPDIR/packages/*.ipk; do + if [ -f "$pkg" ]; then + PKGARCH="${pkg##*_}" + PKGARCH="${PKGARCH%.ipk}" + [ "$PKGARCH" = all ] || break + fi +done + +# Try to find package architecture from the target directory +[ -n "$PKGARCH" ] || { + PKGARCH="${TARGETDIR##*/root-}" + [ "$PKGARCH" != "$TARGETDIR" ] || { + echo "Cannot determine package architecture" >&2 + exit 1 + } +} + +rm -f $TOPDIR/tmp/opkg.conf + +[ -f $TOPDIR/repositories.conf ] && \ + $TOPDIR/staging_dir/host/bin/sed \ + -n -e "s/\$A/$PKGARCH/g" -e "/^[[:space:]*]src/p" \ + $TOPDIR/repositories.conf > $TOPDIR/tmp/opkg.conf + +cat <<EOT >> $TOPDIR/tmp/opkg.conf +dest root / +arch all 100 +arch $PKGARCH 200 +option offline_root $TARGETDIR +src imagebuilder file:$TOPDIR/packages +EOT + +exit 0 |