2018-12-24 20:45:58 +00:00
|
|
|
#!/sbin/openrc-run
|
|
|
|
|
|
|
|
description="Add partition devmappings"
|
|
|
|
|
|
|
|
depend()
|
|
|
|
{
|
|
|
|
before root
|
|
|
|
}
|
|
|
|
|
|
|
|
start()
|
|
|
|
{
|
|
|
|
partitions="$(grep -v "loop\|ram" < /proc/diskstats |\
|
|
|
|
sed 's/\(\s\+[0-9]\+\)\+\s\+//;s/ .*//;s/^/\/dev\//')"
|
|
|
|
echo "$partitions" | while read -r partition; do
|
|
|
|
case "$(kpartx -l "$partition" 2>/dev/null | wc -l)" in
|
|
|
|
2)
|
|
|
|
einfo "Mount subpartitions of $partition"
|
2019-01-21 19:11:21 +00:00
|
|
|
# On some devices (e. g. htc vision) this kpartx command can fail
|
|
|
|
# with a non-zero exit code on some unrelated partitions, which would
|
|
|
|
# normally cause the loop to abort. But we still need to find the
|
|
|
|
# root partition, hence the "|| continue"
|
|
|
|
kpartx -afs "$partition" || continue
|
2018-12-24 20:45:58 +00:00
|
|
|
# Ensure that this was the *correct* subpartition
|
|
|
|
# Some devices have mmc partitions that appear to have
|
|
|
|
# subpartitions, but aren't our subpartition.
|
|
|
|
if blkid | grep -q "pmOS_boot"; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
kpartx -d "$partition"
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
}
|