From 699876fa6b30be6a3fa11db92bce249d090aeb85 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 8 Sep 2010 00:36:35 +0000 Subject: - 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 --- target/imagebuilder/files/Makefile | 11 +----- target/imagebuilder/files/opkg-generate-config.sh | 45 +++++++++++++++++++++++ target/imagebuilder/files/repositories.conf | 5 +++ 3 files changed, 52 insertions(+), 9 deletions(-) create mode 100755 target/imagebuilder/files/opkg-generate-config.sh create mode 100644 target/imagebuilder/files/repositories.conf (limited to 'target/imagebuilder/files') diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index 8e6c6d7462..0590dfa72c 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -86,19 +86,12 @@ _call_info: FORCE $(TOPDIR)/tmp/opkg.conf: FORCE @mkdir -p $(TOPDIR)/tmp @mkdir -p $(TARGET_DIR)/tmp - @echo 'dest root /' > $@ - @echo 'src packages file:$(PACKAGE_DIR)' >> $@ - @echo 'arch all 100' >> $@ -ifneq ($(CONFIG_TARGET_adm5120),y) - @echo 'arch $(BOARD) 200' >> $@ -else - @echo 'arch $(BOARD)_$(ARCH) 200' >> $@ -endif - @echo 'option offline_root $(TARGET_DIR)' >> $@ + @$(TOPDIR)/scripts/opkg-generate-config.sh $(TARGET_DIR) BUILD_PACKAGES:=$(sort $(DEFAULT_PACKAGES) $(USER_PACKAGES) $($(USER_PROFILE)_PACKAGES) kernel) # "-pkgname" in the package list means remove "pkgname" from the package list BUILD_PACKAGES:=$(filter-out $(filter -%,$(BUILD_PACKAGES)) $(patsubst -%,%,$(filter -%,$(BUILD_PACKAGES))),$(BUILD_PACKAGES)) +PACKAGES:= _call_image: echo 'Building images for $(BOARD)$(if $($(USER_PROFILE)_NAME), - $($(USER_PROFILE)_NAME))' 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 <> $TOPDIR/tmp/opkg.conf +dest root / +arch all 100 +arch $PKGARCH 200 +option offline_root $TARGETDIR +src imagebuilder file:$TOPDIR/packages +EOT + +exit 0 diff --git a/target/imagebuilder/files/repositories.conf b/target/imagebuilder/files/repositories.conf new file mode 100644 index 0000000000..a8bb183455 --- /dev/null +++ b/target/imagebuilder/files/repositories.conf @@ -0,0 +1,5 @@ +## Place your custom repositories here, they must match the architecture and version. +## The special placeholder "$A" can be used to specify the current package architecture. + +# src/gz snapshots http://downloads.openwrt.org/snapshots/trunk/$A/packages +# src custom file:///usr/src/openwrt/bin/$A/packages -- cgit v1.2.3