#!/bin/sh
set -e
# Image/SDK assembly must not execute the build host's init services.
[ -z "${IPKG_INSTROOT:-}" ] || exit 0
/etc/init.d/xxyun-router enable
if /etc/init.d/xxyun-router running >/dev/null 2>&1; then
    /etc/init.d/xxyun-router restart
else
    /etc/init.d/xxyun-router start
fi
/etc/init.d/rpcd reload
if [ -f /usr/share/xxyun/runtime/manifest.json ]; then
    /etc/init.d/xxyun-prepare enable
    # procd starts a separate one-shot task. It waits for this outer package
    # transaction instead of nesting another package install in postinst.
    /etc/init.d/xxyun-prepare start
fi
