6 [ -f "$TOPDIR/scripts/${0##*/}" ] || {
7 echo "Please execute within the toplevel directory" >&2
11 # Try to find package architecture from packages directory
13 for pkg in $TOPDIR/packages/*.ipk; do
14 if [ -f "$pkg" ]; then
16 PKGARCH="${PKGARCH%.ipk}"
17 [ "$PKGARCH" = all ] || break
21 # Try to find package architecture from the target directory
22 [ -n "$PKGARCH" ] || {
23 PKGARCH="${TARGETDIR##*/root-}"
24 [ "$PKGARCH" != "$TARGETDIR" ] || {
25 echo "Cannot determine package architecture" >&2
30 rm -f $TOPDIR/tmp/opkg.conf
32 [ -f $TOPDIR/repositories.conf ] && \
33 $TOPDIR/staging_dir/host/bin/sed \
34 -n -e "s/\$A/$PKGARCH/g" -e "/^[[:space:]*]src/p" \
35 $TOPDIR/repositories.conf > $TOPDIR/tmp/opkg.conf
37 cat <<EOT >> $TOPDIR/tmp/opkg.conf
41 option offline_root $TARGETDIR
42 src imagebuilder file:$TOPDIR/packages