#!/bin/sh /etc/rc.common

START=96
STOP=10
USE_PROCD=1

CACHE_DIR="/tmp/device-intel"

start_service() {
	local enabled
	config_load device-intel
	config_get enabled main enabled 0
	[ "$enabled" = "1" ] || return 0

	# Ensure cache directory exists
	mkdir -p "$CACHE_DIR"
}

stop_service() {
	rm -f "${CACHE_DIR}"/cache*.json 2>/dev/null
}

reload_service() {
	# Invalidate cache on config change
	rm -f "${CACHE_DIR}"/cache*.json 2>/dev/null
}

service_triggers() {
	procd_add_reload_trigger "device-intel"
}

status_service() {
	/usr/sbin/device-intelctl status
}
