diff --git a/main/postmarketos-android-recovery-installer/APKBUILD b/main/postmarketos-android-recovery-installer/APKBUILD index fb3333cd1..4270acc72 100644 --- a/main/postmarketos-android-recovery-installer/APKBUILD +++ b/main/postmarketos-android-recovery-installer/APKBUILD @@ -1,43 +1,33 @@ +# Contributor: Attila Szollosi +# Maintainer: Attila Szollosi pkgname=postmarketos-android-recovery-installer -pkgver=0.1.10 -pkgrel=1 +pkgver=1.0.0 +pkgrel=0 pkgdesc="TWRP compatible postmarketOS installer script" +arch="all" url="https://postmarketos.org" +license="GPL-3.0-or-later" # multipath-tools: kpartx depends="busybox-extras lddtree cryptsetup multipath-tools device-mapper parted util-linux zip e2fsprogs tar" -source="build_zip.sh - update-binary - disable-warning.c - pmos_chroot - pmos_install - pmos_install_functions - pmos_setpw" -arch="all" -options="!check" -license="GPL3" +source="https://gitlab.com/postmarketos/postmarketos-android-recovery-installer/-/archive/$pkgver/postmarketos-android-recovery-installer-$pkgver.tar.gz" +options="!check" # No tests build() { gcc -static -o disable-warning disable-warning.c } package() { - install -Dm755 "$srcdir/build_zip.sh" \ - "$pkgdir/sbin/build-recovery-zip" - install -Dm644 "$srcdir"/update-binary \ - "$pkgdir/var/lib/postmarketos-android-recovery-installer/META-INF/com/google/android/update-binary" - install -Dm755 "$srcdir"/pmos_chroot \ - "$pkgdir/var/lib/postmarketos-android-recovery-installer/pmos_chroot" - install -Dm755 "$srcdir"/disable-warning \ - "$pkgdir/var/lib/postmarketos-android-recovery-installer/disable-warning" + install -Dm755 build_zip.sh \ + "$pkgdir"/sbin/build-recovery-zip + install -Dm644 update-binary \ + "$pkgdir"/var/lib/postmarketos-android-recovery-installer/META-INF/com/google/android/update-binary + install -Dm755 pmos_chroot \ + "$pkgdir"/var/lib/postmarketos-android-recovery-installer/pmos_chroot + install -Dm755 disable-warning \ + "$pkgdir"/var/lib/postmarketos-android-recovery-installer/disable-warning for file in pmos_install pmos_install_functions pmos_setpw; do - install -Dm755 "$srcdir/$file" \ - "$pkgdir/var/lib/postmarketos-android-recovery-installer/chroot/bin/$file" + install -Dm755 $file \ + "$pkgdir"/var/lib/postmarketos-android-recovery-installer/chroot/bin/$file done } -sha512sums="cd3c4a4bb246d8e2480a9968d3519373ab55126a5b77e975ce53333ed39349194f1afb0dea472d62bdb0ffef1ac93bbadaf3de6362db47ef34c922a1e65c95db build_zip.sh -bb152e86ce420761dd2dca660552131610bb8f39cb7e30c75689aacc7cccddce17a90c998097f1b63b3d68a20f9c2c4823d8d591de156dff827381fe436f3b9d update-binary -3e6388602665367990bdf4c068268160c26a80dda7fa43380755f36f1ca8751f4ec8a584a4cce3b37f41d405a992716c4280077d062e186b4027d6b74db84b3c disable-warning.c -2400d18734d08b3d2f5ec2fe4e802cdcacddea851644b47505eff1aac47302699c171b880bca55dd1704cc9cef9ac26082ac89cee802b6bf57ff8cf649373328 pmos_chroot -ef6377f6c062b9a86eb9dfb2aa2c0049fda20f24ec75865a682a50e4655710a18bd7a470deab527e1dd4c273f9ea6a003ec03fc5748d44b1c4fbfc91baa9e358 pmos_install -1b19d507a9142e537d052037a0c0768f064ad9131ac8019b234178dc15c0590dbc549ccf553b7a7d55e977df269d4dc0567b520c890738cb80184fc8235222aa pmos_install_functions -c6355b6d823dac883e1a352f59a9a2199e2934d78a73df72dc3c4fc14ef93765a15179203d4a8a2ca0d841b63cd4c25c4689b63c8cf4d4da2bcec1f8ff76bff5 pmos_setpw" +sha512sums="595620cb0e074080248177042d0c5edb2ff18f8ad0784667908ec5ad27bd0ef4723f5702554fb8674503d1a3d49b2cb08d4635c25e5f4045b72ad68cd4fd4c86 postmarketos-android-recovery-installer-1.0.0.tar.gz" diff --git a/main/postmarketos-android-recovery-installer/build_zip.sh b/main/postmarketos-android-recovery-installer/build_zip.sh deleted file mode 100644 index 3c72a2775..000000000 --- a/main/postmarketos-android-recovery-installer/build_zip.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh - -# Copyright 2017 Attila Szollosi -# -# This file is part of postmarketos-android-recovery-installer. -# -# postmarketos-android-recovery-installer is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# postmarketos-android-recovery-installer is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with postmarketos-android-recovery-installer. If not, see . - -set -e - -DEVICE="$1" - -# Copy files to the destination specified -# $1: files -# $2: destination -copy_files() -{ - for file in $1; do - filename=$(basename "$file") - install -Dm755 "$file" "$2"/"$filename" - done -} - -check_whether_exists() -{ - if [ ! -e "$1" ] - then - echo "$1 not found" - return 1 - fi -} - -remove_existing_zip() -{ - if [ ! -e "$1" ] - then - return 0 - fi - rm "$1" -} - -BINARIES="/bin/busybox /bin/umount /sbin/cryptsetup /sbin/findfs /sbin/kpartx /sbin/mkfs.ext2 /sbin/mkfs.ext4 \ - /usr/sbin/parted /usr/sbin/partprobe /bin/tar" -# shellcheck disable=SC2086 -LIBRARIES=$(lddtree -l $BINARIES | awk '/lib/ {print}' | sort -u) -ZIP_CONTENTS="chroot META-INF disable-warning pmos_chroot rootfs.tar.gz" -ZIP_FILE="pmos-$DEVICE.zip" - -copy_files "$BINARIES" chroot/bin/ -copy_files "$LIBRARIES" chroot/lib/ -check_whether_exists rootfs.tar.gz -remove_existing_zip "$ZIP_FILE" -# zip command can't take a list of files wrapped in quotes -# shellcheck disable=SC2086 -zip -0 -r "$ZIP_FILE" $ZIP_CONTENTS diff --git a/main/postmarketos-android-recovery-installer/disable-warning.c b/main/postmarketos-android-recovery-installer/disable-warning.c deleted file mode 100644 index f3dc40013..000000000 --- a/main/postmarketos-android-recovery-installer/disable-warning.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2019 Attila Szollosi - * - * This file is part of postmarketos-android-recovery-installer. - * - * postmarketos-android-recovery-installer is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * postmarketos-android-recovery-installer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with postmarketos-android-recovery-installer. If not, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -void close_FDs() -{ - unsigned int fd; - struct dirent *ep; - DIR *dp = opendir("/proc/self/fd"); - if (dp != NULL) { - // first two entries are . and .. - readdir(dp); - readdir(dp); - - while (ep = readdir(dp)) - if (sscanf(ep->d_name, "%u", &fd) != EOF) - close(fd); - closedir(dp); - } else { - // try to close all file descriptors by brute-force - // in case the list of open FDs could not be read - // from the procfs - for (fd = 256; fd >= 0; fd--) - close(fd); - } -} - -// Detach the program from the installation script -void daemonize() -{ - pid_t pid; - - pid = fork(); - if (pid < 0) - exit(1); - if (pid > 0) - exit(0); - - if (setsid() < 0) - exit(1); - - pid = fork(); - if (pid < 0) - exit(1); - if (pid > 0) - exit(0); - - umask(0); - chdir("/"); - close_FDs(); -} - -// Workaround to disable No OS warning in TWRP -// See: https://gitlab.com/postmarketOS/pmbootstrap/issues/1451 -// -// Works by setting the variable tw_backup_system_size to a large -// value, so TWRP's check -// (tw_backup_system_size < tw_min_system) will result in -// false. -// -// TWRP doesn't allow issuing OpenRecoveryScript commands while -// the installation is running, so we have to daemonize the -// process to change the value after the installation script -// exited. -int main() -{ - daemonize(); - - int orsin, orsout; - - char command[1024]; - char result[512]; - - char *commands[] = { "set tw_backup_system_size 999", - "set tw_app_prompt 0" }; - - sleep(4); - - int i; - for (i = 0; i < sizeof(commands) / sizeof(char *); i++) { - if ((orsin = open("/sbin/orsin", O_WRONLY)) == -1) - return 1; - strcpy(command, commands[i]); - write(orsin, command, sizeof(command)); - close(orsin); - - // Have to read FIFO file, because it blocks - // the thread processing the command - // (see man 3 mkfifo) - if ((orsout = open("/sbin/orsout", O_RDONLY)) == -1) - return 1; - read(orsout, result, sizeof(result)); - close(orsout); - - sleep(3); - } - - return 0; -} diff --git a/main/postmarketos-android-recovery-installer/pmos_chroot b/main/postmarketos-android-recovery-installer/pmos_chroot deleted file mode 100644 index d4c7dbcc5..000000000 --- a/main/postmarketos-android-recovery-installer/pmos_chroot +++ /dev/null @@ -1,57 +0,0 @@ -#!/sbin/sh -exec > /tmp/postmarketos/pmos.log 2>&1 -set -ex - -export CHROOT='/tmp/postmarketos/chroot' - -# Extract chroot -unzip -o "$ZIP" chroot/* -d /tmp/postmarketos - -# shellcheck source=/dev/null -. "$CHROOT"/install_options -if [ "$FDE" = 'true' ] -then - # Install password setting script - { - echo '#!/sbin/sh' - echo "chroot $CHROOT /bin/pmos_setpw" - } > /sbin/pmos_setpw - chmod 755 /sbin/pmos_setpw -fi - -# Mount the logfile and pmos.zip so we can access it inside the chroot -for file in "pmos.log" "pmos.zip" -do - { umount "$CHROOT"/"$file" ; rm "$CHROOT"/"$file" ; } || : - touch "$CHROOT"/"$file" -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 -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" -do - mkdir -p "$CHROOT""$mountpoint" - mount --bind "$mountpoint" "$CHROOT""$mountpoint" -done - -# Copy Mediatek /emmc@partitionname symlinks to the chroot -cp -d /emmc@* "$CHROOT" || true - -# Set permissions and start the installation script -chmod 755 "$CHROOT"/bin/* -chmod 755 "$CHROOT"/lib/* -chroot "$CHROOT" /bin/pmos_install diff --git a/main/postmarketos-android-recovery-installer/pmos_install b/main/postmarketos-android-recovery-installer/pmos_install deleted file mode 100755 index 68c9ba4be..000000000 --- a/main/postmarketos-android-recovery-installer/pmos_install +++ /dev/null @@ -1,148 +0,0 @@ -#!/bin/busybox ash -# shellcheck shell=sh - -# Copyright 2017 Attila Szollosi -# -# This file is part of postmarketos-android-recovery-installer. -# -# postmarketos-android-recovery-installer is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# postmarketos-android-recovery-installer is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with postmarketos-android-recovery-installer. If not, see . - -exec >> /pmos.log 2>&1 -set -ex - -/bin/busybox --install /bin - -# shellcheck source=pmos_install_functions -. /bin/pmos_install_functions - -ui_print " " -ui_print " 8 " -ui_print " 888 " -ui_print " 88888 " -ui_print " 8888888 " -ui_print " 888888888 " -ui_print " 88888888888 " -ui_print " 888888888888 " -ui_print " 8 888888888888 " -ui_print " 888 88888888 " -ui_print " 88888888 88888888 " -ui_print " 88888888 88888888 " -ui_print " 88888888 88888888 " -ui_print " 88888888 88888888 " -ui_print " 88888888 888 " -ui_print " 88888888 8 88888 " -ui_print " 88888888 8888888 " -ui_print " 88888888 88888888 " -ui_print " 88888888888 8888888888888888888888 " -ui_print " 8888888888888 8888888888888888888888 " -ui_print " 8888888888888 888888888888888888888888 " -ui_print "8888888888888 88888888888888888888888888" -ui_print " " -ui_print "postmarketOS recovery installer " -ui_print " " - -# Umount and close install partition if mounted/open -mountpoint -q /mnt/pmOS && umount -R /mnt/pmOS -[ -e /dev/mapper/pm_crypt ] && cryptsetup close pm_crypt - -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 - -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 -O "^metadata_csum" -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 -O "^metadata_csum" -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 || { - ui_print "Failed to format/mount ext2 partition." - ui_print "Trying ext4..." - mkfs.ext4 -O "^metadata_csum" -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 == "10000" {print $1}' /mnt/pmOS/etc/passwd)" -cp -a /mnt/pmOS/etc/skel /mnt/pmOS/home/"$user" -chown -R 10000 /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" - else - ui_print "Flashing boot.img..." - dd if=/mnt/pmOS/boot/boot.img-"$FLAVOR" of="$BOOT_PARTITION" - fi -fi - -ui_print "Installation done." - -if [ "$FDE" = "true" ] -then - ui_print "=========================================" - 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!" - ui_print "=========================================" -fi diff --git a/main/postmarketos-android-recovery-installer/pmos_install_functions b/main/postmarketos-android-recovery-installer/pmos_install_functions deleted file mode 100755 index d4af5133a..000000000 --- a/main/postmarketos-android-recovery-installer/pmos_install_functions +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/sh - -# Copyright 2017 Attila Szollosi -# -# This file is part of postmarketos-android-recovery-installer. -# -# postmarketos-android-recovery-installer is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# postmarketos-android-recovery-installer is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with postmarketos-android-recovery-installer. If not, see . - -export PATH="/bin" -export LD_LIBRARY_PATH="/lib" - -# shellcheck source=/dev/null -. /install_options - -# taken from https://github.com/Debuffer-XDA/Gov-Tuner/blob/master/META-INF/com/google/android/update-binary -# Copyright (c) 2016 - 2017 Debuffer -ui_print() { - echo "ui_print $1" > /proc/self/fd/"$OUTFD" - echo "ui_print" > /proc/self/fd/"$OUTFD" -} - -# $1: fstab filename -# $2: partition -get_fstab_device() { - src_column=$(awk '{for (i=1; i<=NF; ++i) { if ($i ~ /^\/dev/) {print i; exit;} }}' /"$1") - [ -z "$src_column" ] && src_column=3 - # Warning: partition name is not escaped - awk -v src="$src_column" \ - '!/^#/ && /(^|\s*)\/'"$2"'/ {print $src; exit;}' /"$1" -} - -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 - - dev=$(findfs PARTLABEL="$SYSTEM_PARTLABEL") || \ - # We need to resolve symlinks, to make set_subpartitions() work. - dev=$(readlink -fn "$(get_fstab_device "$fstab_recovery" "$INSTALL_PARTITION")") - if [ -n "$dev" ] - then - echo "install device found at $dev" - export INSTALL_DEVICE=$dev - else - echo "Couldn't find $INSTALL_PARTITION partition." - return 1 - fi - if [ "$ISOREC" = "true" ] - then - export KERNEL_PARTITION - KERNEL_PARTITION=$(findfs PARTLABEL="$KERNEL_PARTLABEL") - export INITFS_PARTITION - INITFS_PARTITION=$(findfs PARTLABEL="$INITFS_PARTLABEL") - else - dev=$(findfs PARTLABEL="boot") || \ - dev=$(readlink -fn "$(get_fstab_device "$fstab_recovery" boot)") - if [ -n "$dev" ] - then - echo "boot partition found at $dev" - export BOOT_PARTITION=$dev - else - echo "Couldn't find boot partition." - return 1 - fi - fi -} - -partition_install_device() { - for command in "mktable msdos" \ - "mkpart primary ext2 2048s 100M" \ - "mkpart primary 100M 100%" \ - "set 1 boot on" - do - parted -s "$INSTALL_DEVICE" "$command" - done - partprobe - if [ "$INSTALL_PARTITION" != "external_sd" ] - then - kpartx -afs "$INSTALL_DEVICE" - fi - set_subpartitions -} - -set_subpartitions() { - export PMOS_BOOT - PMOS_BOOT=/dev/mapper/"$(basename "$INSTALL_DEVICE")"p1 - export ROOT_PARTITION - ROOT_PARTITION=/dev/mapper/"$(basename "$INSTALL_DEVICE")"p2 -} - -umount_install_partition() { - if [ -n "$(awk '$1 == install_part' install_part="$INSTALL_DEVICE" /proc/mounts)" ] - then - umount "$INSTALL_DEVICE" - else - echo "$INSTALL_DEVICE is not mounted, continuing..." - fi -} diff --git a/main/postmarketos-android-recovery-installer/pmos_setpw b/main/postmarketos-android-recovery-installer/pmos_setpw deleted file mode 100755 index 1c910d449..000000000 --- a/main/postmarketos-android-recovery-installer/pmos_setpw +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -# Copyright 2017 Attila Szollosi -# -# This file is part of postmarketos-android-recovery-installer. -# -# postmarketos-android-recovery-installer is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# postmarketos-android-recovery-installer is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with postmarketos-android-recovery-installer. If not, see . - -exec >> /pmos.log 2>&1 -set -ex - -# shellcheck source=pmos_install_functions -. /bin/pmos_install_functions - -extract_partition_table -set_subpartitions -echo "Set the password of the encrypted rootfs." -cryptsetup luksAddKey -d /lukskey "$ROOT_PARTITION" -# Remove temporary keyfile -cryptsetup luksRemoveKey "$ROOT_PARTITION" /lukskey -echo "Successfully added key to the LUKS device." diff --git a/main/postmarketos-android-recovery-installer/update-binary b/main/postmarketos-android-recovery-installer/update-binary deleted file mode 100644 index 9f8f8559a..000000000 --- a/main/postmarketos-android-recovery-installer/update-binary +++ /dev/null @@ -1,41 +0,0 @@ -#!/sbin/sh - -# Copyright 2017-2019 Attila Szollosi -# -# This file is part of postmarketos-android-recovery-installer. -# -# postmarketos-android-recovery-installer is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# postmarketos-android-recovery-installer is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with postmarketos-android-recovery-installer. If not, see . - -export OUTFD=$2 -export ZIP=$3 - -# Print fail information -fail_info() { - FAIL_MSG="Failed. Check /tmp/postmarketos/pmos.log for more info!" - echo "ui_print $FAIL_MSG" > /proc/self/fd/"$OUTFD" - echo "ui_print" > /proc/self/fd/"$OUTFD" -} - -# Create working directory -mkdir -p /tmp/postmarketos/ - -# Extract and start the installer script -unzip -o "$ZIP" "pmos_chroot" -d /tmp/postmarketos/ -chmod 755 /tmp/postmarketos/pmos_chroot -/tmp/postmarketos/pmos_chroot || { fail_info ; exit 1 ; } - -# Disable No OS warning -unzip -o "$ZIP" "disable-warning" -d /tmp/postmarketos/ -chmod 755 /tmp/postmarketos/disable-warning -/tmp/postmarketos/disable-warning