From 85d85c7132b2c06edf4d661d4403172c4754b737 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Wed, 31 Jul 2019 22:37:40 +0000 Subject: [PATCH 1/2] Update get-from-ecloud.sh Deleted get-twrp.sh, get-e.sh files --- get-e.sh => get-from-ecloud.sh | 32 +++++++------- get-twrp.sh | 78 ---------------------------------- 2 files changed, 16 insertions(+), 94 deletions(-) rename get-e.sh => get-from-ecloud.sh (77%) delete mode 100755 get-twrp.sh diff --git a/get-e.sh b/get-from-ecloud.sh similarity index 77% rename from get-e.sh rename to get-from-ecloud.sh index d9f4e35..fa7102d 100755 --- a/get-e.sh +++ b/get-from-ecloud.sh @@ -16,8 +16,8 @@ # along with this program. If not, see . # Parameter -# $1: E_ARCHIVE_URL -# $2: E_FOLDER (will be created if doesn't exist) +# $1: ARCHIVE_URL +# $2: FOLDER (will be created if doesn't exist) # Exit status # - 0 : /e/ downloaded @@ -31,43 +31,43 @@ # - 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 : E_ARCHIVE_URL missing -# - 102 : E_FOLDER missing +# - 101 : ARCHIVE_URL missing +# - 102 : FOLDER missing -E_ARCHIVE_URL=$1 -E_FOLDER=$2 +ARCHIVE_URL=$1 +FOLDER=$2 if ! ping -c 1 gitlab.e.foundation 2>&1 >/dev/null then exit 10 fi -if [ -z ${E_FOLDER} ] +if [ -z ${FOLDER} ] then exit 101 fi -if [ -z ${E_ARCHIVE_URL} ] +if [ -z ${ARCHIVE_URL} ] then exit 102 fi -mkdir -p ${E_FOLDER} -FILENAME=$(basename ${E_ARCHIVE_URL}) -wget -O ${E_FOLDER}/${FILENAME}.sha256sum ${E_ARCHIVE_URL}.sha256sum -E_FOLDER_ESCAPED=$(echo ${E_FOLDER} | sed 's/\/$//' | sed 's/\//\\\//g') -sed -i 's/\(.*\) \(.*\)/\1 '${E_FOLDER_ESCAPED}'\/\2/' ${E_FOLDER}/${FILENAME}.sha256sum +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 -sha256sum -c ${E_FOLDER}/${FILENAME}.sha256sum +sha256sum -c ${FOLDER}/${FILENAME}.sha256sum SUM_OK=$? if [ ${SUM_OK} = 0 ] then exit 0 fi -wget -O ${E_FOLDER}/${FILENAME} ${E_ARCHIVE_URL} +wget -O ${FOLDER}/${FILENAME} ${ARCHIVE_URL} -sha256sum -c ${E_FOLDER}/${FILENAME}.sha256sum +sha256sum -c ${FOLDER}/${FILENAME}.sha256sum SUM_OK=$? if [ ${SUM_OK} != 0 ] then diff --git a/get-twrp.sh b/get-twrp.sh deleted file mode 100755 index fa5318b..0000000 --- a/get-twrp.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/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: TWRP_IMG_URL -# $2: TWRP_FOLDER (TWRP_IMG/TWRP_IMG_URL) - -# Exit status -# - 0 : TWRP 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 : TWRP_IMG_URL missing -# - 102 : TWRP_FOLDER missing - -TWRP_IMG_URL=$1 -TWRP_FOLDER=$2 - -if ! ping -c 1 gitlab.e.foundation 2>&1 >/dev/null -then - exit 10 -fi - -if [ -z ${TWRP_IMG_URL} ] -then - exit 101 -fi - -if [ -z ${TWRP_FOLDER} ] -then - exit 102 -fi - -mkdir -p ${TWRP_FOLDER} -FILENAME=$(basename ${TWRP_IMG_URL}) -wget -O ${TWRP_FOLDER}/${FILENAME}.sha256 ${TWRP_IMG_URL}.sha256 -TWRP_FOLDER_ESCAPED=$(echo ${TWRP_FOLDER} | sed 's/\/$//' | sed 's/\//\\\//g') -sed -i 's/\(.*\) \(.*\)/\1 '${TWRP_FOLDER_ESCAPED}'\/\2/' ${TWRP_FOLDER}/${FILENAME}.sha256 - -sha256sum -c ${TWRP_FOLDER}/${FILENAME}.sha256 -SUM_OK=$? - -if [ ${SUM_OK} = 0 ] -then - exit 0 -fi - -wget -O ${TWRP_FOLDER}/${FILENAME} ${TWRP_IMG_URL} --referer='https://dl.twrp.me/BUTTS' - -sha256sum -c ${TWRP_FOLDER}/${FILENAME}.sha256 -SUM_OK=$? - -if [ ${SUM_OK} != 0 ] -then - rm ${FILENAME} - exit 11 -fi -- GitLab From 4abf7553f844d60aaa11161c31ada2c7f250aff9 Mon Sep 17 00:00:00 2001 From: Romain Hunault Date: Wed, 31 Jul 2019 22:43:39 +0000 Subject: [PATCH 2/2] Update documentation --- get-from-ecloud.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/get-from-ecloud.sh b/get-from-ecloud.sh index fa7102d..75644bf 100755 --- a/get-from-ecloud.sh +++ b/get-from-ecloud.sh @@ -20,7 +20,7 @@ # $2: FOLDER (will be created if doesn't exist) # Exit status -# - 0 : /e/ downloaded +# - 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) -- GitLab