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#*_*_}"
17 PKGARCH="${PKGARCH%.ipk}"
18 [ "$PKGARCH" = all ] || break
22 # Try to find package architecture from the target directory
23 [ -n "$PKGARCH" ] || {
24 PKGARCH="${TARGETDIR##*/root-}"
25 [ "$PKGARCH" != "$TARGETDIR" ] || {
26 echo "Cannot determine package architecture" >&2
31 rm -f $TOPDIR/tmp/opkg.conf
33 [ -f $TOPDIR/repositories.conf ] && \
34 $TOPDIR/staging_dir/host/bin/sed \
35 -n -e "s/\$A/$PKGARCH/g" -e "/^[[:space:]]*src/p" \
36 $TOPDIR/repositories.conf > $TOPDIR/tmp/opkg.conf
38 cat <<EOT >> $TOPDIR/tmp/opkg.conf
42 option offline_root $TARGETDIR
43 src imagebuilder file:$TOPDIR/packages