mirror of
https://github.com/openwrt/packages.git
synced 2025-02-07 05:49:50 +00:00
3d86716b4f
Instead of /sys/devices/virtual/ubi which will no longer be available in future kernels, switch to /sys/class/ubi. While at it fix unrelated arithmetic syntax error by guarding the affected expression to not run on an empty string. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
22 lines
528 B
Bash
22 lines
528 B
Bash
#!/bin/sh
|
|
|
|
uvol_init() {
|
|
local metasz freesz totalsz
|
|
uvol detect
|
|
metasz="$(uvol size .meta 2>/dev/null)"
|
|
if [ "$metasz" ]; then
|
|
[ "$((metasz))" -gt 0 ] && return
|
|
fi
|
|
totalsz="$(uvol total)"
|
|
freesz="$(uvol free)"
|
|
metasz="$((totalsz / 10240))"
|
|
[ "$metasz" -lt 4194304 ] && metasz=4194304
|
|
[ "$metasz" -gt "$freesz" ] && return
|
|
uvol create .meta "$metasz" rw
|
|
uvol up .meta
|
|
grep -q "uvol/.meta" /proc/mounts || return
|
|
mkdir -p "/var/run/uvol/.meta/apk"
|
|
}
|
|
|
|
uci -q get fstab.@uvol[0].initialized >/dev/null || uvol_init
|