#!/bin/sh
# /etc/uci-defaults/40_luci-app-shater
#
# One-time, idempotent post-install fixup. Runs on first boot and via the default
# postinst on a live opkg/apk install. Must exit 0 so it is cleared and not retried.
#
# Its job: guarantee the rpcd exec plugin is executable. The +x bit can be lost when
# this package is built from a filesystem that doesn't carry Unix modes (e.g. a
# Windows checkout with core.filemode=false); a non-executable plugin is silently
# skipped by rpcd, so the ubus object "shater" would never register. We then reload
# rpcd (register the object) and drop the LuCI menu/index cache.

[ -f /usr/libexec/rpcd/shater ] && chmod 0755 /usr/libexec/rpcd/shater

/etc/init.d/rpcd reload >/dev/null 2>&1
rm -f /tmp/luci-indexcache* 2>/dev/null
rm -rf /tmp/luci-modulecache/ 2>/dev/null

exit 0
