pmaports/main/postmarketos-android-recovery-installer/update-binary

36 lines
1.3 KiB
Bash

#!/sbin/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 <http://www.gnu.org/licenses/>.
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 ; }