diff --git a/main/postmarketos-android-recovery-installer/APKBUILD b/main/postmarketos-android-recovery-installer/APKBUILD index 24a09c60c..73a5724eb 100644 --- a/main/postmarketos-android-recovery-installer/APKBUILD +++ b/main/postmarketos-android-recovery-installer/APKBUILD @@ -1,5 +1,5 @@ pkgname=postmarketos-android-recovery-installer -pkgver=0.1.3 +pkgver=0.1.4 pkgrel=0 pkgdesc="TWRP compatible postmarketOS installer script" url="https://github.com/postmarketOS" @@ -29,6 +29,6 @@ package() { sha512sums="f02e67d26f4f977c5098ff6eee51b53ec962982c41b8b33c1a206c218c483bd20f782c06622cf8d724a9a1cdb5b9cc1b76d3bf32e562c9b558747ca3f3408ffd build_zip.sh 6390fc1b1c7dc8e917bb675d2e59e479782ac7754e97c4781866360ff704afe2d04f173a0ac74e3129db45328fab4b6b77a8717ee2e17c6ff79febadaa8ea034 update-binary f19c15fd99cc806d088ddf9c954111e48635f971ca500beeaa4893eb25d19fe0601210a57e9ab1a1dc7a6d79a3154765e696ee3329bbb1875b6d6df36a7b3fb3 pmos_chroot -895e5790924cf9deb74517627c78618eda5f0d53b5aa494b16f679c84cf414d6a2ec6847ef93158a5afdd70c5e2b053b3d4cd47047bab1c21790da08a4b45232 pmos_install +b932668aea823a98b7f7f3811413b1116e6444166a57f664f9b28687288e3cd39c31f5b272a632f30165b06974721a1bc880cbf7024ba091e8739ef30fcc2c6c pmos_install 36d8ca5ae092f8de0a9e2658581d3d1f83483b5076446aebaf5e1ab377e49615c31b81c00a23bc74d569de12a73977291c9a73e4f19b2faa694d981010c3eb35 pmos_install_functions c6355b6d823dac883e1a352f59a9a2199e2934d78a73df72dc3c4fc14ef93765a15179203d4a8a2ca0d841b63cd4c25c4689b63c8cf4d4da2bcec1f8ff76bff5 pmos_setpw" diff --git a/main/postmarketos-android-recovery-installer/pmos_install b/main/postmarketos-android-recovery-installer/pmos_install index 36407fadb..c2a1eeb36 100755 --- a/main/postmarketos-android-recovery-installer/pmos_install +++ b/main/postmarketos-android-recovery-installer/pmos_install @@ -58,13 +58,17 @@ mountpoint -q /mnt/pmOS && umount -R /mnt/pmOS ui_print "Symlinking block devices..." ln -sf /dev/block/* /dev/ + ui_print "Extracting partition table..." extract_partition_table + ui_print "Unmounting /$INSTALL_PARTITION..." umount_install_partition + ui_print "Creating partition table on $INSTALL_DEVICE..." # parted returns nonzero even when command executed successfully partition_install_device || : + ui_print "Creating mountpoint..." mkdir -p /mnt/pmOS @@ -72,22 +76,29 @@ if [ "$FDE" = "true" ] then ui_print "Generating temporary keyfile with random data..." dd bs=512 count=4 if=/dev/urandom of=/lukskey + ui_print "Initializing LUKS device..." cryptsetup luksFormat --use-urandom -c "$CIPHER" -q "$ROOT_PARTITION" /lukskey + ui_print "Opening LUKS partition..." cryptsetup luksOpen -d /lukskey "$ROOT_PARTITION" pm_crypt + ui_print "Formatting LUKS partition..." mkfs.ext4 -L 'pmOS_root' /dev/mapper/pm_crypt + ui_print "Mounting LUKS partition..." mount -t ext4 -rw /dev/mapper/pm_crypt /mnt/pmOS else ui_print "Formatting root partition..." mkfs.ext4 -L 'pmOS_root' "$ROOT_PARTITION" + ui_print "Mounting root partition..." mount -t ext4 -rw "$ROOT_PARTITION" /mnt/pmOS fi + ui_print "Formatting pmOS_boot..." mkfs.ext2 -q -L 'pmOS_boot' "$PMOS_BOOT" + ui_print "Mounting pmOS_boot..." mkdir /mnt/pmOS/boot mount -t ext2 -rw "$PMOS_BOOT" /mnt/pmOS/boot || { @@ -96,19 +107,27 @@ mount -t ext2 -rw "$PMOS_BOOT" /mnt/pmOS/boot || { mkfs.ext4 -L 'pmOS_boot' "$PMOS_BOOT" mount -t ext4 -rw "$PMOS_BOOT" /mnt/pmOS/boot } + ui_print "Installing rootfs..." unzip -p pmos.zip rootfs.tar.gz | tar -xz -C /mnt/pmOS + ui_print "Creating home folder..." mkdir /mnt/pmOS/home user="$(awk -F ':' '$3 == "1000" {print $1}' /mnt/pmOS/etc/passwd)" cp -a /mnt/pmOS/etc/skel /mnt/pmOS/home/"$user" chown -R 1000 /mnt/pmOS/home/"$user" + +ui_print "Configuring apk..." +sed -i '/\/mnt\/pmbootstrap-packages/d' /mnt/pmOS/etc/apk/repositories + +# Flash kernel if [ "$FLASH_KERNEL" = "true" ] then if [ "$ISOREC" = "true" ] then ui_print "Flashing kernel..." dd if=/mnt/pmOS/boot/vmlinuz-"$FLAVOR" of="$KERNEL_PARTITION" + ui_print "Flashing initfs..." gunzip -c /mnt/pmOS/boot/initramfs-"$FLAVOR" | lzop \ > "$INITFS_PARTITION" @@ -117,9 +136,11 @@ then dd if=/mnt/pmOS/boot/boot.img-"$FLAVOR" of="$BOOT_PARTITION" fi fi + if [ "$FDE" = "true" ] then ui_print "Do not forget to add a password to the LUKS partition!" ui_print "Run the command: pmos_setpw from the terminal/adb shell!" fi + ui_print "Installation done."