#!/bin/sh /etc/rc.common
# The CPU voltage offset (EXPERIMENTAL; mu300-cpu voltage, boot/init cpu-voltage, docs/FINDINGS.md 133): the good mark
# 10 minutes after boot, and at a clean shutdown or reboot (the K link: rcS K shutdown, never a plain "stop") the
# armed mark goes. A boot that ends any other way leaves the mark, and the initramfs drops the offset. STOP=10 runs
# before umount.
START=99
STOP=10
USE_PROCD=1

start_service() {
	[ -x /opt/mu300/bin/mu300-cpu ] || return 0
	procd_open_instance goodmark
	procd_set_param command /bin/sh -c "sleep 600; exec /opt/mu300/bin/mu300-cpu voltage mark-good"
	procd_set_param env PATH="$PATH:/opt/mu300/busybox-bin"
	procd_close_instance
}

shutdown() {
	/opt/mu300/bin/mu300-cpu voltage shutdown
	stop
}
