0105a1d8ef
Refactor the install code to be generic, so we only need to add the new path in one place when adding a new file. Put the full path into the filename to make this possible. I've tried to mimic the final directory structure in the aport first (e.g. $pkgdir/sbin/swapfile -> main/postmarketos-base/sbin/swapfile), but that leads to conflicts as abuild only takes the filename for checksums (conflict with etc/conf.d/swapfile): https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10013 We don't really need checksum verification for the files shipped in the same directory (not downloaded), but nevertheless this is a bug. It leads to confusing behavior and might be fixed by letting abuild demand that there is only one source file with the same name, as I suggested in the issue linked above. So let's avoid this altogether with the flat file name.
37 lines
1.5 KiB
Text
37 lines
1.5 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"
|
|
# 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
|
|
# 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
|
|
}
|