2017-11-16 22:20:57 +00:00
|
|
|
#!/sbin/sh
|
2017-08-24 21:07:36 +00:00
|
|
|
|
2017-11-16 22:20:57 +00:00
|
|
|
# Copyright 2017 Attila Szollosi
|
2017-08-24 21:07:36 +00:00
|
|
|
#
|
|
|
|
# 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/>.
|
|
|
|
|
2017-11-16 22:20:57 +00:00
|
|
|
export OUTFD=$2
|
|
|
|
export ZIP=$3
|
|
|
|
|
2017-08-24 21:07:36 +00:00
|
|
|
# Print fail information
|
|
|
|
fail_info() {
|
2017-12-22 18:39:44 +00:00
|
|
|
FAIL_MSG="Failed. Check /tmp/postmarketos/pmos.log for more info!"
|
2017-11-16 22:20:57 +00:00
|
|
|
echo "ui_print $FAIL_MSG" > /proc/self/fd/"$OUTFD"
|
|
|
|
echo "ui_print" > /proc/self/fd/"$OUTFD"
|
2017-08-24 21:07:36 +00:00
|
|
|
}
|
2017-11-16 22:20:57 +00:00
|
|
|
|
2017-08-24 21:07:36 +00:00
|
|
|
# Create working directory
|
2017-10-18 18:58:58 +00:00
|
|
|
mkdir -p /tmp/postmarketos/
|
2017-11-16 22:20:57 +00:00
|
|
|
|
2017-08-24 21:07:36 +00:00
|
|
|
# Extract and start the installer script
|
2017-11-16 22:20:57 +00:00
|
|
|
unzip -o "$ZIP" "pmos_chroot" -d /tmp/postmarketos/
|
|
|
|
chmod 755 /tmp/postmarketos/pmos_chroot
|
|
|
|
/tmp/postmarketos/pmos_chroot || { fail_info ; exit 1 ; }
|