* Winchester discs can take a long time to spin up which results in blockd also taking a while to complete to start. * Make sure uvol only gets started once blockd is ready. * Clean up paths (use '/tmp/run/uvol' everywhere instead of relying on the '/var' -> '/tmp' symlink) * Create 'apk' folder when initializing .meta volume. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
19 lines
499 B
Bash
19 lines
499 B
Bash
#!/bin/sh
|
|
|
|
uvol_init() {
|
|
local metasz freesz totalsz
|
|
uvol detect
|
|
metasz="$(uvol size .meta 2>/dev/null)"
|
|
[ "$((metasz))" -gt 0 ] && return
|
|
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
|