From 7a92fc03d4ea120fae33c945296b77cac73f14fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Attila=20Sz=C3=B6ll=C5=91si?= Date: Fri, 22 Dec 2017 19:39:44 +0100 Subject: [PATCH] [recovery-installer] Log into one logfile instead of two (#1031) --- .../APKBUILD | 10 +++++----- .../pmos_chroot | 18 +++++++++--------- .../pmos_install | 2 +- .../pmos_setpw | 3 ++- .../update-binary | 2 +- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/main/postmarketos-android-recovery-installer/APKBUILD b/main/postmarketos-android-recovery-installer/APKBUILD index 1422d304c..cfc5dd450 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.1 +pkgver=0.1.2 pkgrel=0 pkgdesc="TWRP compatible postmarketOS installer script" url="https://github.com/postmarketOS" @@ -27,8 +27,8 @@ package() { done } sha512sums="f02e67d26f4f977c5098ff6eee51b53ec962982c41b8b33c1a206c218c483bd20f782c06622cf8d724a9a1cdb5b9cc1b76d3bf32e562c9b558747ca3f3408ffd build_zip.sh -7c396f4ae50f71d8c5ecf0528d1841639da75934dc8bd160311969e0d461dfc2f851eb6aa0373ec5cced11430ebc961f55a79863badb68d70fcad43725f9396b update-binary -823e87cd6fcfb2954eda042522f189ffb36c739107b4ab4d82bd5707e097faab08375973c7d569336edeafdc177f5d35a9a051ab109794b6313548713ed3ac80 pmos_chroot -caafd0e6345e2082e4a2dc7169b1dedf11fd4423e72a2a2d33a6056cf2ecbed2ffa5c995491cbc0a62518623d3d2830d754c28cc4dc68db2c4a9224492409168 pmos_install +6390fc1b1c7dc8e917bb675d2e59e479782ac7754e97c4781866360ff704afe2d04f173a0ac74e3129db45328fab4b6b77a8717ee2e17c6ff79febadaa8ea034 update-binary +f19c15fd99cc806d088ddf9c954111e48635f971ca500beeaa4893eb25d19fe0601210a57e9ab1a1dc7a6d79a3154765e696ee3329bbb1875b6d6df36a7b3fb3 pmos_chroot +46956667e215bf29940b532bf91220167858e3c8dd4bda977ce6ae1829143317784c303247e97a527322b2d4cadaae3d0d73f6c42319872d39398e34be941a82 pmos_install 36d8ca5ae092f8de0a9e2658581d3d1f83483b5076446aebaf5e1ab377e49615c31b81c00a23bc74d569de12a73977291c9a73e4f19b2faa694d981010c3eb35 pmos_install_functions -558680cfeac4ab5e191cffa0f875e762b923fa281ba65cbe64da525710f82e6f7707cb9e346ee53fa50bb19afc567c331b005cd9c20d00ec3869819cadd992a4 pmos_setpw" +c6355b6d823dac883e1a352f59a9a2199e2934d78a73df72dc3c4fc14ef93765a15179203d4a8a2ca0d841b63cd4c25c4689b63c8cf4d4da2bcec1f8ff76bff5 pmos_setpw" diff --git a/main/postmarketos-android-recovery-installer/pmos_chroot b/main/postmarketos-android-recovery-installer/pmos_chroot index 095235983..b71815311 100644 --- a/main/postmarketos-android-recovery-installer/pmos_chroot +++ b/main/postmarketos-android-recovery-installer/pmos_chroot @@ -1,5 +1,5 @@ #!/sbin/sh -exec > /tmp/postmarketos/pmos_chroot.log 2>&1 +exec > /tmp/postmarketos/pmos.log 2>&1 set -ex export CHROOT='/tmp/postmarketos/chroot' @@ -19,9 +19,13 @@ then chmod 755 /sbin/pmos_setpw fi -# Mount pmos.zip so we can access it inside the chroot -{ umount "$CHROOT"/pmos.zip ; rm "$CHROOT"/pmos.zip ; } || : -touch "$CHROOT"/pmos.zip +# 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 # Create copy of fstab file provided by the recovery @@ -38,8 +42,4 @@ done # Set permissions and start the installation script chmod 755 "$CHROOT"/bin/* chmod 755 "$CHROOT"/lib/* -chroot "$CHROOT" /bin/pmos_install || { - echo 'Installation script failed.' - echo 'Check /tmp/postmarketos/chroot/pmos.log for more information.' - exit 1 -} +chroot "$CHROOT" /bin/pmos_install diff --git a/main/postmarketos-android-recovery-installer/pmos_install b/main/postmarketos-android-recovery-installer/pmos_install index 0a4edd497..f6ed4423e 100755 --- a/main/postmarketos-android-recovery-installer/pmos_install +++ b/main/postmarketos-android-recovery-installer/pmos_install @@ -18,7 +18,7 @@ # 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 +exec >> /pmos.log 2>&1 set -ex /bin/busybox --install /bin diff --git a/main/postmarketos-android-recovery-installer/pmos_setpw b/main/postmarketos-android-recovery-installer/pmos_setpw index 35571b34f..1c910d449 100755 --- a/main/postmarketos-android-recovery-installer/pmos_setpw +++ b/main/postmarketos-android-recovery-installer/pmos_setpw @@ -17,7 +17,8 @@ # You should have received a copy of the GNU General Public License # along with postmarketos-android-recovery-installer. If not, see . -set -e +exec >> /pmos.log 2>&1 +set -ex # shellcheck source=pmos_install_functions . /bin/pmos_install_functions diff --git a/main/postmarketos-android-recovery-installer/update-binary b/main/postmarketos-android-recovery-installer/update-binary index 7dcae0ff2..07eacfdae 100644 --- a/main/postmarketos-android-recovery-installer/update-binary +++ b/main/postmarketos-android-recovery-installer/update-binary @@ -22,7 +22,7 @@ export ZIP=$3 # Print fail information fail_info() { - FAIL_MSG="Failed. Check /tmp/postmarketos/pmos_chroot.log for more 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" }