recovery zip: support twrp.fstab filename in addition to recovery.fstab (fix for compatibility with TWRP on sony-yuga)

This commit is contained in:
Martin 2018-08-16 21:21:45 +00:00 committed by Oliver Smith
parent 9804dc2e58
commit f508cf14b7
3 changed files with 24 additions and 8 deletions

View file

@ -1,5 +1,5 @@
pkgname=postmarketos-android-recovery-installer
pkgver=0.1.7
pkgver=0.1.8
pkgrel=1
pkgdesc="TWRP compatible postmarketOS installer script"
url="https://postmarketos.org"
@ -28,7 +28,7 @@ package() {
}
sha512sums="924f961e1a488134d265f43724d2b06a908ac1522706dc3f7118f0dec16453aa0a928fef6d9a31a6a747910df665e64f25c94c47a9e3f1d57db19abb0fd8210d build_zip.sh
6390fc1b1c7dc8e917bb675d2e59e479782ac7754e97c4781866360ff704afe2d04f173a0ac74e3129db45328fab4b6b77a8717ee2e17c6ff79febadaa8ea034 update-binary
f19c15fd99cc806d088ddf9c954111e48635f971ca500beeaa4893eb25d19fe0601210a57e9ab1a1dc7a6d79a3154765e696ee3329bbb1875b6d6df36a7b3fb3 pmos_chroot
2260c5c7bf069a9fa57af5fe343aa8a9da1e258faf9be1900abce0c5768abbec178ac51d3fc48648e9f2fe3bd8d1f4e71f6d4beea07b524aeb94fd054a6def46 pmos_chroot
94d06a7a73f76eb737e65ca2828f3c59d9cc532f2d2ec200e1407cd8fc266be192e33a8baa923e460a4335c7f5fb5232675d2e2e98a7e1ed07a257c67a0a5c5d pmos_install
514881d7812197830869c73428acc88f8a94dd02184634406ffe47884cd21d7b02ecc7806dae39308f026b1dbfca9ceee714fdfdc2bebc3ebcdeed71865de2b2 pmos_install_functions
4ba66b336372b23252673f0929ea4f706ec287b5a902c8cb392a9cafb832db445bb7aecc9a7fac34f855babba057c56e3b10c015a1d055a66f0bfd42fef5828e pmos_install_functions
c6355b6d823dac883e1a352f59a9a2199e2934d78a73df72dc3c4fc14ef93765a15179203d4a8a2ca0d841b63cd4c25c4689b63c8cf4d4da2bcec1f8ff76bff5 pmos_setpw"

View file

@ -28,9 +28,18 @@ done
mount --bind /tmp/postmarketos/pmos.log "$CHROOT"/pmos.log
mount --bind "$ZIP" "$CHROOT"/pmos.zip
fstab_recovery="recovery.fstab"
# TWRP can use twrp.fstab instead of recovery.fstab (device specific)
# This check exists to support both formats.
if [ ! -e "/etc/"$fstab_recovery ]; then
fstab_recovery="twrp.fstab"
fi
# Create copy of fstab file provided by the recovery
cp /etc/recovery.fstab "$CHROOT"/recovery.fstab || {
[ "$?" = '255' ] && echo 'recovery.fstab not found, continuing...' || exit "$?" ; }
if ! cp /etc/$fstab_recovery "$CHROOT"/$fstab_recovery; then
echo "Error copying $fstab_recovery , exiting..."
exit 1
fi
# Mount necessary filesystems for the chroot
for mountpoint in "/dev" "/proc" "/sys"

View file

@ -31,14 +31,21 @@ ui_print() {
}
extract_partition_table() {
fstab_recovery="recovery.fstab"
# TWRP can use twrp.fstab instead of recovery.fstab (device specific)
# This check exists to support both formats.
if [ ! -e "/"$fstab_recovery ]; then
fstab_recovery="twrp.fstab"
fi
case "$INSTALL_PARTITION" in
"system")
_INSTALL_DEVICE=$(findfs PARTLABEL="$SYSTEM_PARTLABEL") || \
# We need to resolve symlinks, to make set_subpartitions() work.
_INSTALL_DEVICE=$(readlink -fn "$(awk '$1 == "/system" {print $3; exit;}' /recovery.fstab)")
_INSTALL_DEVICE=$(readlink -fn "$(awk '$1 == "/system" {print $3; exit;}' /$fstab_recovery)")
;;
"external_sd")
_INSTALL_DEVICE=$(readlink -fn "$(awk '$1 == "/external_sd" {print $4; exit;}' /recovery.fstab)")
_INSTALL_DEVICE=$(readlink -fn "$(awk '$1 == "/external_sd" {print $4; exit;}' /$fstab_recovery)")
;;
*)
echo "No support for flashing $INSTALL_PARTITION."
@ -61,7 +68,7 @@ extract_partition_table() {
INITFS_PARTITION=$(findfs PARTLABEL="$INITFS_PARTLABEL")
else
_BOOT_PARTITION=$(findfs PARTLABEL="boot") || \
_BOOT_PARTITION=$(awk '$1 == "/boot" {print $3; exit;}' /recovery.fstab)
_BOOT_PARTITION=$(awk '$1 == "/boot" {print $3; exit;}' /$fstab_recovery)
if [ ! -z "$_BOOT_PARTITION" ]
then
echo "boot partition found at $_BOOT_PARTITION"