main/postmarketos-mkinitfs: support pmOS_install (MR 1296)
Prefer booting from a pmOS_install partition if it exists, but do not resize it. Related: https://wiki.postmarketos.org/wiki/On-device_installer
This commit is contained in:
parent
24b83e2415
commit
9be8b59a00
2 changed files with 31 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
|||
pkgname=postmarketos-mkinitfs
|
||||
pkgver=0.12.1
|
||||
pkgrel=1
|
||||
pkgver=0.12.2
|
||||
pkgrel=0
|
||||
pkgdesc="Tool to generate initramfs images for postmarketOS"
|
||||
url="https://postmarketos.org"
|
||||
# multipath-tools: kpartx
|
||||
|
@ -40,7 +40,7 @@ check() {
|
|||
|
||||
sha512sums="5037cb7285bb7c0c40ca9e6df332d882ef9a8b379756c785f921e062dab1b7e7f3139d00897f69323a916d709ced4297fea8cbd3a13ebae575b873ec9e2cbfae 00-default.modules
|
||||
1d49db8a48ad513cc548b8a0ea23cc64518e71c93863155b4e9d2271fb46090506331c03d6955d693c8568c248ecc76b218efe4a6f6bba57c41c5f6d775dc61b init.sh.in
|
||||
315cc6e8a73f9984e6843395d68734d26ac2fffce34039ec5f229ebcd818bdb353318398d6c824cede5d0b36e13d7589a1f1d3295d8162279b5dc6a2b939da88 init_functions.sh
|
||||
ae7a7538f62616b9ee8b56b39531782c7d61ecb1679677d6bbe0f5e3ca228941bf2f340fead1d1abd971df30ff3059428d8f759660f53ec946ad8026e0e59c4b init_functions.sh
|
||||
7201d4640a3e9ead8a47ffd9916b068476b7d950760a84c37e02268c942d49896bc986da6bdee27e832639c90775354d68046a6475205d8d1da995b068120d8f mkinitfs.sh
|
||||
5105fcc5f2094009937b378c8d383270f4fcd0133d0e60268806a7d09966613f4ebfa93d7e1b90b5d83d0c5b1664a0b3fc7562e52cc1e0ca6cd54ff442b03e84 mkinitfs_functions.sh
|
||||
c7a3c33daeb12b33ac72207191941c4d634f15c22958273b52af381a70ebaba1d3a9299483f0c447d9e66c560151fe7b9588bb4bbef2c8914f83185984ee4622 mkinitfs_test.sh"
|
||||
|
|
|
@ -111,11 +111,30 @@ find_root_partition() {
|
|||
[ "$x" = "${x#pmos_root=}" ] && continue
|
||||
DEVICE="${x#pmos_root=}"
|
||||
done
|
||||
|
||||
# On-device installer: before postmarketOS is installed,
|
||||
# we want to use the installer partition as root. It is the
|
||||
# partition behind pmos_root. pmos_root will either point to
|
||||
# reserved space, or to an unfinished installation.
|
||||
# p1: boot
|
||||
# p2: (reserved space) <--- pmos_root
|
||||
# p3: pmOS_install
|
||||
# Details: https://postmarketos.org/on-device-installer
|
||||
if [ -n "$DEVICE" ]; then
|
||||
next="$(echo "$DEVICE" | sed 's/2$/3/')"
|
||||
|
||||
# If the next partition is labeled pmOS_install (and
|
||||
# not pmOS_deleteme), then postmarketOS is not
|
||||
# installed yet.
|
||||
if blkid | grep "$next" | grep -q pmOS_install; then
|
||||
DEVICE="$next"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Try partitions in /dev/mapper and /dev/dm-* first
|
||||
if [ -z "$DEVICE" ]; then
|
||||
for id in pmOS_root crypto_LUKS; do
|
||||
for id in pmOS_install pmOS_root crypto_LUKS; do
|
||||
for path in /dev/mapper /dev/dm; do
|
||||
DEVICE="$(blkid | grep "$path" | grep "$id" \
|
||||
| cut -d ":" -f 1 | head -n 1)"
|
||||
|
@ -126,7 +145,7 @@ find_root_partition() {
|
|||
|
||||
# Then try all devices
|
||||
if [ -z "$DEVICE" ]; then
|
||||
for id in pmOS_root crypto_LUKS; do
|
||||
for id in pmOS_install pmOS_root crypto_LUKS; do
|
||||
DEVICE="$(blkid | grep "$id" | cut -d ":" -f 1 \
|
||||
| head -n 1)"
|
||||
[ -z "$DEVICE" ] || break
|
||||
|
@ -180,6 +199,13 @@ wait_root_partition() {
|
|||
|
||||
resize_root_partition() {
|
||||
partition=$(find_root_partition)
|
||||
|
||||
# Do not resize the installer partition
|
||||
if blkid "$partition" | grep -q pmOS_install; then
|
||||
echo "Resize root partition: skipped (on-device installer)"
|
||||
return
|
||||
fi
|
||||
|
||||
# Only resize the partition if it's inside the device-mapper, which means
|
||||
# that the partition is stored as a subpartition inside another one.
|
||||
# In this case we want to resize it to use all the unused space of the
|
||||
|
|
Loading…
Reference in a new issue