6d25c1bef6
When util-linux v2.32 updated v2.33, remounting a partition stopped working. mount -n -o remount,rw / mount: /: can't find LABEL="pmOS_root". This service will add the pmOS rootfs partitions to device mapper so that the remount root partition will succeed. Fixes issue #156
33 lines
1.2 KiB
Text
33 lines
1.2 KiB
Text
#!/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"
|
|
kpartx -afs "$partition"
|
|
# 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
|
|
}
|