mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-26 08:51:13 +00:00
19 lines
383 B
Plaintext
19 lines
383 B
Plaintext
|
#!/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
|