#!/bin/sh
# ax10-configure — run opkg maintainer postinst scripts that offline_root mode
# DEFERS (opkg prints "Configuring" but doesn't execute them when offline_root is
# set). Runs each with IPKG_INSTROOT=/tmp so the idiomatic ${IPKG_INSTROOT}/opt/..
# paths resolve to the real tmpfs tree. Postinsts are idempotent, so re-running is
# safe (a daemon already up is left alone). Called by the opkg wrapper after every
# install, and can be called at boot after `opkg install`.
INFO=/tmp/opt/lib/opkg/info
[ -d "$INFO" ] || exit 0
for f in "$INFO"/*.postinst; do
    [ -f "$f" ] || continue
    IPKG_INSTROOT=/tmp sh "$f" configure >/dev/null 2>&1
done
exit 0
