main/postmarketos-mkinitfs: iterate over all block devices and partitions in init_functions.sh:mount_subpartitions()

This commit is contained in:
pinoaffe 2018-11-02 00:15:41 +00:00 committed by Oliver Smith
parent 467c240aee
commit 0188930f21
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 11 additions and 9 deletions

View file

@ -1,6 +1,6 @@
pkgname=postmarketos-mkinitfs
pkgver=0.7.2
pkgrel=0
pkgver=0.7.3
pkgrel=1
pkgdesc="Tool to generate initramfs images for postmarketOS"
url="https://postmarketos.org"
# multipath-tools: kpartx
@ -25,5 +25,5 @@ package() {
}
sha512sums="c8ed2697ba0368b907eaefe7544bff8539adc7e8247af6bd425c722e3cedeb34e303f6bd9e00f283921352bc43dff3db83f3b3c1f427ef597ac15323f1e9c3eb init.sh.in
8ca82bfa1e092885882df36a3628d653457522b39f60457f29d7cddfc81df470e479d8e7bb51011de2d312ffdf35b785c511f1a32e5952403be819548b2ace23 init_functions.sh
c012f1113854332709fd5f3b57fd005c51956357dd8ab6e8ae03138a4d8b11508095c6ea2dfc0f8a270947f0171f3268ddcd91672d9c4244a1692e7cb46d633b init_functions.sh
4c8a999009bc7e909bc1848c8c2421cb5f79f2603ee210b8f8c145f47c31a9e56e1861cffe742fcfd3c7bbb315e37dbe347bb5ac602f45eeccc0e40516889618 mkinitfs.sh"

View file

@ -45,18 +45,20 @@ mount_subpartitions() {
attempt_count=0
echo "Trying to mount subpartitions for 10 seconds..."
while [ -z "$(find_boot_partition)" ]; do
for i in /dev/mmcblk*; do
case "$(kpartx -l "$i" 2>/dev/null | wc -l)" in
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)
echo "Mount subpartitions of $i"
kpartx -afs "$i"
echo "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 "$i"
kpartx -d "$partition"
continue
;;
*)
@ -356,7 +358,7 @@ setup_framebuffer() {
echo "NOTE: Waiting 10 seconds for the framebuffer /dev/fb0."
echo "If your device does not have a framebuffer, disable this with:"
echo "no_framebuffer=true in <https://postmarketos.org/deviceinfo>"
for i in $(seq 1 100); do
for _ in $(seq 1 100); do
[ -e "/dev/fb0" ] && break
sleep 0.1
done