From ef67595154d1fd0d96ce64d3da82a758974e353a Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 4 May 2020 08:30:43 +0200 Subject: [PATCH 01/12] Use the img from the ZIP --- install-from-bootloader-fp3.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install-from-bootloader-fp3.sh b/install-from-bootloader-fp3.sh index e1739cb..da890a0 100755 --- a/install-from-bootloader-fp3.sh +++ b/install-from-bootloader-fp3.sh @@ -41,6 +41,8 @@ fi fastboot -s $DEVICE_ID -w sleep 1 +unzip -o $ARCHIVE_PATH + fastboot -s $DEVICE_ID flash system $ARCHIVE_PATH/system.img sleep 1 fastboot -s $DEVICE_ID flash boot $ARCHIVE_PATH/boot.img -- GitLab From 82ffd74298e6dfce0250b3604c85bfb47f4b5b7c Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 4 May 2020 08:31:33 +0200 Subject: [PATCH 02/12] Uncheck Allow OEM unlock after flash --- lock-bootloader.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/lock-bootloader.sh b/lock-bootloader.sh index aed5ed9..8f6259b 100755 --- a/lock-bootloader.sh +++ b/lock-bootloader.sh @@ -30,3 +30,4 @@ then fi fastboot -s $DEVICE_ID flashing lock +fastboot -s $DEVICE_ID erase config -- GitLab From 5f443521907b04ca2fe8783ef36f51cfce069ee9 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 4 May 2020 08:39:28 +0200 Subject: [PATCH 03/12] Erase config before device lock --- lock-bootloader.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lock-bootloader.sh b/lock-bootloader.sh index 8f6259b..7608300 100755 --- a/lock-bootloader.sh +++ b/lock-bootloader.sh @@ -29,5 +29,5 @@ then exit 101 fi -fastboot -s $DEVICE_ID flashing lock fastboot -s $DEVICE_ID erase config +fastboot -s $DEVICE_ID flashing lock -- GitLab From 3cddc556b2f09671d69899441605ceb303599c86 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 4 May 2020 08:56:53 +0200 Subject: [PATCH 04/12] Fix unzip --- install-from-bootloader-fp3.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-from-bootloader-fp3.sh b/install-from-bootloader-fp3.sh index da890a0..65d91ad 100755 --- a/install-from-bootloader-fp3.sh +++ b/install-from-bootloader-fp3.sh @@ -41,7 +41,7 @@ fi fastboot -s $DEVICE_ID -w sleep 1 -unzip -o $ARCHIVE_PATH +unzip -d $ARCHIVE_PATH $ARCHIVE_PATH/IMG-e-latest-FP3.img fastboot -s $DEVICE_ID flash system $ARCHIVE_PATH/system.img sleep 1 -- GitLab From 0db8f3c55febcf300736023a628177824048b0a5 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 4 May 2020 09:13:10 +0200 Subject: [PATCH 05/12] Fix ZIP --- install-from-bootloader-fp3.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-from-bootloader-fp3.sh b/install-from-bootloader-fp3.sh index 65d91ad..1e73f2d 100755 --- a/install-from-bootloader-fp3.sh +++ b/install-from-bootloader-fp3.sh @@ -41,7 +41,7 @@ fi fastboot -s $DEVICE_ID -w sleep 1 -unzip -d $ARCHIVE_PATH $ARCHIVE_PATH/IMG-e-latest-FP3.img +unzip -d $ARCHIVE_PATH $ARCHIVE_PATH/IMG-e-latest-FP3.zip fastboot -s $DEVICE_ID flash system $ARCHIVE_PATH/system.img sleep 1 -- GitLab From 6371e2fc39b41770495d356daeccfd5ee2875095 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 4 May 2020 09:16:35 +0200 Subject: [PATCH 06/12] Unzip only once --- get-from-ecloud-with-unzip.sh | 43 ++++++++++++++++++++++++++++++++++ install-from-bootloader-fp3.sh | 2 -- 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 get-from-ecloud-with-unzip.sh diff --git a/get-from-ecloud-with-unzip.sh b/get-from-ecloud-with-unzip.sh new file mode 100644 index 0000000..cd89e92 --- /dev/null +++ b/get-from-ecloud-with-unzip.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# Copyright (C) 2019 ECORP SAS - Author: Romain Hunault +# +# This program 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. +# +# This program 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 this program. If not, see . + +# Parameter +# $1: ARCHIVE_URL +# $2: FOLDER (will be created if doesn't exist) + +# Exit status +# - 0 : archive downloaded +# - 1 : Generic error code (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html) +# - 2 : Parse error—for instance, when parsing command-line options, the ‘.wgetrc’ or ‘.netrc’... (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html) +# - 3 : File I/O error (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html) +# - 4 : Network failure (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html) +# - 5 : SSL verification failure (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html) +# - 6 : Username/password authentication failure (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html) +# - 7 : Protocol errors (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html) +# - 8 : Server issued an error response (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html) +# - 10: No internet connection +# - 11: Invalid file downloaded +# - 101 : ARCHIVE_URL missing +# - 102 : FOLDER missing + +ARCHIVE_URL=$1 +FOLDER=$2 +ARCHIVE_NAME=$(basename $ARCHIVE_URL) + +get-from-ecloud.sh $ARCHIVE_URL $FOLDER + +unzip -d $FOLDER $FOLDER/$ARCHIVE_NAME diff --git a/install-from-bootloader-fp3.sh b/install-from-bootloader-fp3.sh index 1e73f2d..e1739cb 100755 --- a/install-from-bootloader-fp3.sh +++ b/install-from-bootloader-fp3.sh @@ -41,8 +41,6 @@ fi fastboot -s $DEVICE_ID -w sleep 1 -unzip -d $ARCHIVE_PATH $ARCHIVE_PATH/IMG-e-latest-FP3.zip - fastboot -s $DEVICE_ID flash system $ARCHIVE_PATH/system.img sleep 1 fastboot -s $DEVICE_ID flash boot $ARCHIVE_PATH/boot.img -- GitLab From 1dfbc23727012d7f50a1a9c838820eacd34f63c7 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 4 May 2020 09:23:55 +0200 Subject: [PATCH 07/12] Really unzip once --- get-from-ecloud-with-unzip.sh | 9 ++++++++- get-from-ecloud.sh | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/get-from-ecloud-with-unzip.sh b/get-from-ecloud-with-unzip.sh index cd89e92..1229a2b 100644 --- a/get-from-ecloud-with-unzip.sh +++ b/get-from-ecloud-with-unzip.sh @@ -37,7 +37,14 @@ ARCHIVE_URL=$1 FOLDER=$2 ARCHIVE_NAME=$(basename $ARCHIVE_URL) +ARCHIVE_UNZIPPED=$FOLDER/$ARCHIVE_NAME.unzipped -get-from-ecloud.sh $ARCHIVE_URL $FOLDER +scripts/get-from-ecloud.sh $ARCHIVE_URL $FOLDER + +if [ -f $ARCHIVE_UNZIPPED ] +then + exit 0 +fi unzip -d $FOLDER $FOLDER/$ARCHIVE_NAME +touch $ARCHIVE_UNZIPPED diff --git a/get-from-ecloud.sh b/get-from-ecloud.sh index 514e432..ead884a 100755 --- a/get-from-ecloud.sh +++ b/get-from-ecloud.sh @@ -36,6 +36,8 @@ ARCHIVE_URL=$1 FOLDER=$2 +ARCHIVE_NAME=$(basename $ARCHIVE_URL) +ARCHIVE_UNZIPPED=$FOLDER/$ARCHIVE_NAME.unzipped if ! curl -s -IL https://gitlab.e.foundation | grep -q "^HTTP\/2 200" @@ -66,6 +68,7 @@ then exit 0 fi +rm -f ${ARCHIVE_UNZIPPED} wget -O ${FOLDER}/${FILENAME} ${ARCHIVE_URL} sha256sum -c ${FOLDER}/${FILENAME}.sha256sum -- GitLab From bfc02167159ae838f7f0c367714b96235c3bf760 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 4 May 2020 09:31:47 +0200 Subject: [PATCH 08/12] Fix permissions --- get-from-ecloud-with-unzip.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 get-from-ecloud-with-unzip.sh diff --git a/get-from-ecloud-with-unzip.sh b/get-from-ecloud-with-unzip.sh old mode 100644 new mode 100755 -- GitLab From 34fbff703b710f8b031f4bbc3b2f79aec00e33fd Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 4 May 2020 09:52:38 +0200 Subject: [PATCH 09/12] Only unzip necessary files --- get-from-ecloud-with-unzip.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/get-from-ecloud-with-unzip.sh b/get-from-ecloud-with-unzip.sh index 1229a2b..fe94d25 100755 --- a/get-from-ecloud-with-unzip.sh +++ b/get-from-ecloud-with-unzip.sh @@ -46,5 +46,5 @@ then exit 0 fi -unzip -d $FOLDER $FOLDER/$ARCHIVE_NAME +unzip -f -d $FOLDER $FOLDER/$ARCHIVE_NAME touch $ARCHIVE_UNZIPPED -- GitLab From fed6a00900a0bdf6723c93fef78ea6fee4ae050f Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 4 May 2020 10:21:47 +0200 Subject: [PATCH 10/12] refactor --- get-from-ecloud.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/get-from-ecloud.sh b/get-from-ecloud.sh index ead884a..6d661ce 100755 --- a/get-from-ecloud.sh +++ b/get-from-ecloud.sh @@ -36,8 +36,8 @@ ARCHIVE_URL=$1 FOLDER=$2 -ARCHIVE_NAME=$(basename $ARCHIVE_URL) -ARCHIVE_UNZIPPED=$FOLDER/$ARCHIVE_NAME.unzipped +FILENAME=$(basename ${ARCHIVE_URL}) +ARCHIVE_UNZIPPED=$FOLDER/$FILENAME.unzipped if ! curl -s -IL https://gitlab.e.foundation | grep -q "^HTTP\/2 200" @@ -56,7 +56,6 @@ then fi mkdir -p ${FOLDER} -FILENAME=$(basename ${ARCHIVE_URL}) wget -O ${FOLDER}/${FILENAME}.sha256sum ${ARCHIVE_URL}.sha256sum FOLDER_ESCAPED=$(echo ${FOLDER} | sed 's/\/$//' | sed 's/\//\\\//g') sed -i 's/\(.*\) \(.*\)/\1 '${FOLDER_ESCAPED}'\/\2/' ${FOLDER}/${FILENAME}.sha256sum -- GitLab From b22e13bd65e8f46629bff83d7070519b479e9576 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 4 May 2020 10:46:34 +0200 Subject: [PATCH 11/12] overwrite existing files --- get-from-ecloud-with-unzip.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/get-from-ecloud-with-unzip.sh b/get-from-ecloud-with-unzip.sh index fe94d25..fad843d 100755 --- a/get-from-ecloud-with-unzip.sh +++ b/get-from-ecloud-with-unzip.sh @@ -46,5 +46,5 @@ then exit 0 fi -unzip -f -d $FOLDER $FOLDER/$ARCHIVE_NAME +unzip -o -d $FOLDER $FOLDER/$ARCHIVE_NAME touch $ARCHIVE_UNZIPPED -- GitLab From 548d60e6a6bdd107502f4d5ee8408b330f171623 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Mon, 4 May 2020 11:16:20 +0200 Subject: [PATCH 12/12] set copyright --- get-from-ecloud-with-unzip.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/get-from-ecloud-with-unzip.sh b/get-from-ecloud-with-unzip.sh index fad843d..21eeb34 100755 --- a/get-from-ecloud-with-unzip.sh +++ b/get-from-ecloud-with-unzip.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (C) 2019 ECORP SAS - Author: Romain Hunault +# Copyright (C) 2020 ECORP SAS - Author: Romain Hunault # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -- GitLab