#!/bin/sh
[ -n "${IPKG_INSTROOT}" ] || {
	# Initialize history file
	mkdir -p /tmp/media-flow-stats
	[ ! -f /tmp/media-flow-history.json ] && echo '[]' > /tmp/media-flow-history.json

	# Enable and start the collector
	/etc/init.d/media-flow enable 2>/dev/null
	/etc/init.d/media-flow start 2>/dev/null

	# Restart rpcd
	/etc/init.d/rpcd restart 2>/dev/null
}
exit 0
