openwrt/package/utils/mtd-utils/files/ubihealthd.defaults
Daniel Golle 7e287b563a
mtd-utils: add ubihealthd to nand-utils
Add ubihealthd to the nand-utils package, auto-create UCI config for
each UBI device and launch the daemon on boot.

The default time interval between scrubbing a random PED is 120 seconds
which means that a fully used 128 MiB flash chip gets scrubbed in about
a day and a half. The interval can be adjusted in UCI using the
'interval' option.

Suggested-by: Rodrigo Balerdi <lanchon@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Link: https://github.com/openwrt/openwrt/pull/16973
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-11-18 15:18:39 +01:00

19 lines
383 B
Bash

#!/bin/sh
[ -e "/etc/config/ubihealthd" ] && exit 0
[ ! -e "/sys/class/ubi" ] && exit 0
touch "/etc/config/ubihealthd"
for ubidev in /sys/class/ubi/*/total_eraseblocks; do
ubidev="${ubidev%/*}"
ubidev="${ubidev##*/}"
uci batch <<EOF
set ubihealthd.$ubidev=ubi-device
set ubihealthd.$ubidev.device="/dev/$ubidev"
set ubihealthd.$ubidev.enable=1
EOF
done
uci commit ubihealthd