From df374aecb6c6c816de5b3a29c798dfad614668a1 Mon Sep 17 00:00:00 2001 From: Frank PREEL Date: Wed, 4 May 2022 17:58:47 +0200 Subject: [PATCH 01/22] Functional S9 S9plus Macos + Win11 --- flash-scripts/linux/install-e-recovery.sh | 63 ++++++++ .../linux/install-from-e-recovery.sh | 59 +++++++ flash-scripts/linux/wait-download.sh | 5 +- flash-scripts/linux/wait-e-reboot.sh | 52 ++++++ .../linux/wait-e-recovery-sideload.sh | 44 +++++ flash-scripts/windows/install-e-recovery.bat | 48 ++++++ .../windows/install-from-e-recovery.bat | 50 ++++++ flash-scripts/windows/wait-e-reboot.bat | 40 +++++ .../windows/wait-e-recovery-sideload.bat | 41 +++++ .../ecorp/easy/installer/AppConstants.java | 12 +- .../ecorp/easy/installer/EasyInstaller.java | 62 ++++++- .../installer/tasks/CommandExecutionTask.java | 46 ++++-- .../easy/installer/tasks/DownloadTask.java | 57 ++++--- .../instructions/imageName.properties | 10 +- .../resources/lang/translation.properties | 18 +++ .../resources/lang/translation_de.properties | 14 +- src/main/resources/yaml/star2lte_flash.yml | 149 +++-------------- src/main/resources/yaml/star2lte_fs.yml | 18 +-- src/main/resources/yaml/starlte_flash.yml | 151 +++--------------- src/main/resources/yaml/starlte_fs.yml | 18 +-- 20 files changed, 621 insertions(+), 336 deletions(-) create mode 100644 flash-scripts/linux/install-e-recovery.sh create mode 100644 flash-scripts/linux/install-from-e-recovery.sh create mode 100644 flash-scripts/linux/wait-e-reboot.sh create mode 100644 flash-scripts/linux/wait-e-recovery-sideload.sh create mode 100644 flash-scripts/windows/install-e-recovery.bat create mode 100644 flash-scripts/windows/install-from-e-recovery.bat create mode 100644 flash-scripts/windows/wait-e-reboot.bat create mode 100644 flash-scripts/windows/wait-e-recovery-sideload.bat diff --git a/flash-scripts/linux/install-e-recovery.sh b/flash-scripts/linux/install-e-recovery.sh new file mode 100644 index 00000000..91c9a0b5 --- /dev/null +++ b/flash-scripts/linux/install-e-recovery.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +# Copyright (C) 2022 ECORP SAS - Author: Frank Preel +# +# 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: FASTBOOT_PATH +# $2: E_IMAGE_PATH need twrp path +# Exit status +# - 0 : Recovery installed +# - 101 : FASTBOOT_PATH missing +# - 102 : E_IMAGE_PATH missing + +FASTBOOT_PATH=$1 +E_IMAGE_PATH=$2 + +if [ -z "$FASTBOOT_PATH" ] +then + echo "Fastboot path is empty" + exit 101 +fi + +if [ -z "$E_IMAGE_PATH" ] +then + echo "E Image path is empty" + exit 102 +fi + +#"$FASTBOOT_CMD" reboot bootloader +#sleep 10 + +# Build fastboot and adb commands +FASTBOOT_CMD=${FASTBOOT_PATH}"fastboot" +ADB_CMD=${FASTBOOT_PATH}"adb" + +# Wipe user data +if ! "$FASTBOOT_CMD" erase userdata ; +then + exit 11 +fi + +echo "user data wiped" +sleep 1 + +if ! "$FASTBOOT_CMD" erase metadata ; +then + exit 12 +fi + + +"$FASTBOOT_CMD" flash boot ${E_IMAGE_PATH} diff --git a/flash-scripts/linux/install-from-e-recovery.sh b/flash-scripts/linux/install-from-e-recovery.sh new file mode 100644 index 00000000..bc6a1603 --- /dev/null +++ b/flash-scripts/linux/install-from-e-recovery.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +# Copyright (C) 2022 ECORP SAS - Author: Frank Preel +# +# 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: DEVICE_ID device id +# $2: ARCHIVE_PATH path to archive +# $3: fastboot folder path + + +# Exit status +# - 0 : device flashed +# - 1 : generic error + +DEVICE_ID=$1 +ARCHIVE_FILE=$2 +FASTBOOT_FOLDER_PATH=$3 + +# Check serial number has been provided +if [ -z "$DEVICE_ID" ] +then + exit 101 +fi + +# check path to rom has been provided +if [ -z "$ARCHIVE_FILE" ] +then + exit 102 +fi + +#check path to adb/fasboot has been provided +if [ -z "$FASTBOOT_FOLDER_PATH" ] +then + exit 103 +fi + +# Build fastboot and adb commands +ADB_CMD=${FASTBOOT_FOLDER_PATH}"adb" + +"$ADB_CMD" sideload ${ARCHIVE_FILE} +ret=${?} + +echo "adb sideload retuns = "${ret} +# ret = 0 if adb command is fine, 1 on error + +exit ${ret} diff --git a/flash-scripts/linux/wait-download.sh b/flash-scripts/linux/wait-download.sh index 8ff8483d..d4315ad0 100755 --- a/flash-scripts/linux/wait-download.sh +++ b/flash-scripts/linux/wait-download.sh @@ -2,6 +2,7 @@ # Copyright (C) 2019 ECORP SAS - Author: Romain Hunault # Copyright (C) 2020 ECORP SAS - Author: Vincent Bourgmayer +# Copyright (C) 2022 ECORP SAS - Author: Frank Preel # # 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 @@ -32,8 +33,8 @@ echo "Heimdall path: $HEIMDALL_PATH" while [ "$($HEIMDALL_PATH detect > /dev/null 2>&1; echo $?)" = 1 ] do - sleep 1s + sleep 1 done -sleep 5s +sleep 5 echo "Download mode detected" \ No newline at end of file diff --git a/flash-scripts/linux/wait-e-reboot.sh b/flash-scripts/linux/wait-e-reboot.sh new file mode 100644 index 00000000..20917988 --- /dev/null +++ b/flash-scripts/linux/wait-e-reboot.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +# Copyright (C) 2022 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: DEVICE_ID Device we are waiting for reboot +# $2: ADB_FOLDER_PATH: the path where runnable adb is stored + +# Exit status +# - 0 : success +# - 1 : Error +# - 10 : DEVICE_ID is missing +# - 101 : device with DEVICE_ID is not detected + +DEVICE_ID=$1 +ADB_FOLDER_PATH=$2 + +ADB_PATH=${ADB_FOLDER_PATH}"adb" + +echo "ADB path: $ADB_PATH" + +if [ -z "$DEVICE_ID" ] +then + exit 10 +fi + + +#1 On check that device is in recovery mode +if ! "$ADB_PATH" -s "$DEVICE_ID" get-state 2>&1 | grep "recovery" +then + echo "Device not detected in recovery" + exit 101 +fi + +#Then we wait that it left this state +while "$ADB_PATH" -s "$DEVICE_ID" get-state 2> /dev/null +do + sleep 1 +done \ No newline at end of file diff --git a/flash-scripts/linux/wait-e-recovery-sideload.sh b/flash-scripts/linux/wait-e-recovery-sideload.sh new file mode 100644 index 00000000..f0be174e --- /dev/null +++ b/flash-scripts/linux/wait-e-recovery-sideload.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# Copyright (C) 2022 ECORP SAS - Author: Frank Preel +# +# 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: DEVICE_ID ID of the device to wait +# $2: ADB_FOLDER_PATH: the path where runnable adb is stored + +# Exit status +# - 0 : success +# - 101 : adb wait sideload failed + +DEVICE_ID=$1 +ADB_FOLDER_PATH=$2 + +if [ -z "$DEVICE_ID" ] +then + exit 101 +fi + +ADB_PATH=${ADB_FOLDER_PATH}"adb" + +echo "waiting for recovery" +if "$ADB_PATH" -s "$DEVICE_ID" wait-for-sideload +then + echo "device found in recovery" + exit 0 +else + echo "device not detected in recovery" + exit 101 +fi diff --git a/flash-scripts/windows/install-e-recovery.bat b/flash-scripts/windows/install-e-recovery.bat new file mode 100644 index 00000000..e83c0f78 --- /dev/null +++ b/flash-scripts/windows/install-e-recovery.bat @@ -0,0 +1,48 @@ +#!/bin/bash + +# Copyright (C) 2022 ECORP SAS - Author: Frank Preel +# +# 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: FASTBOOT_PATH +# $2: E_IMAGE_PATH need twrp path +# Exit status +# - 0 : Recovery installed +# - 101 : FASTBOOT_PATH missing +# - 102 : E_IMAGE_PATH missing + +@echo off + +SET FASTBOOT_PATH=%~1 +SET %~1E_IMAGE_PATH=%~2 +IF "-z" "%FASTBOOT_PATH%" ( + echo "Fastboot path is empty" + exit "101" +) +IF "-z" "%E_IMAGE_PATH%" ( + echo "E Image path is empty" + exit "102" +) +SET FASTBOOT_CMD=%FASTBOOT_PATH%"fastboot" +SET %FASTBOOT_PATH%ADB_CMD=%FASTBOOT_PATH%"adb" +IF ! "%FASTBOOT_CMD%" "erase" "userdata" ( + exit "11" +) +echo "user data wiped" +sleep "1" +IF ! "%FASTBOOT_CMD%" "erase" "metadata" ( + exit "12" +) +"$FASTBOOT_CMD" "flash" "boot" "%E_IMAGE_PATH%" diff --git a/flash-scripts/windows/install-from-e-recovery.bat b/flash-scripts/windows/install-from-e-recovery.bat new file mode 100644 index 00000000..5b4f5d96 --- /dev/null +++ b/flash-scripts/windows/install-from-e-recovery.bat @@ -0,0 +1,50 @@ +@echo off + +:: Copyright (C) 2022 ECORP SAS - Author: Frank Preel + +:: 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: DEVICE_ID device id +:: $2: ARCHIVE_PATH path to archive +:: $3: fastboot folder path + + +:: Exit status +:: - 0 : device flashed +:: - 1 : generic error + +SET DEVICE_ID=%~1 +SET ARCHIVE_FILE=%~2 +SET FASTBOOT_FOLDER_PATH=%~3 + +::IF "-z" "%DEVICE_ID%" ( +:: exit "101" +::) +::IF "-z" "%ARCHIVE_FILE%" ( +:: exit "102" +::) +::IF "-z" "%FASTBOOT_FOLDER_PATH%" ( +:: exit "103" +::) + +SET ADB_CMD="%FASTBOOT_FOLDER_PATH%adb" +"%ADB_CMD%" "sideload" "%ARCHIVE_FILE%" +if not errorlevel 1 ( + echo "Sideload OK" + exit /b 0 +) ELSE ( + echo "Sideload fails" + exit /b 1 +) diff --git a/flash-scripts/windows/wait-e-reboot.bat b/flash-scripts/windows/wait-e-reboot.bat new file mode 100644 index 00000000..eddccb41 --- /dev/null +++ b/flash-scripts/windows/wait-e-reboot.bat @@ -0,0 +1,40 @@ +@echo off + +:: Copyright (C) 2022 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: DEVICE_ID Device we are waiting for reboot +:: $2: ADB_FOLDER_PATH: the path where runnable adb is stored + +:: Exit status +:: - 0 : success +:: - 1 : Error +:: - 10 : DEVICE_ID is missing +:: - 101 : device with DEVICE_ID is not detected + + +SET DEVICE_ID=%~1 +SET ADB_FOLDER_PATH=%~2 +SET ADB_PATH="%ADB_FOLDER_PATH% adb" +echo "ADB path: %ADB_PATH%" +::IF "-z" "%DEVICE_ID%" ( +:: exit "10" +::) +::IF REM UNKNOWN: {"type":"Pipeline","commands":[{"type":"Command","name":{"text":"!","type":"Word"},"suffix":[{"text":"\"$ADB_PATH\"","expansion":[{"loc":{"start":1,"end":9},"parameter":"ADB_PATH","type":"ParameterExpansion"}],"type":"Word"},{"text":"-s","type":"Word"},{"text":"\"$DEVICE_ID\"","expansion":[{"loc":{"start":1,"end":10},"parameter":"DEVICE_ID","type":"ParameterExpansion"}],"type":"Word"},{"text":"get-state","type":"Word"},{"type":"Redirect","op":{"text":">&","type":"greatand"},"file":{"text":"1","type":"Word"},"numberIo":{"text":"2","type":"io_number"}}]},{"type":"Command","name":{"text":"grep","type":"Word"},"suffix":[{"text":"recovery","type":"Word"}]}]} ( +:: echo "Device not detected in recovery" +:: exit "101" +::) +::REM UNKNOWN: {"type":"While","clause":{"type":"CompoundList","commands":[{"type":"Command","name":{"text":"\"$ADB_PATH\"","expansion":[{"loc":{"start":1,"end":9},"parameter":"ADB_PATH","type":"ParameterExpansion"}],"type":"Word"},"suffix":[{"text":"-s","type":"Word"},{"text":"\"$DEVICE_ID\"","expansion":[{"loc":{"start":1,"end":10},"parameter":"DEVICE_ID","type":"ParameterExpansion"}],"type":"Word"},{"text":"get-state","type":"Word"},{"type":"Redirect","op":{"text":">","type":"great"},"file":{"text":"/dev/null","type":"Word"},"numberIo":{"text":"2","type":"io_number"}}]}]},"do":{"type":"CompoundList","commands":[{"type":"Command","name":{"text":"sleep","type":"Word"},"suffix":[{"text":"1","type":"Word"}]}]}} \ No newline at end of file diff --git a/flash-scripts/windows/wait-e-recovery-sideload.bat b/flash-scripts/windows/wait-e-recovery-sideload.bat new file mode 100644 index 00000000..84786429 --- /dev/null +++ b/flash-scripts/windows/wait-e-recovery-sideload.bat @@ -0,0 +1,41 @@ +@echo off + +:: Copyright (C) 2022 ECORP SAS - Author: Frank Preel + +:: 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: DEVICE_ID ID of the device to wait +:: $2: ADB_FOLDER_PATH: the path where runnable adb is stored + +:: Exit status +:: - 0 : success +:: - 101 : adb wait sideload failed + +SET DEVICE_ID=%~1 +SET ADB_FOLDER_PATH=%~2 + +SET ADB_PATH=%ADB_FOLDER_PATH%adb +echo "waiting for recovery" + +echo %ADB_PATH% -s %DEVICE_ID% wait-for-sideload + +%ADB_PATH% -s %DEVICE_ID% wait-for-sideload +if not errorlevel 1 ( + echo "device found in recovery" + exit /b 0 +) ELSE ( + echo "device not detected in recovery" + exit /b 101 +) diff --git a/src/main/java/ecorp/easy/installer/AppConstants.java b/src/main/java/ecorp/easy/installer/AppConstants.java index 2929c0d9..d21872d2 100644 --- a/src/main/java/ecorp/easy/installer/AppConstants.java +++ b/src/main/java/ecorp/easy/installer/AppConstants.java @@ -174,10 +174,14 @@ public abstract class AppConstants { * @return */ public static String getRootPath(){ - if(System.getProperty("IDE", null) != null) - return Paths.get("").toAbsolutePath().toString()+Separator; - else - return JavaHome+Separator+"bin"+Separator; + String rootPath = JavaHome+Separator+"bin"+Separator; + if(System.getProperty("IDE", null) != null) { + rootPath = Paths.get("").toAbsolutePath().toString()+Separator; + } + if (rootPath.indexOf(" ")>0){ //K1ZFP set quote to full path + rootPath = "\"" + rootPath + "\""; + } + return rootPath; } /** diff --git a/src/main/java/ecorp/easy/installer/EasyInstaller.java b/src/main/java/ecorp/easy/installer/EasyInstaller.java index c7cd361e..b25cf59e 100644 --- a/src/main/java/ecorp/easy/installer/EasyInstaller.java +++ b/src/main/java/ecorp/easy/installer/EasyInstaller.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 - ECORP SAS + * Copyright 2019-2022 - ECORP SAS * * 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 @@ -18,24 +18,30 @@ package ecorp.easy.installer; import static ecorp.easy.installer.AppConstants.JavaHome; import static ecorp.easy.installer.AppConstants.OsName; -import ecorp.easy.installer.controllers.MainWindowController; + +import java.net.URL; import java.nio.file.Paths; import java.util.Locale; import java.util.ResourceBundle; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import ecorp.easy.installer.controllers.MainWindowController; import javafx.application.Application; -import static javafx.application.Application.launch; import javafx.fxml.FXMLLoader; +import javafx.fxml.Initializable; import javafx.scene.Parent; import javafx.scene.Scene; +import javafx.scene.control.MenuBar; +import javafx.scene.control.MenuItem; import javafx.scene.text.Font; import javafx.stage.Screen; import javafx.stage.Stage; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * this is the entry point of the software - * @author Vincent Bourgmayer + * @authors Vincent Bourgmayer, Frank Preel */ public class EasyInstaller extends Application { private final static Logger logger = LoggerFactory.getLogger(EasyInstaller.class); @@ -50,7 +56,22 @@ public class EasyInstaller extends Application { */ @Override public void start(Stage stage) throws Exception { - logger.debug("\nOS name = {}\nJava Home = {}\nCurrent working dir = {}\nADB folder path = {}", OsName, JavaHome, Paths.get("").toAbsolutePath().toString(), AppConstants.getADBFolderPath()); + + /* DEBUG FP + TODO Remove + Command command = new Command("/Users/frankpreel/Documents/ESPRI/git_repos/Easy Installer/bin/adb/adb"); + command.addParameter("1", "devices"); + command.addParameter("2", "-l"); + + CommandExecutionTask task = new CommandExecutionTask(command); + + task.run(); //I feel like it lacks something... but it work in test + + CommandExecutionResult result = task.get(); + */ + + + logger.debug("\nOS name = {}\nJava Home = {}\nCurrent working dir = {}\nADB folder path = {}", OsName, JavaHome, Paths.get("").toAbsolutePath().toString(), AppConstants.getADBFolderPath()); Locale currentLocale= Locale.getDefault(); i18n = ResourceBundle.getBundle("lang.translation", currentLocale); @@ -58,14 +79,39 @@ public class EasyInstaller extends Application { logger.debug("language = {}, country = {} ", currentLocale.getLanguage(), currentLocale.getCountry()); //Load main view - FXMLLoader loader = new FXMLLoader(getClass().getResource(FXML_PATH+"mainWindow.fxml")); + URL r = getClass().getResource(FXML_PATH+"mainWindow.fxml"); + FXMLLoader loader = new FXMLLoader(r); loader.setResources(i18n); Parent root = loader.load() ; controller = loader.getController(); + + //Defines some properties Scene scene = new Scene(root); + stage.setTitle(i18n.getString("appTitle")+AppConstants.APP_VERSION); + + + + + + /* + try { + MenuBar mb = (MenuBar) root.getChildrenUnmodifiable().get(1); + if( System.getProperty("os.name","UNKNOWN").equals("Mac OS X")) { + logger.debug("Detected Mac OS."); + mb.setUseSystemMenuBar(true); + + + + } else { + mb.setVisible(false); + } + } catch (Exception e) { + logger.debug("Error - cannot find menu bar"); + }*/ + stage.setScene(scene); stage.setResizable(true); diff --git a/src/main/java/ecorp/easy/installer/tasks/CommandExecutionTask.java b/src/main/java/ecorp/easy/installer/tasks/CommandExecutionTask.java index 992b2683..5c0671fe 100644 --- a/src/main/java/ecorp/easy/installer/tasks/CommandExecutionTask.java +++ b/src/main/java/ecorp/easy/installer/tasks/CommandExecutionTask.java @@ -23,7 +23,10 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; +import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import javafx.concurrent.Task; @@ -151,7 +154,7 @@ public class CommandExecutionTask extends Task { * @return ProcessBuilder instance containing the full command to run */ protected ProcessBuilder getProcessBuilder(){ - final ProcessBuilder pb = new ProcessBuilder(getFullCmd().split(" ")); + final ProcessBuilder pb = new ProcessBuilder(getFullCmd()); pb.redirectErrorStream(true); return pb; } @@ -161,34 +164,47 @@ public class CommandExecutionTask extends Task { * the full command to be run * @return String the full command */ - protected String getFullCmd(){ - final StringBuilder sb = new StringBuilder(); + private final String[] getFullCmd(){ + ArrayList rtn = new ArrayList(10); // Prepare base of the command String cmdBase = command.getCommandBase(); + final StringBuilder _cmdBase = new StringBuilder(); if(AppConstants.isWindowsOs()){ - cmdBase = "cmd.exe /c \"\""+cmdBase+"\""; - } - sb.append(cmdBase); + rtn.add("cmd.exe"); + rtn.add("/c"); + _cmdBase.append("\""); + _cmdBase.append("\""); + _cmdBase.append(cmdBase.replaceAll("\"", "")); + _cmdBase.append("\""); + //rtn.add("\""+_cmdBase+"\""); + } else + rtn.add(cmdBase); updateParameters(); //Add the parameters - if(command.getParameters() != null && !command.getParameters().isEmpty()){ - command.getParameters().values().forEach((param) -> { - if(AppConstants.isWindowsOs()){ - param = "\""+param+"\""; - } - sb.append(" ").append(param); + final Map parameters = command.getParameters(); + if(parameters != null && !parameters.isEmpty()){ + parameters.values().forEach((param) -> { + if(AppConstants.isWindowsOs()){ + _cmdBase.append(" \""); + _cmdBase.append(param.replaceAll("\"", "")); + _cmdBase.append("\""); + } else { + rtn.add(param); + } + }); } // Close the full command if(AppConstants.isWindowsOs()){ - sb.append("\""); + _cmdBase.append("\""); + rtn.add(_cmdBase.toString()); } - logger.debug("getFullCmd(), full command = {}", sb.toString()); - return sb.toString(); + logger.debug("getFullCmd(), full command = {}", rtn.toString()); + return Arrays.copyOf(rtn.toArray(), rtn.size(), String[].class); } diff --git a/src/main/java/ecorp/easy/installer/tasks/DownloadTask.java b/src/main/java/ecorp/easy/installer/tasks/DownloadTask.java index eaa4a5e8..235dc2f1 100644 --- a/src/main/java/ecorp/easy/installer/tasks/DownloadTask.java +++ b/src/main/java/ecorp/easy/installer/tasks/DownloadTask.java @@ -56,16 +56,25 @@ public class DownloadTask extends Task{ /** * Constant size */ - private static final long[] CST_SIZE = {1024, 1024*1024, 1024*1024*1024, 1024*1024*1024*1024}; + private static final long[] CST_SIZE = {1, 1024, 1024*1024, 1024*1024*1024, 1024*1024*1024*1024}; /** * Constants units */ - private static final String[] CST_UNITS = {"KB", "MB", "GB", "TB"}; + private static final String[] CST_UNITS = {"B", "KB", "MB", "GB", "TB"}; + + + private static final DecimalFormat[] CST_FORMAT = { + new DecimalFormat("#0"), + new DecimalFormat("##0"), + new DecimalFormat("#,##0"), + new DecimalFormat("#,##0.00"), + new DecimalFormat("#,##0.000") + }; final private ResourceBundle i18n; final private String targetUrl; final private String fileName; - + /** * COnstruction of the download task * @param targetUrl the web path to the resource @@ -219,9 +228,10 @@ public class DownloadTask extends Task{ logger.debug("full file size = {}", fullFileSize); //Update UI - final String formattedFileSize = formatFileSize(fullFileSize); //used for UI + final int unitIndex = getDownloadUnit(fullFileSize); + final String formattedFileSize = formatFileSize(fullFileSize, unitIndex); //used for UI updateProgress(-1, fullFileSize); - updateMessage(formatFileSize(previouslyDownloadedAmount)+" / "+formattedFileSize ); + updateMessage(formatFileSize(previouslyDownloadedAmount, unitIndex)+" / "+formattedFileSize ); boolean downloaded = false; @@ -236,13 +246,14 @@ public class DownloadTask extends Task{ timeoutThread.start(); long downloadAmount = previouslyDownloadedAmount; + while ( rbc.isOpen() && !isCancelled() && ! downloaded ){ final long precedentAmount = downloadAmount; - downloadAmount += fos.getChannel().transferFrom(rbc,downloadAmount,1 << 18); + downloadAmount += fos.getChannel().transferFrom(rbc,downloadAmount,1 << 20); //~1MB if(precedentAmount == downloadAmount){ //it means nothing had been downloaded - logger.warn("precedent amount = downloaded amount"); + logger.warn("precedent amount = downloaded amount"); downloaded = false; rbc.close(); connect.disconnect(); @@ -250,7 +261,7 @@ public class DownloadTask extends Task{ timeoutRunnable.amountIncreased(); //delay the timeout updateProgress(downloadAmount, fullFileSize); - updateMessage( formatFileSize(downloadAmount)+" / "+formattedFileSize); + updateMessage( formatFileSize(downloadAmount, unitIndex)+" / "+formattedFileSize); fos.flush(); downloaded = (downloadAmount == fullFileSize); @@ -265,20 +276,30 @@ public class DownloadTask extends Task{ } /** - * Format file size to use correct size name (mb, gb, ...) - * @todo definitively should be in the UI - * @param value the file size formatted witht the good size category - * @return + * Get the download file unit index (mb, gb, ...) (1,2...) + * @param value the file size + * @return the index */ - public String formatFileSize(final double value){ - double size; - for (int i = 0; i < 3; i++) { + private final int getDownloadUnit(final double value){ + double size = 0; + for (int i = 0; i < CST_SIZE.length; i++) { size=value/CST_SIZE[i]; if (size <= 1024) { - return new DecimalFormat("#,##0.#").format(size) + " " + CST_UNITS[i] ; - } + return i; + } } - return null; + return -1; + } + + /** + * Format file size to use correct size name (mb, gb, ...) + * @todo definitively should be in the UI + * @param value the file size + * @param unitIndex info about unit + * @return + */ + private final String formatFileSize(final double value, final int unitIndex){ + return CST_FORMAT[unitIndex].format(value/CST_SIZE[unitIndex]) + " " + CST_UNITS[unitIndex] ; } diff --git a/src/main/resources/instructions/imageName.properties b/src/main/resources/instructions/imageName.properties index f1f30bed..29085357 100644 --- a/src/main/resources/instructions/imageName.properties +++ b/src/main/resources/instructions/imageName.properties @@ -33,4 +33,12 @@ install_instr_swipeForOk=TWRP_toEXT3_swipe.png install_instr_backX2=TWRP_tapback.png install_instr_resizeFs=TWRP_resizeFS.png #install_instr_tapRebootSystem -install_instr_doNotInstall=TWRP_doNotInstall.png \ No newline at end of file +install_instr_doNotInstall=TWRP_doNotInstall.png +install_instr_startRec_pressPowerBixbyVolUp_e_reco=galaxyS9_Recovery_mode_400px.png +install_instr_e_recovery_factory_reset=install_instr_e_recovery_factory_reset.png +install_instr_e_recovery_factory_reset_format_data=install_instr_e_recovery_factory_reset_format_data.png +install_instr_e_recovery_factory_reset_format_data_validate=install_instr_e_recovery_factory_reset_format_data_validate.png +install_instr_e_recovery_back=install_instr_e_recovery_back.png +install_instr_e_recovery_apply_update=install_instr_e_recovery_apply_update.png +install_instr_e_recovery_apply_update_from_adb=install_instr_e_recovery_apply_update_from_adb.png +install_instr_e_recovery_reboot=install_instr_e_recovery_reboot.png \ No newline at end of file diff --git a/src/main/resources/lang/translation.properties b/src/main/resources/lang/translation.properties index bef4c3ad..6f326869 100644 --- a/src/main/resources/lang/translation.properties +++ b/src/main/resources/lang/translation.properties @@ -170,6 +170,7 @@ install_instr_enableOEMUnlock=enable 'OEM unlock' install_instr_acceptFactoryReset= You'll have to keep pressing "Power" & "Bixby" & "Volume Down" until you reach "Download mode" once your device is off. When you're ready, accept Factory Reset. install_instr_startDl_pressPowerBixbyVolDown= Keep pressing simultaneously "Power" & "Bixby" & "Volume Down" until a blue screen appear to access Download Mode install_instr_startRec_pressPowerBixbyVolUp= Keep pressing simultaneously "Power" & "Bixby" & "Volume Up" until 'teamwin' screen appears +install_instr_startRec_pressPowerBixbyVolUp_e_reco= Keep pressing simultaneously "Power" & "Bixby" & "Volume Up" until 'E Revovery' screen appears install_instr_leaveDl_pressPowerBixbyVolDown= Keep pressing simultaneously "Power" & "Bixby" & "Volume Down" until device turns off install_instr_update_stockrom= Update your device to the latest version install_instr_connectTowifi= Connect your device to Wi-fi @@ -184,8 +185,23 @@ install_instr_waitInstallStartAuto = Please wait, installation will start automa install_instr_onceDeviceRebootThenContinue = Your device will reboot automatically. Once it's done, you can click on continue install_instr_rebootingOnBootloader=Your device will reboot automatically on bootloader mode install_instr_pressVolUpToAcceptOEMUnlocking = Press "Volume up" to accept OEM unlocking +install_instr_pressVolDownToAcceptOEMUnlocking = Press "Volume down" to accept OEM unlocking install_instr_unlockingOem= Easy-installer is unlocking OEM install_instr_waitFastbootmodeDetected = The next step will start automatically once your device in fastboot mode will be detected. If it takes longer than 30 seconds, please check our FAQ by clicking on the "Need help" button +install_instr_choose_e_recovery_select= On the device by using Up or Down volume keys, select "Recovery Mode" option. +install_instr_choose_e_recovery_validate= Validate with Power +install_instr_choose_e_recovery_validate_wait_for_result= After a while the device will reboot in recovery mode." +install_instr_e_recovery_apply_update= Select "Apply update" +install_instr_e_recovery_apply_update_from_adb= "Select "Apply update from ADB" +install_instr_e_recovery_apply_update_from_adb_wait_for_result= The installation is in progress, be patient +install_instr_e_recovery_factory_reset= Select "Factory reset" +install_instr_e_recovery_factory_reset_format_data= Select "Format data/factory reset" +install_instr_e_recovery_factory_reset_cache= Select "Format cache partiton" +install_instr_e_recovery_factory_reset_system= Select "Format system partiton" +install_instr_e_recovery_factory_reset_format_data_validate= Accept the warning by selecting "Format data" +install_instr_e_recovery_factory_reset_validate= Accept the warning by selecting "Yes" +install_instr_e_recovery_back= Select "Back", on the top left corner +install_instr_e_recovery_reboot= Select "Reboot system now" install_instr_openSettingsThenDevOptions = Open "Settings" then "Developer options" install_instr_disableAutoUpdateSystem= Disable "Auto update system" @@ -209,6 +225,7 @@ script_error_installRecovery_101=Can't install TWRP script_error_waitRecovery_1 = Can't mount the "system" folder script_error_waitRecovery_101 = No device's serial number provided script_error_waitRecovery_102 = Error while waiting for device to start in recovery +script_error_waitSideload_101 = Error while waiting for device to start in sideload script_error_installFromRecovery_1 = Can't process the installation script_error_installFromRecovery_2 = Can't push the required file on the device script_error_installFromRecovery_3 = An error happened during the installation @@ -219,6 +236,7 @@ script_error_installFromFastboot_2 = Flashing of one partition failed script_error_installFromFastboot_3 = Could not lock the bootloader script_error_installFromFastboot_101 = No /e/ install archive provided script_error_installFromFastboot_102 = Could not unpack /e/ install archive +script_error_installFromSideload = Could not install /e/ from eRecovery script_error_waitReboot_10 = No device's serial number provided script_error_waitReboot_101 = Can't run instruction on the device script_error_waitRebootFromFastboot_101 = Can't run instruction on the device diff --git a/src/main/resources/lang/translation_de.properties b/src/main/resources/lang/translation_de.properties index a52faeaa..f9b52762 100644 --- a/src/main/resources/lang/translation_de.properties +++ b/src/main/resources/lang/translation_de.properties @@ -249,7 +249,7 @@ stepTitle_beforeInstallation=Vor der Installation stepTitle_enableOemUnlock="OEM-Entsperrung" aktivieren stepTitle_installOS=/e/-Installation stepTitle_resizeDataPartition=Größe der Datenpartition ändern -all_lbl_tryAgain=Nochmal versuchen +all_lbl_tryAgain=Versuche es nochmals # new translation askAccount_string={{mustardpepper}} detect_lbl_redisplayAllowUsbDebugingMsg=Wenn du keine solche Nachricht siehst: stecke dein Gerät aus und wieder ein\nDie Nachricht wird wieder erscheinen @@ -296,15 +296,3 @@ script_error_cantFlashBoot=Fehler beim Flashen der Boot-Partition script_error_cantWipeData=Fehler beim Löschen der Daten script_error_cantUnpackSources=Fehler beim Entpacker der /e/-Quellen script_error_cantRebootBootloader=Fehler beim Starten (booten) in den Bootloader -script_error_cantFlashLogo=Das Flashen der Logo-Partition ist fehlgeschlagen -script_error_cantFlashMd1img=Das Flashen der md1img-Partition ist fehlgeschlagen -script_error_cantFlashSpmfw=Das Flashen der spmfw-Partition ist fehlgeschlagen -script_error_cantFlashLk=Das Flashen der lk-Partition ist fehlgeschlagen -script_error_cantFlashLk2=Das Flashen der lk2-Partition ist fehlgeschlagen -script_error_cantFlashSspm_2=Das Flashen der sspm_2-Partition ist fehlgeschlagen -script_error_cantFlashTee1=Das Flashen der tee1-Partition ist fehlgeschlagen -script_error_cantFlashTee2=Das Flashen der tee2-Partition ist fehlgeschlagen -script_error_cantFlashDtbo=Das Flashen der dtbo-Partition ist fehlgeschlagen -script_error_cantFlashMd1dsp=Das Flashen der md1dsp-Partition ist fehlgeschlagen -script_error_cantFlashSspm_1=Das Flashen der sspm_1-Partition ist fehlgeschlagen -script_error_cantFlashPreloader=Das Flashen der Preloader-Partition ist fehlgeschlagen diff --git a/src/main/resources/yaml/star2lte_flash.yml b/src/main/resources/yaml/star2lte_flash.yml index 585e873c..605c739b 100644 --- a/src/main/resources/yaml/star2lte_flash.yml +++ b/src/main/resources/yaml/star2lte_flash.yml @@ -1,4 +1,4 @@ -## Copyright 2021 - ECORP SAS +## Copyright 202-2022 - ECORP SAS ## 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 @@ -12,9 +12,9 @@ ## You should have received a copy of the GNU General Public License ## along with this program. If not, see . -## Author: Vincent Bourgmayer +## Author: Vincent Bourgmayer, Frank Preel --- -stepsCount: 11 +stepsCount: 7 steps: f0: type: custom @@ -73,151 +73,50 @@ steps: titleKey: stepTitle5On7 instructions: - install_instr_leaveDl_pressPowerBixbyVolDown - - install_instr_startRec_pressPowerBixbyVolUp - - install_instr_keepReadOnly + - install_instr_startRec_pressPowerBixbyVolUp_e_reco + - install_instr_e_recovery_factory_reset + - install_instr_e_recovery_factory_reset_format_data + - install_instr_e_recovery_factory_reset_format_data_validate + - install_instr_e_recovery_back + - install_instr_e_recovery_apply_update + - install_instr_e_recovery_apply_update_from_adb titleKeyIconName: icon-download.png - script: wait-recovery + script: wait-e-recovery-sideload parameters: device_id: ${DEVICE_ID} adb_folder_path: ${ADB_FOLDER_PATH} okCodes: 0: ~ koCodes: - 1: script_error_waitRecovery_1 - 101: script_error_waitRecovery_101 - 102: script_error_waitRecovery_102 + 101: script_error_waitSideload_101 f4: - type: custom-executable + type: load stepNumber: 5 nextStepKey: f5 - titleKey: stepTitle5On7 + titleKey: install_instr_eosInstall instructions: - - install_instr_tapWipe - - install_instr_tapFormatData - - install_instr_writeYes - - install_instr_validate - - install_instr_backX3 - - install_instr_tapReboot - - install_instr_tapRebootRecovery - - install_instr_doNotInstall - titleKeyIconName: icon-download.png - script: wait-reboot + - install_instr_eosInstall + averageTime: 150 + script: install-from-e-recovery parameters: device_id: ${DEVICE_ID} + archive_path: ${ARCHIVE_PATH} adb_folder_path: ${ADB_FOLDER_PATH} okCodes: 0: ~ koCodes: - 1: script_error_unknown - 10: script_error_waitReboot_10 - 101: script_error_waitReboot_101 + 1: script_error_installFromSideload f5: - type: custom-executable + type: askAccount stepNumber: 6 nextStepKey: f6 - titleKey: stepTitle5On7 - instructions: - - install_instr_swipeTwrp - titleKeyIconName: icon-download.png - script: wait-recovery - parameters: - device_id: ${DEVICE_ID} - adb_folder_path: ${ADB_FOLDER_PATH} - okCodes: - 0: ~ - koCodes: - 1: script_error_waitRecovery_1 - 101: script_error_waitRecovery_101 - 102: script_error_waitRecovery_102 f6: - type: load + type: custom stepNumber: 7 - nextStepKey: f7 - titleKey: install_instr_patchInstall - instructions: - - install_instr_patchInstall - averageTime: 55 - script: install-from-recovery - parameters: - device_id: ${DEVICE_ID} - archive_path: ${SOURCES_PATH}no-verity-opt-encrypt-samsung-1.0.zip - adb_folder_path: ${ADB_FOLDER_PATH} - okCodes: - 0: ~ - koCodes: - 1: script_error_installFromRecovery_1 - 2: script_error_installFromRecovery_2 - 3: script_error_installFromRecovery_3 - 101: script_error_installFromRecovery_101 - 102: script_error_installFromRecovery_102 - f7: - type: load - stepNumber: 8 - nextStepKey: f8 - titleKey: install_instr_vendorInstall - instructions: - - install_instr_vendorInstall - averageTime: 65 - script: install-from-recovery - parameters: - device_id: ${DEVICE_ID} - archive_path: ${SOURCES_PATH}VENDOR-27_ARI9.zip - adb_folder_path: ${ADB_FOLDER_PATH} - okCodes: - 0: ~ - koCodes: - 1: script_error_installFromRecovery_1 - 2: script_error_installFromRecovery_2 - 3: script_error_installFromRecovery_3 - 101: script_error_installFromRecovery_101 - 102: script_error_installFromRecovery_102 - f8: - type: load - stepNumber: 9 - nextStepKey: f9 - titleKey: install_instr_eosInstall - instructions: - - install_instr_eosInstall - averageTime: 440 - script: install-from-recovery - parameters: - device_id: ${DEVICE_ID} - archive_path: ${ARCHIVE_PATH} - adb_folder_path: ${ADB_FOLDER_PATH} - okCodes: - 0: ~ - koCodes: - 1: script_error_installFromRecovery_1 - 2: script_error_installFromRecovery_2 - 3: script_error_installFromRecovery_3 - 101: script_error_installFromRecovery_101 - 102: script_error_installFromRecovery_102 - f9: - type: askAccount - stepNumber: 10 - nextStepKey: f10 - f10: - type: custom-executable - stepNumber: 11 nextStepKey: end titleKey: stepTitle7On7 instructions: - - install_instr_tapWipe - - install_instr_tapAdvancedWipe - - install_instr_tickData - - install_instr_tapRepairChangeFs - - install_instr_resizeFs - - install_instr_swipeForOk - - install_instr_tapRebootSystem - - install_instr_doNotInstall + - install_instr_e_recovery_back + - install_instr_e_recovery_reboot + - eAccount_lbl_alreadyAccount titleKeyIconName: icon-download.png - script: wait-reboot - parameters: - device_id: ${DEVICE_ID} - adb_folder_path: ${ADB_FOLDER_PATH} - okCodes: - 0: ~ - koCodes: - 1: script_error_unknown - 10: script_error_waitReboot_10 - 101: script_error_waitReboot_101 diff --git a/src/main/resources/yaml/star2lte_fs.yml b/src/main/resources/yaml/star2lte_fs.yml index e036cd17..85c12ffd 100644 --- a/src/main/resources/yaml/star2lte_fs.yml +++ b/src/main/resources/yaml/star2lte_fs.yml @@ -1,4 +1,4 @@ -## Copyright 2019-2021 - ECORP SAS +## Copyright 2019-2022 - ECORP SAS ## 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 @@ -12,18 +12,12 @@ ## You should have received a copy of the GNU General Public License ## along with this program. If not, see . -## Author: Vincent Bourgmayer +## Authors: Vincent Bourgmayer, Frank Preel --- sources: rom: - url: https://images.ecloud.global/stable/star2lte/e-latest-star2lte.zip - filePath: e-latest-star2lte.zip + url: https://images.ecloud.global/stable/star2lte/e-0.23-q-20220401175185-stable-star2lte.zip + filePath: e-0.23-q-20220401175185-stable-star2lte.zip twrp: - url: https://images.ecloud.global/stable/twrp/star2lte/twrp-3.2.3-0-star2lte.img - filePath: twrp-3.2.3-0-star2lte.img - f2: - url: https://images.ecloud.global/stable/vendors/VENDOR-27_ARI9.zip - filePath: VENDOR-27_ARI9.zip - f3: - url: https://images.ecloud.global/stable/patch/no-verity-opt-encrypt-samsung-1.0.zip - filePath: no-verity-opt-encrypt-samsung-1.0.zip \ No newline at end of file + url: https://images.ecloud.global/stable/star2lte/recovery-e-0.23-q-20220401175185-stable-star2lte.img + filePath: recovery-e-0.23-q-20220401175185-stable-star2lte.img diff --git a/src/main/resources/yaml/starlte_flash.yml b/src/main/resources/yaml/starlte_flash.yml index 585e873c..97c30be1 100644 --- a/src/main/resources/yaml/starlte_flash.yml +++ b/src/main/resources/yaml/starlte_flash.yml @@ -1,4 +1,4 @@ -## Copyright 2021 - ECORP SAS +## Copyright 202-2022 - ECORP SAS ## 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 @@ -12,9 +12,9 @@ ## You should have received a copy of the GNU General Public License ## along with this program. If not, see . -## Author: Vincent Bourgmayer +## Author: Vincent Bourgmayer, Frank Preel --- -stepsCount: 11 +stepsCount: 7 steps: f0: type: custom @@ -73,151 +73,50 @@ steps: titleKey: stepTitle5On7 instructions: - install_instr_leaveDl_pressPowerBixbyVolDown - - install_instr_startRec_pressPowerBixbyVolUp - - install_instr_keepReadOnly + - install_instr_startRec_pressPowerBixbyVolUp_e_reco + - install_instr_e_recovery_factory_reset + - install_instr_e_recovery_factory_reset_format_data + - install_instr_e_recovery_factory_reset_format_data_validate + - install_instr_e_recovery_back + - install_instr_e_recovery_apply_update + - install_instr_e_recovery_apply_update_from_adb titleKeyIconName: icon-download.png - script: wait-recovery + script: wait-e-recovery-sideload parameters: device_id: ${DEVICE_ID} adb_folder_path: ${ADB_FOLDER_PATH} okCodes: 0: ~ koCodes: - 1: script_error_waitRecovery_1 - 101: script_error_waitRecovery_101 - 102: script_error_waitRecovery_102 + 101: script_error_waitSideload_101 f4: - type: custom-executable + type: load stepNumber: 5 nextStepKey: f5 - titleKey: stepTitle5On7 + titleKey: install_instr_eosInstall instructions: - - install_instr_tapWipe - - install_instr_tapFormatData - - install_instr_writeYes - - install_instr_validate - - install_instr_backX3 - - install_instr_tapReboot - - install_instr_tapRebootRecovery - - install_instr_doNotInstall - titleKeyIconName: icon-download.png - script: wait-reboot + - install_instr_eosInstall + averageTime: 150 + script: install-from-e-recovery parameters: device_id: ${DEVICE_ID} + archive_path: ${ARCHIVE_PATH} adb_folder_path: ${ADB_FOLDER_PATH} okCodes: 0: ~ koCodes: - 1: script_error_unknown - 10: script_error_waitReboot_10 - 101: script_error_waitReboot_101 + 1: script_error_installFromSideload f5: - type: custom-executable + type: askAccount stepNumber: 6 nextStepKey: f6 - titleKey: stepTitle5On7 - instructions: - - install_instr_swipeTwrp - titleKeyIconName: icon-download.png - script: wait-recovery - parameters: - device_id: ${DEVICE_ID} - adb_folder_path: ${ADB_FOLDER_PATH} - okCodes: - 0: ~ - koCodes: - 1: script_error_waitRecovery_1 - 101: script_error_waitRecovery_101 - 102: script_error_waitRecovery_102 f6: - type: load + type: custom stepNumber: 7 - nextStepKey: f7 - titleKey: install_instr_patchInstall - instructions: - - install_instr_patchInstall - averageTime: 55 - script: install-from-recovery - parameters: - device_id: ${DEVICE_ID} - archive_path: ${SOURCES_PATH}no-verity-opt-encrypt-samsung-1.0.zip - adb_folder_path: ${ADB_FOLDER_PATH} - okCodes: - 0: ~ - koCodes: - 1: script_error_installFromRecovery_1 - 2: script_error_installFromRecovery_2 - 3: script_error_installFromRecovery_3 - 101: script_error_installFromRecovery_101 - 102: script_error_installFromRecovery_102 - f7: - type: load - stepNumber: 8 - nextStepKey: f8 - titleKey: install_instr_vendorInstall - instructions: - - install_instr_vendorInstall - averageTime: 65 - script: install-from-recovery - parameters: - device_id: ${DEVICE_ID} - archive_path: ${SOURCES_PATH}VENDOR-27_ARI9.zip - adb_folder_path: ${ADB_FOLDER_PATH} - okCodes: - 0: ~ - koCodes: - 1: script_error_installFromRecovery_1 - 2: script_error_installFromRecovery_2 - 3: script_error_installFromRecovery_3 - 101: script_error_installFromRecovery_101 - 102: script_error_installFromRecovery_102 - f8: - type: load - stepNumber: 9 - nextStepKey: f9 - titleKey: install_instr_eosInstall - instructions: - - install_instr_eosInstall - averageTime: 440 - script: install-from-recovery - parameters: - device_id: ${DEVICE_ID} - archive_path: ${ARCHIVE_PATH} - adb_folder_path: ${ADB_FOLDER_PATH} - okCodes: - 0: ~ - koCodes: - 1: script_error_installFromRecovery_1 - 2: script_error_installFromRecovery_2 - 3: script_error_installFromRecovery_3 - 101: script_error_installFromRecovery_101 - 102: script_error_installFromRecovery_102 - f9: - type: askAccount - stepNumber: 10 - nextStepKey: f10 - f10: - type: custom-executable - stepNumber: 11 nextStepKey: end titleKey: stepTitle7On7 instructions: - - install_instr_tapWipe - - install_instr_tapAdvancedWipe - - install_instr_tickData - - install_instr_tapRepairChangeFs - - install_instr_resizeFs - - install_instr_swipeForOk - - install_instr_tapRebootSystem - - install_instr_doNotInstall - titleKeyIconName: icon-download.png - script: wait-reboot - parameters: - device_id: ${DEVICE_ID} - adb_folder_path: ${ADB_FOLDER_PATH} - okCodes: - 0: ~ - koCodes: - 1: script_error_unknown - 10: script_error_waitReboot_10 - 101: script_error_waitReboot_101 + - install_instr_e_recovery_back + - install_instr_e_recovery_reboot + - eAccount_lbl_alreadyAccount + titleKeyIconName: icon-download.png \ No newline at end of file diff --git a/src/main/resources/yaml/starlte_fs.yml b/src/main/resources/yaml/starlte_fs.yml index d9a906d9..935a04d1 100644 --- a/src/main/resources/yaml/starlte_fs.yml +++ b/src/main/resources/yaml/starlte_fs.yml @@ -1,4 +1,4 @@ -## Copyright 2019-2021 - ECORP SAS +## Copyright 2019-2022 - ECORP SAS ## 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 @@ -12,18 +12,12 @@ ## You should have received a copy of the GNU General Public License ## along with this program. If not, see . -## Author: Vincent Bourgmayer +## Authors: Vincent Bourgmayer, Frank Preel --- sources: rom: - url: https://images.ecloud.global/stable/starlte/e-latest-starlte.zip - filePath: e-latest-starlte.zip + url: https://images.ecloud.global/stable/starlte/e-0.23-q-20220401175185-stable-starlte.zip + filePath: e-0.23-q-20220401175185-stable-starlte.zip twrp: - url: https://images.ecloud.global/stable/twrp/starlte/twrp-3.2.3-0-starlte.img - filePath: twrp-3.2.3-0-starlte.img - f2: - url: https://images.ecloud.global/stable/vendors/VENDOR-27_ARI9.zip - filePath: VENDOR-27_ARI9.zip - f3: - url: https://images.ecloud.global/stable/patch/no-verity-opt-encrypt-samsung-1.0.zip - filePath: no-verity-opt-encrypt-samsung-1.0.zip + url: https://images.ecloud.global/stable/starlte/recovery-e-0.23-q-20220401175185-stable-starlte.img + filePath: recovery-e-0.23-q-20220401175185-stable-starlte.img -- GitLab From 0cb32b12a79b252336e01cca63d1d3001665610c Mon Sep 17 00:00:00 2001 From: frankpreel Date: Fri, 6 May 2022 06:58:39 +0200 Subject: [PATCH 02/22] Begin emrald development --- .../easy/installer/helpers/DeviceHelper.java | 1 + src/main/resources/yaml/emerald_flash.yml | 127 ++++++++++++++++++ src/main/resources/yaml/emerald_fs.yml | 20 +++ 3 files changed, 148 insertions(+) create mode 100644 src/main/resources/yaml/emerald_flash.yml create mode 100644 src/main/resources/yaml/emerald_fs.yml diff --git a/src/main/java/ecorp/easy/installer/helpers/DeviceHelper.java b/src/main/java/ecorp/easy/installer/helpers/DeviceHelper.java index 52193b9d..b5724e00 100644 --- a/src/main/java/ecorp/easy/installer/helpers/DeviceHelper.java +++ b/src/main/java/ecorp/easy/installer/helpers/DeviceHelper.java @@ -50,6 +50,7 @@ public class DeviceHelper { put("FP3", "0008"); put("GS290", "0009"); put("Teracube_2e", "0011"); + put("emerald", "0012"); //Teracube A10 }}; /** diff --git a/src/main/resources/yaml/emerald_flash.yml b/src/main/resources/yaml/emerald_flash.yml new file mode 100644 index 00000000..a28d9b5b --- /dev/null +++ b/src/main/resources/yaml/emerald_flash.yml @@ -0,0 +1,127 @@ +## Copyright 2022 - ECORP SAS + +## 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 . +## Author: Frank Preel +--- +stepsCount: 6 +steps: + f0: + type: custom + stepNumber: 1 + nextStepKey: f1 + titleKey: stepTitle_enableOemUnlock + titleIconName: icon-download.png + instructions: + - install_instr_openSettings + - install_instr_searchOEM + - install_instr_enableOEMUnlocking + - install_instr_acceptOEMUnlockWarning + - install_instr_onceDoneThenContinue + f1: + type: load + stepNumber: 2 + nextStepKey: f2 + titleKey: stepTitle_rebootBootloader + instructions: + - install_instr_rebootingOnBootloader + averageTime: 12 + script: reboot-fastboot + parameters: + device_id: ${DEVICE_ID} + fastboot_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_unknown + 10: script_error_cantRebootBootloader + 101: script_error_serialNumber_missing + 102: script_error_fastboot_path_missing + f2: + type: custom-executable + stepNumber: 3 + nextStepKey: f3 + titleKey: stepTitle_oemUnlock + titleIconName: icon-download.png + instructions: + - install_instr_pressVolDownToAcceptOEMUnlocking + - install_instr_unlockingOem + - install_instr_waitInstallStartAuto + script: emerald-flashingUnlock + parameters: + device_id: ${DEVICE_ID} + fastboot_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_unknown + 2: script_error_fastboot_flashingUnlock_failed + 101: script_error_serialNumber_missing + 102: script_error_fastboot_path_missing + + f3: + type: load + stepNumber: 4 + nextStepKey: f4 + titleKey: stepTitle_installOS + instructions: + - install_instr_eosInstall + averageTime: 200 + script: emerald-install-from-bootloader + parameters: + device_id: ${DEVICE_ID} + archive_path: ${ARCHIVE_PATH} + fastboot_folder_path: ${ADB_FOLDER_PATH} + java_folder_path: ${JAVA_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_unknown + 10: script_error_cantUnpackSources + 11: script_error_cantWipeData + 12: script_error_cantWipeData + 20: script_error_cantFlashGz_a + 21: script_error_cantFlashLk_a + 22: script_error_cantFlashMd1img_a + 23: script_error_cantFlashScp_a + 24: script_error_cantFlashSpmfw_a + 25: script_error_cantFlashSspm_a + 26: script_error_cantFlashTee_a + 27: script_error_cantFlashBoot_a + 28: script_error_cantFlashDtbo_a + 29: script_error_cantFlashVbmeta_a + 30: script_error_cantFlashSuper + 101: script_error_serialNumber_missing + 102: script_error_installFromFastboot_102 + 103: script_error_fastboot_path_missing + f4: + type: askAccount + stepNumber: 5 + nextStepKey: f5 + f5: + type: custom-executable + stepNumber: 6 + nextStepKey: end + titleKey: stepTitle_rebootDevice + titleIconName: icon-download.png + instructions: + - install_instr_onceDeviceRebootThenContinue + script: emerald-wait-reboot-from-fastboot + parameters: + fastboot_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_unknown + 10: script_error_cantrebootFromFasboot + 101: script_error_noDeviceFoundInFastboot diff --git a/src/main/resources/yaml/emerald_fs.yml b/src/main/resources/yaml/emerald_fs.yml new file mode 100644 index 00000000..b1c12e06 --- /dev/null +++ b/src/main/resources/yaml/emerald_fs.yml @@ -0,0 +1,20 @@ +## Copyright 2022 - ECORP SAS + +## 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 . +## Author: Frank Preel +--- +sources: + rom: + url: https://images.ecloud.global/stable/emerald/IMG-e-latest-emerald.zip + filePath: IMG-e-latest-emerald.zip -- GitLab From de34e4c051728cc1da3474c77be97b08c81b26ec Mon Sep 17 00:00:00 2001 From: Frank Preel Date: Fri, 6 May 2022 15:17:47 +0200 Subject: [PATCH 03/22] Functionnal linux version --- flash-scripts/linux/emerald-flashingUnlock.sh | 53 ++++++++ .../linux/emerald-install-from-bootloader.sh | 120 ++++++++++++++++++ .../emerald-wait-reboot-from-fastboot.sh | 50 ++++++++ .../resources/lang/translation.properties | 11 ++ 4 files changed, 234 insertions(+) create mode 100755 flash-scripts/linux/emerald-flashingUnlock.sh create mode 100755 flash-scripts/linux/emerald-install-from-bootloader.sh create mode 100755 flash-scripts/linux/emerald-wait-reboot-from-fastboot.sh diff --git a/flash-scripts/linux/emerald-flashingUnlock.sh b/flash-scripts/linux/emerald-flashingUnlock.sh new file mode 100755 index 00000000..88442b5f --- /dev/null +++ b/flash-scripts/linux/emerald-flashingUnlock.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +# Copyright (C) 2022 ECORP SAS - Author: Frank Preel +# +# 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: device id +# $2: fastboot folder path + +# Exit status +# - 0 : bootloader locked +# - 1 : unknown error +# - 2 : Flashing unlocked failed +# - 101 : $DEVICE_ID missing +# - 102 : $FASTBOOT_FOLDER_PATH is missing + +DEVICE_ID=$1 +FASTBOOT_FOLDER_PATH=$2 + +# check serial number has been provided +if [ -z "$DEVICE_ID" ] +then + exit 101 +fi + +# Check fastboot parent folder path has been provided +if [ -z "$FASTBOOT_FOLDER_PATH" ] +then + exit 102 +fi + +# Build fastboot path +FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" + +# Unlock bootloader +if ! "$FASTBOOT_PATH" -s "$DEVICE_ID" flashing unlock +then + exit 2 +fi + +sleep 1 diff --git a/flash-scripts/linux/emerald-install-from-bootloader.sh b/flash-scripts/linux/emerald-install-from-bootloader.sh new file mode 100755 index 00000000..6fd529b5 --- /dev/null +++ b/flash-scripts/linux/emerald-install-from-bootloader.sh @@ -0,0 +1,120 @@ +#!/bin/bash + +# Copyright (C) 2022 ECORP SAS - Author: Frank Preel +# +# 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: DEVICE_ID device id +# $2: ARCHIVE_PATH path to archive +# $3: fastboot folder path +# $4: Java folder path + + +# Exit status +# - 0 : device flashed +# - 1 : generic error +# - 10: can't unpack system.img +# - 11: can't wipe userdata +# - 11: can't wipe metadata +# - 20-30 : see partition_name index below +# - 101 : DEVICE_ID missing +# - 102 : ARCHIVE_PATH missing +# - 103 : fastboot folder path missing + +partition_name=(gz_a lk_a md1img_a scp_a spmfw_a sspm_a tee_a boot_a dtbo_a vbmeta_a super) +partition_image=(gz.img lk.img md1img.img scp.img spmfw.img sspm.img tee.img boot.img dtbo.img vbmeta.img super.img) +partition_error=(20 21 22 23 24 25 26 27 28 29 30) + +DEVICE_ID=$1 +ARCHIVE_PATH=$2 +FASTBOOT_FOLDER_PATH=$3 +JAVA_FOLDER_PATH=$4 + +# Check serial number has been provided +if [ -z "$DEVICE_ID" ] +then + exit 101 +fi + +# check path to rom has been provided +if [ -z "$ARCHIVE_PATH" ] +then + exit 102 +fi + +#check path to adb/fasboot has been provided +if [ -z "$FASTBOOT_FOLDER_PATH" ] +then + exit 103 +fi + +# Check java folder has been provided +if [ -z "$JAVA_FOLDER_PATH" ] +then + exit 104 +fi + +# Build fastboot path +FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" + +# Build java jar path +JAR_PATH=${JAVA_FOLDER_PATH}"/bin/jar" + +# Build archive folder path +ARCHIVE_FOLDER_PATH=$(dirname "$ARCHIVE_PATH")"/" + +# unzip for system.img +cd "$ARCHIVE_FOLDER_PATH" || exit 104 + +if ! "$JAR_PATH" -x -v -f "$ARCHIVE_PATH" ; +then + exit 10 +fi + +echo "unpacked archive" + +sleep 1 + + +# Wipe user data +if ! "$FASTBOOT_PATH" erase userdata ; +then + exit 11 +fi + +echo "user data wiped" +sleep 5 + +if ! "$FASTBOOT_PATH" erase metadata ; +then + exit 12 +fi + +echo "meta data wiped" +sleep 5 + +#Flash partition +for i in ${!partition_name[@]}; do + if ! "$FASTBOOT_PATH" -s "$DEVICE_ID" flash ${partition_name[$i]} ${partition_image[$i]} + then + exit ${partition_error[$i]} + fi + sleep 1 + echo "Flased ${partition_name[$i]}" +done + + +"$FASTBOOT_PATH" --set-active=a + diff --git a/flash-scripts/linux/emerald-wait-reboot-from-fastboot.sh b/flash-scripts/linux/emerald-wait-reboot-from-fastboot.sh new file mode 100755 index 00000000..b11780c2 --- /dev/null +++ b/flash-scripts/linux/emerald-wait-reboot-from-fastboot.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# Copyright (C) 2022 ECORP SAS - Author: Frank Preel +# +# 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: ADB_FOLDER_PATH: the path where runnable adb is stored + +# Exit status +# - 0 : success +# - 1 : unknown error +# - 10 : fastboot reboot command failed +# - 101 : no device found in fastboot + +FASTBOOT_FOLDER_PATH=$1 +FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" + +echo "fastboot path: $FASTBOOT_PATH" + +#check that device is in recovery mode +if ! "$FASTBOOT_PATH" devices 2>&1 | grep "fastboot" +then + echo "Device not detected in fastboot" + exit 101 +fi + +# Reboot the device +if ! "$FASTBOOT_PATH" reboot +then + exit 10 +fi + +#Then we wait that it left this state +while [ "$($FASTBOOT_PATH devices | grep -q fastboot; echo $?)" = 0 ] +do + sleep 1s +done \ No newline at end of file diff --git a/src/main/resources/lang/translation.properties b/src/main/resources/lang/translation.properties index 6f326869..38ac954f 100644 --- a/src/main/resources/lang/translation.properties +++ b/src/main/resources/lang/translation.properties @@ -267,6 +267,17 @@ script_error_cantFlashVBmeta_vendor=Failed to flash vb Meta vendor partition script_error_cantFlashSystem=Failed to flash system partition script_error_cantFlashproduct=Failed to flash product partition script_error_cantFlashVendor=Failed to flash vendor partition +script_error_cantFlashGz_a=Failed to flash gz_a partition +script_error_cantFlashLk_a=Failed to flash lk_a partition +script_error_cantFlashScp_a=Failed to flash scp_a partiton +script_error_cantFlashMd1img_a=Failed to flash md1img_a partition +script_error_cantFlashSpmfw_a =Failed to flash spmfw_a partition +script_error_cantFlashSspm_a =Failed to flash sspm_a partition +script_error_cantFlashTee_a =Failed to flash tee_a partition +script_error_cantFlashBoot_a =Failed to flash boot_a partition +script_error_cantFlashDtbo_a =Failed to flash dtbo_a partition +script_error_cantFlashVbmeta_a =Failed to flash vbmeta_a partition +script_error_cantFlashSuper =Failed to flash super partition script_error_cantrebootFromFasboot= Failed to reboot from fastboot script_error_cantRebootToFastboot=Failed to reboot into fastboot mode java_error_unknow= The installation encounter an internal error -- GitLab From f66418ff33701d9d4c37800f6f14f563204861ad Mon Sep 17 00:00:00 2001 From: Frank Preel Date: Fri, 6 May 2022 16:57:01 +0200 Subject: [PATCH 04/22] Temporary commit to test bat files. Warning this contains debug code. The flash is fake. --- .../windows/emerald-flashingUnlock.bat | 44 ++++++++ .../emerald-install-from-bootloader.bat | 102 ++++++++++++++++++ .../emerald-wait-reboot-from-fastboot.bat | 55 ++++++++++ 3 files changed, 201 insertions(+) create mode 100755 flash-scripts/windows/emerald-flashingUnlock.bat create mode 100755 flash-scripts/windows/emerald-install-from-bootloader.bat create mode 100755 flash-scripts/windows/emerald-wait-reboot-from-fastboot.bat diff --git a/flash-scripts/windows/emerald-flashingUnlock.bat b/flash-scripts/windows/emerald-flashingUnlock.bat new file mode 100755 index 00000000..1c479cf6 --- /dev/null +++ b/flash-scripts/windows/emerald-flashingUnlock.bat @@ -0,0 +1,44 @@ +@echo off + +:: Coyright (C) 2022 ECORP SAS - Author: Frank Preel + +:: 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: device id +:: $2: fastboot folder path + +:: Exit status +:: - 0 : bootloader locked +:: - 1 : unknown error +:: - 2 : Flashing unlocked failed +:: - 101 : $DEVICE_ID missing +:: - 102 : $FASTBOOT_FOLDER_PATH is missing + + +SET DEVICE_ID=%~1 +SET FASTBOOT_FOLDER_PATH=%~2 + +IF not defined "%DEVICE_ID%" ( + exit /b 101 +) +IF not defined "%FASTBOOT_FOLDER_PATH%" ( + exit /b 102 +) + +SET FASTBOOT_PATH=%FASTBOOT_FOLDER_PATH%"fastboot" +IF ! "%FASTBOOT_PATH%" "-s" "%DEVICE_ID%" "flashing" "unlock" ( + exit /b 2 +) +timeout 1 >nul 2>&1 diff --git a/flash-scripts/windows/emerald-install-from-bootloader.bat b/flash-scripts/windows/emerald-install-from-bootloader.bat new file mode 100755 index 00000000..78dd2539 --- /dev/null +++ b/flash-scripts/windows/emerald-install-from-bootloader.bat @@ -0,0 +1,102 @@ +@echo off + +:: Coyright (C) 2022 ECORP SAS - Author: Frank Preel + +:: 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: DEVICE_ID device id +:: $2: ARCHIVE_PATH path to archive +:: $3: fastboot folder path +:: $4: Java folder path + + +:: Exit status +:: - 0 : device flashed +:: - 1 : generic error +:: - 10: can't unpack system.img +:: - 11: can't wipe userdata +:: - 11: can't wipe metadata +:: - 20-30 : see partition_name index below +:: - 101 : DEVICE_ID missing +:: - 102 : ARCHIVE_PATH missing +:: - 103 : fastboot folder path missing + +partition_name=gz_a lk_a md1img_a scp_a spmfw_a sspm_a tee_a boot_a dtbo_a vbmeta_a super +partition_image=gz.img lk.img md1img.img scp.img spmfw.img sspm.img tee.img boot.img dtbo.img vbmeta.img super.img +partition_error=20 21 22 23 24 25 26 27 28 29 30 + +SET DEVICE_ID=%~1 +SET ARCHIVE_PATH=%~2 +SET FASTBOOT_FOLDER_PATH=%~3 +SET JAVA_FOLDER_PATH=%~4 + +IF not defined "%DEVICE_ID%" ( + exit /b 101 +) +IF not defined "%ARCHIVE_PATH%" ( + exit /b 102 +) +IF not defined "%FASTBOOT_FOLDER_PATH%" ( + exit /b 103 +) +IF not defined "%JAVA_FOLDER_PATH%" ( + exit /b 104 +) + +:: Build fastboot path +SET FASTBOOT_PATH=%FASTBOOT_FOLDER_PATH%"fastboot" + +:: Build java jar path +SET JAR_PATH=%JAVA_FOLDER_PATH%"/bin/jar" + +:: Build archive folder path +for %%a in ("%ARCHIVE_PATH%") do ( + set ARCHIVE_FOLDER_PATH=%%~dpa" + echo %ARCHIVE_FOLDER_PATH% +) + +:: unzip for system.img +cd "%ARCHIVE_FOLDER_PATH%" +%JAR_PATH% -x -v -f "%ARCHIVE_PATH%" +if errorLevel 1 ( exit /b 10 ) +echo "unpacked archive" +timeout 1 >nul 2>&1 + + +:: Wipe user data +%FASTBOOT_PATH% erase userdata +if errorLevel 1 ( exit /b 11 ) +echo "user data wiped" +timeout 5 >nul 2>&1 + +:: Wipe meta data +%FASTBOOT_PATH% erase userdata +if errorLevel 1 ( exit /b 12 ) +echo "meta data wiped" +timeout 5 >nul 2>&1 + +:: Flash partition +for /l %%i in (%partition_name%) do ( + echo "........................................................WARNING WARNING WARNING......................................................................................" + echo "........................................................THE FLASH IS COOMMENTED FOR DEBUG......................................................................................" + echo %%i + echo %FASTBOOT_PATH% -s %DEVICE_ID% flash !partition_name[%%i]! !partition_image[%%i]! + if errorLevel 1 ( exit /b !partition_error[%%i]! ) + timeout 1 >nul 2>&1 + echo "Flashed !partition_name[%%i]!" +) + +%FASTBOOT_PATH% --set-active=a + diff --git a/flash-scripts/windows/emerald-wait-reboot-from-fastboot.bat b/flash-scripts/windows/emerald-wait-reboot-from-fastboot.bat new file mode 100755 index 00000000..d7cf1b12 --- /dev/null +++ b/flash-scripts/windows/emerald-wait-reboot-from-fastboot.bat @@ -0,0 +1,55 @@ +@echo off + +:: Coyright (C) 2022 ECORP SAS - Author: Frank Preel + +:: 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: ADB_FOLDER_PATH: the path where runnable adb is stored + +:: Exit status +:: - 0 : success +:: - 1 : unknown error +:: - 10 : fastboot reboot command failed +:: - 101 : no device found in fastboot + +SET FASTBOOT_FOLDER_PATH=%~1 +SET FASTBOOT_PATH=%FASTBOOT_FOLDER_PATH%"fastboot" + +echo "fastboot path: %FASTBOOT_PATH%" + +:: check that device is in recovery mode +%FASTBOOT_PATH% devices 2>&1 | findstr fastboot +if %errorLevel% NEQ 0 ( + echo "Device not detected in fastboot" + exit /b 101 +) + +:: Reboot the device +%FASTBOOT_PATH% reboot +if %errorlevel% NEQ 0 ( exit /b 10 ) + +:: Then we wait that it left this state + +:fastboot_detect +%FASTBOOT_PATH% devices 2>&1 | findstr fastboot +if %errorLevel% EQU 0 ( + ping 127.0.0.1 -n 2 -w 1000 >NUL + goto :fastboot_detect +) else (exit /b 0) + +call :fastboot_detect + +exit /b 0 -- GitLab From d14a494c2affd63a049489fb621b5cbaad561812 Mon Sep 17 00:00:00 2001 From: frankpreel Date: Fri, 6 May 2022 22:57:02 +0200 Subject: [PATCH 05/22] Fix bat syntax --- .../windows/emerald-flashingUnlock.bat | 13 ++-- .../emerald-install-from-bootloader.bat | 63 ++++++++++++++----- .../gs290-wait-reboot-from-fastboot.bat | 2 + flash-scripts/windows/reboot-fastboot.bat | 2 + 4 files changed, 57 insertions(+), 23 deletions(-) diff --git a/flash-scripts/windows/emerald-flashingUnlock.bat b/flash-scripts/windows/emerald-flashingUnlock.bat index 1c479cf6..ddd1db8e 100755 --- a/flash-scripts/windows/emerald-flashingUnlock.bat +++ b/flash-scripts/windows/emerald-flashingUnlock.bat @@ -30,15 +30,16 @@ SET DEVICE_ID=%~1 SET FASTBOOT_FOLDER_PATH=%~2 -IF not defined "%DEVICE_ID%" ( +IF not defined %DEVICE_ID ( exit /b 101 ) -IF not defined "%FASTBOOT_FOLDER_PATH%" ( +IF not defined %FASTBOOT_FOLDER_PATH ( exit /b 102 ) -SET FASTBOOT_PATH=%FASTBOOT_FOLDER_PATH%"fastboot" -IF ! "%FASTBOOT_PATH%" "-s" "%DEVICE_ID%" "flashing" "unlock" ( - exit /b 2 -) +SET FASTBOOT_PATH="%FASTBOOT_FOLDER_PATH%fastboot" +%FASTBOOT_PATH% -s %DEVICE_ID% flashing unlock +if errorlevel 1 ( exit /b 2 ) + timeout 1 >nul 2>&1 +exit /b 0 diff --git a/flash-scripts/windows/emerald-install-from-bootloader.bat b/flash-scripts/windows/emerald-install-from-bootloader.bat index 78dd2539..be287ed0 100755 --- a/flash-scripts/windows/emerald-install-from-bootloader.bat +++ b/flash-scripts/windows/emerald-install-from-bootloader.bat @@ -33,33 +33,65 @@ :: - 102 : ARCHIVE_PATH missing :: - 103 : fastboot folder path missing -partition_name=gz_a lk_a md1img_a scp_a spmfw_a sspm_a tee_a boot_a dtbo_a vbmeta_a super -partition_image=gz.img lk.img md1img.img scp.img spmfw.img sspm.img tee.img boot.img dtbo.img vbmeta.img super.img -partition_error=20 21 22 23 24 25 26 27 28 29 30 +SET partition_name[0]=gz_a +SET partition_name[1]=lk_a +SET partition_name[2]=md1img_a +SET partition_name[3]=scp_a +SET partition_name[4]=spmfw_a +SET partition_name[5]=sspm_a +SET partition_name[6]=tee_a +SET partition_name[7]=boot_a +SET partition_name[8]=dtbo_a +SET partition_name[9]=vbmeta_a +SET partition_name[10]=super + +SET partition_image[0]=gz.img +SET partition_image[1]=lk.img +SET partition_image[2]=md1img.img +SET partition_image[3]=scp.img +SET partition_image[4]=spmfw.img +SET partition_image[5]=sspm.img +SET partition_image[6]=tee.img +SET partition_image[7]=boot.img +SET partition_image[8]=dtbo.img +SET partition_image[9]=vbmeta.img +SET partition_image[10]=super.img + +SET partition_error[0]=20 +SET partition_error[1]=21 +SET partition_error[2]=22 +SET partition_error[3]=23 +SET partition_error[4]=24 +SET partition_error[5]=25 +SET partition_error[6]=26 +SET partition_error[7]=27 +SET partition_error[8]=28 +SET partition_error[9]=29 +SET partition_error[10]=30 SET DEVICE_ID=%~1 SET ARCHIVE_PATH=%~2 SET FASTBOOT_FOLDER_PATH=%~3 SET JAVA_FOLDER_PATH=%~4 -IF not defined "%DEVICE_ID%" ( +IF not defined %DEVICE_ID ( exit /b 101 ) -IF not defined "%ARCHIVE_PATH%" ( +IF not defined %ARCHIVE_PATH ( exit /b 102 ) -IF not defined "%FASTBOOT_FOLDER_PATH%" ( +IF not defined %FASTBOOT_FOLDER_PATH ( exit /b 103 ) -IF not defined "%JAVA_FOLDER_PATH%" ( +IF not defined %JAVA_FOLDER_PATH ( exit /b 104 ) :: Build fastboot path -SET FASTBOOT_PATH=%FASTBOOT_FOLDER_PATH%"fastboot" +SET FASTBOOT_PATH="%FASTBOOT_FOLDER_PATH%fastboot" :: Build java jar path -SET JAR_PATH=%JAVA_FOLDER_PATH%"/bin/jar" +SET JAR_PATH="%JAVA_FOLDER_PATH%/bin/jar" :: Build archive folder path for %%a in ("%ARCHIVE_PATH%") do ( @@ -88,15 +120,12 @@ echo "meta data wiped" timeout 5 >nul 2>&1 :: Flash partition -for /l %%i in (%partition_name%) do ( - echo "........................................................WARNING WARNING WARNING......................................................................................" - echo "........................................................THE FLASH IS COOMMENTED FOR DEBUG......................................................................................" - echo %%i - echo %FASTBOOT_PATH% -s %DEVICE_ID% flash !partition_name[%%i]! !partition_image[%%i]! - if errorLevel 1 ( exit /b !partition_error[%%i]! ) +(for /L %%i in (0,1,10) do ( + %FASTBOOT_PATH% -s %DEVICE_ID% flash %%partition_name[%%i]%% %%partition_image[%%i]%% + if errorLevel 1 ( exit /b %%partition_error[%%i]%% ) timeout 1 >nul 2>&1 - echo "Flashed !partition_name[%%i]!" -) + call echo "Flashed %%partition_name[%%i]%% " +)) %FASTBOOT_PATH% --set-active=a diff --git a/flash-scripts/windows/gs290-wait-reboot-from-fastboot.bat b/flash-scripts/windows/gs290-wait-reboot-from-fastboot.bat index 99dc45aa..42c4e1c6 100755 --- a/flash-scripts/windows/gs290-wait-reboot-from-fastboot.bat +++ b/flash-scripts/windows/gs290-wait-reboot-from-fastboot.bat @@ -1,3 +1,5 @@ +@echo off + :: Copyright (C) 2021 ECORP SAS - Author: Vincent Bourgmayer :: :: This program is free software: you can redistribute it and/or modify diff --git a/flash-scripts/windows/reboot-fastboot.bat b/flash-scripts/windows/reboot-fastboot.bat index b425fac7..d2175397 100755 --- a/flash-scripts/windows/reboot-fastboot.bat +++ b/flash-scripts/windows/reboot-fastboot.bat @@ -1,3 +1,5 @@ +@echo off + :: Copyright (C) 2021 ECORP SAS - Author: Vincent Bourgmayer :: :: This program is free software: you can redistribute it and/or modify -- GitLab From a45664edd3b4d5ca0518126254c29cf5888a147f Mon Sep 17 00:00:00 2001 From: Frank Preel Date: Mon, 9 May 2022 22:00:40 +0200 Subject: [PATCH 06/22] Use stable Q URL --- .../ecorp/easy/installer/EasyInstaller.java | 18 ++---------------- src/main/resources/yaml/star2lte_fs.yml | 8 ++++---- src/main/resources/yaml/starlte_fs.yml | 8 ++++---- 3 files changed, 10 insertions(+), 24 deletions(-) diff --git a/src/main/java/ecorp/easy/installer/EasyInstaller.java b/src/main/java/ecorp/easy/installer/EasyInstaller.java index b25cf59e..e6b48705 100644 --- a/src/main/java/ecorp/easy/installer/EasyInstaller.java +++ b/src/main/java/ecorp/easy/installer/EasyInstaller.java @@ -56,21 +56,7 @@ public class EasyInstaller extends Application { */ @Override public void start(Stage stage) throws Exception { - - /* DEBUG FP - TODO Remove - Command command = new Command("/Users/frankpreel/Documents/ESPRI/git_repos/Easy Installer/bin/adb/adb"); - command.addParameter("1", "devices"); - command.addParameter("2", "-l"); - - CommandExecutionTask task = new CommandExecutionTask(command); - - task.run(); //I feel like it lacks something... but it work in test - - CommandExecutionResult result = task.get(); - */ - - + logger.debug("\nOS name = {}\nJava Home = {}\nCurrent working dir = {}\nADB folder path = {}", OsName, JavaHome, Paths.get("").toAbsolutePath().toString(), AppConstants.getADBFolderPath()); Locale currentLocale= Locale.getDefault(); @@ -150,4 +136,4 @@ public class EasyInstaller extends Application { // Save file controller.onStop(); } -} \ No newline at end of file +} diff --git a/src/main/resources/yaml/star2lte_fs.yml b/src/main/resources/yaml/star2lte_fs.yml index 85c12ffd..108074e3 100644 --- a/src/main/resources/yaml/star2lte_fs.yml +++ b/src/main/resources/yaml/star2lte_fs.yml @@ -16,8 +16,8 @@ --- sources: rom: - url: https://images.ecloud.global/stable/star2lte/e-0.23-q-20220401175185-stable-star2lte.zip - filePath: e-0.23-q-20220401175185-stable-star2lte.zip + url: https://images.ecloud.global/stable/star2lte/e-latest-q-star2lte.zip + filePath: e-latest-q-star2lte.zip twrp: - url: https://images.ecloud.global/stable/star2lte/recovery-e-0.23-q-20220401175185-stable-star2lte.img - filePath: recovery-e-0.23-q-20220401175185-stable-star2lte.img + url: https://images.ecloud.global/stable/star2lte/recovery-e-latest-q-star2lte.img + filePath: recovery-e-latest-q-star2lte.img diff --git a/src/main/resources/yaml/starlte_fs.yml b/src/main/resources/yaml/starlte_fs.yml index 935a04d1..c31c7eb2 100644 --- a/src/main/resources/yaml/starlte_fs.yml +++ b/src/main/resources/yaml/starlte_fs.yml @@ -16,8 +16,8 @@ --- sources: rom: - url: https://images.ecloud.global/stable/starlte/e-0.23-q-20220401175185-stable-starlte.zip - filePath: e-0.23-q-20220401175185-stable-starlte.zip + url: https://images.ecloud.global/stable/starlte/e-latest-q-starlte.zip + filePath: e-latest-q-starlte.zip twrp: - url: https://images.ecloud.global/stable/starlte/recovery-e-0.23-q-20220401175185-stable-starlte.img - filePath: recovery-e-0.23-q-20220401175185-stable-starlte.img + url: https://images.ecloud.global/stable/starlte/recovery-e-latest-q-starlte.img + filePath: recovery-e-latest-q-starlte.img -- GitLab From 9585f479300d6b70000d1cae0de7eb0e128c0e1c Mon Sep 17 00:00:00 2001 From: Frank Preel Date: Mon, 9 May 2022 22:08:24 +0200 Subject: [PATCH 07/22] Update readme & versions --- README.md | 12 +++++++++++- pkg/arch/PKGBUILD | 2 +- snap/snapcraft.yaml | 2 +- src/main/java/ecorp/easy/installer/AppConstants.java | 5 +++-- windows-installer-mui.nsi | 2 +- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index dbb7d04c..e5b45ac8 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Members: - Vincent - Arnau - Manoj - +- Frank Community: - Ingo @@ -37,9 +37,19 @@ Reviewer developer: - [Vincent Bourgmayer](vincent.bourgmayer@e.email) +- Frank Preel - Israel Yago pereira ## Changelogs +### v0.14.0 (candidate) +- Update Readme +- Update version number to v0.14.0 +- Use of the same unit (Mb, Gb..) on the download progress bar +- Add Android Q support for the model below + - star2lte + - starlte +-Add emerald support + ### v0.13.4-beta (current - unreleased) - Fix Ubuntu build's docker image - by Israel & Omer Akram & Nicolas - Refactor classes related to script execution diff --git a/pkg/arch/PKGBUILD b/pkg/arch/PKGBUILD index a05adab7..5dfae96a 100644 --- a/pkg/arch/PKGBUILD +++ b/pkg/arch/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: efoundation # Maintainer: steadfasterX pkgname=easy-installer -pkgver=0.13.4 +pkgver=0.14.0 pkgrel=1 pkgdesc="The Easy Installer is a desktop application which helps users install Android /e/ (https://doc.e.foundation/what-s-e) on supported devices." arch=('x86_64') diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 7629ce79..bf716906 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: easy-installer -version: 'v0.13.4-beta' +version: 'v0.14.0' summary: Easy installation of /e/ OS - the Google-free Android-based mobile OS description: | The /e/ OS Installer has been created to make the installation of diff --git a/src/main/java/ecorp/easy/installer/AppConstants.java b/src/main/java/ecorp/easy/installer/AppConstants.java index d21872d2..e1b12dfb 100644 --- a/src/main/java/ecorp/easy/installer/AppConstants.java +++ b/src/main/java/ecorp/easy/installer/AppConstants.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 - ECORP SAS + * Copyright 2019-2022 - ECORP SAS * * 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 @@ -23,10 +23,11 @@ import java.nio.file.Paths; * @TODO make all final static field with uppercase or lowcase but not a mix of both * @author Vincent Bourgmayer * @author Omer Akram + * @author Frank Preel */ public abstract class AppConstants { - public final static String APP_VERSION = "v0.13.4-beta"; + public final static String APP_VERSION = "v0.14.0"; public final static String Separator = FileSystems.getDefault().getSeparator(); public final static String OsName = System.getProperty("os.name"); public final static String JavaHome = System.getProperty("java.home"); diff --git a/windows-installer-mui.nsi b/windows-installer-mui.nsi index dcf50a79..2a2aa807 100644 --- a/windows-installer-mui.nsi +++ b/windows-installer-mui.nsi @@ -9,7 +9,7 @@ #-------------------------------- RequestExecutionLevel admin #if 'user' then it can't install in C:\Program files !define MUI_ICON "buildSrc/windows/easy-installer.ico" -!define appVersion "v0.13.4-beta" +!define appVersion "v0.14.0" Name "Easy-installer ${appVersion}" # define installation directory InstallDir "$PROGRAMFILES64\easy-installer" -- GitLab From f70b69e56b318209af0d58396fc3b8d4c989b25b Mon Sep 17 00:00:00 2001 From: Frank Preel Date: Tue, 10 May 2022 09:09:45 +0200 Subject: [PATCH 08/22] Fix wrong permissions --- flash-scripts/linux/install-e-recovery.sh | 0 flash-scripts/linux/install-from-e-recovery.sh | 0 flash-scripts/linux/wait-e-reboot.sh | 0 flash-scripts/linux/wait-e-recovery-sideload.sh | 0 4 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 flash-scripts/linux/install-e-recovery.sh mode change 100644 => 100755 flash-scripts/linux/install-from-e-recovery.sh mode change 100644 => 100755 flash-scripts/linux/wait-e-reboot.sh mode change 100644 => 100755 flash-scripts/linux/wait-e-recovery-sideload.sh diff --git a/flash-scripts/linux/install-e-recovery.sh b/flash-scripts/linux/install-e-recovery.sh old mode 100644 new mode 100755 diff --git a/flash-scripts/linux/install-from-e-recovery.sh b/flash-scripts/linux/install-from-e-recovery.sh old mode 100644 new mode 100755 diff --git a/flash-scripts/linux/wait-e-reboot.sh b/flash-scripts/linux/wait-e-reboot.sh old mode 100644 new mode 100755 diff --git a/flash-scripts/linux/wait-e-recovery-sideload.sh b/flash-scripts/linux/wait-e-recovery-sideload.sh old mode 100644 new mode 100755 -- GitLab From 97d67efd6b6f7dac712c52fe3575ae01f371bf0d Mon Sep 17 00:00:00 2001 From: Frank Preel Date: Tue, 10 May 2022 10:58:53 +0200 Subject: [PATCH 09/22] French translation and En typo. I guess the recovery is always in English language (to be verified) thus eRecovery menu item still in english language --- .../resources/lang/translation.properties | 4 +-- .../lang/translation_fr_FR.properties | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/main/resources/lang/translation.properties b/src/main/resources/lang/translation.properties index 38ac954f..842c7212 100644 --- a/src/main/resources/lang/translation.properties +++ b/src/main/resources/lang/translation.properties @@ -190,9 +190,9 @@ install_instr_unlockingOem= Easy-installer is unlocking OEM install_instr_waitFastbootmodeDetected = The next step will start automatically once your device in fastboot mode will be detected. If it takes longer than 30 seconds, please check our FAQ by clicking on the "Need help" button install_instr_choose_e_recovery_select= On the device by using Up or Down volume keys, select "Recovery Mode" option. install_instr_choose_e_recovery_validate= Validate with Power -install_instr_choose_e_recovery_validate_wait_for_result= After a while the device will reboot in recovery mode." +install_instr_choose_e_recovery_validate_wait_for_result= After a while the device will reboot in recovery mode. install_instr_e_recovery_apply_update= Select "Apply update" -install_instr_e_recovery_apply_update_from_adb= "Select "Apply update from ADB" +install_instr_e_recovery_apply_update_from_adb= Select "Apply update from ADB" install_instr_e_recovery_apply_update_from_adb_wait_for_result= The installation is in progress, be patient install_instr_e_recovery_factory_reset= Select "Factory reset" install_instr_e_recovery_factory_reset_format_data= Select "Format data/factory reset" diff --git a/src/main/resources/lang/translation_fr_FR.properties b/src/main/resources/lang/translation_fr_FR.properties index e6285bc0..135bc3c1 100644 --- a/src/main/resources/lang/translation_fr_FR.properties +++ b/src/main/resources/lang/translation_fr_FR.properties @@ -169,6 +169,8 @@ script_error_installFromRecovery_3=Une erreur s'est produite lors de l'installat script_error_installFromRecovery_2=Impossible de pousser le fichier requis sur l'appareil script_error_installFromRecovery_1=Impossible de procéder à l'installation script_error_waitRecovery_102=Erreur dans l'attente du démarrage de l'appareil en mode de récupération +script_error_waitSideload_101 =Erreur dans l'attente du démarrage de l'appareil en mode sideload + script_error_waitRecovery_101=Le numéro de série de l'appareil n'est pas fourni script_error_waitRecovery_1=Impossible de monter le dossier « système » script_error_installRecovery_101=Impossible d'installer TWRP @@ -255,6 +257,8 @@ stepTitle_verifyHeimdall=Vérifier Heimdall stepTitle3On7FP3=Déverrouiller le Bootloader et redémarrer l'appareil en Fastboot mode script_error_waitRebootFromFastboot_101=L'instruction n'a pas pu être lancée sur l'appareil script_error_installFromFastboot_102=L'archive d'installation de /e/ n'a pas pu être décompressée +script_error_installFromSideload = Impossible d'installer /e/ depuis eRecovery + script_error_installFromFastboot_101=Pas d'archive d'installation de /e/ fournie script_error_installFromFastboot_3=Le bootloader n'a pas pu être verrouillé script_error_installFromFastboot_2=Le flashage d'une des partitions a échoué @@ -281,6 +285,7 @@ script_error_fastboot_flashingUnlock_failed=Impossible de déverouiller le flash script_error_fastboot_path_missing=Aucun chemin vers l'outil fastboot n'a été fourni script_error_serialNumber_missing=Aucun numéro de série fourni install_instr_pressVolUpToAcceptOEMUnlocking=Appuyez sur "volume +" pour accepter le dévérouillage OEM +install_instr_pressVolDownToAcceptOEMUnlocking = Appuyez sur "Volume -" pour accepter le dévérouillage OEM install_instr_rebootingOnBootloader=Votre téléphone va redémarrer automatiquement sur le mode bootloader install_instr_onceDeviceRebootThenContinue=Votre téléphone va redémarrer automatiquement. Une fois que c'est fait, vous pouvez cliquer sur continuer install_instr_waitInstallStartAuto=Veuillez patienter, l'installation va démarrer automatiquement @@ -296,6 +301,22 @@ install_instr_update_stockrom=Mettez votre appareil à jour vers la version la p detect_lbl_redisplayAllowUsbDebugingMsg=Si vous ne voyez pas ce genre de message : débranchez puis rebranchez votre téléphone\n Le message s'affichera à nouveau detect_lbl_acceptComputerFingerprint=Si vous voyez, sur votre téléphone, un message comme sur l'image ci-dessous :\n Cochez la case "Toujours autoriser sur cet ordinateur" et appuyez sur le bouton "OK"\nensuite cliquez sur le bouton "Essayez encore" ci-dessous install_instr_waitFastbootmodeDetected=La prochaine étape va démarrer automatiquement dès que votre téléphone sera détecté en mode fastboot. Si cela prend plus que 30 secondes, veuillez vérifier notre FAQ en cliquant sur le bouton "besoin d'aide" + +install_instr_choose_e_recovery_select= Sur le téléphone sélectionner l'option "Recovery Mode". +install_instr_choose_e_recovery_validate= Validez en appuyant sur la touche Power. +install_instr_choose_e_recovery_validate_wait_for_result= Le téléphone va rebooter en mode recovery au boot d'un certain temps. +install_instr_e_recovery_apply_update= Selectionnez "Apply update" +install_instr_e_recovery_apply_update_from_adb= Selectionnez "Apply update from ADB" +install_instr_e_recovery_apply_update_from_adb_wait_for_result= Soyez patient, l'installation est en cours de progression. +install_instr_e_recovery_factory_reset= Selectionnez "Factory reset" +install_instr_e_recovery_factory_reset_format_data= Selectionnez "Format data/factory reset" +install_instr_e_recovery_factory_reset_cache= Selectionnez "Format cache partiton" +install_instr_e_recovery_factory_reset_system= Selectionnez "Format system partiton" +install_instr_e_recovery_factory_reset_format_data_validate= Acceptez l'avertissement en sélectionnant "Format data" +install_instr_e_recovery_factory_reset_validate= Acceptez l'avertissement en sélectionnant "Yes" +install_instr_e_recovery_back= Selectionnez "Back", en haut à gauche de l'écran +install_instr_e_recovery_reboot= Selectionnez "Reboot system now" + checkDriverInstall_advice=Si ce n'est pas le cas, veuillez suivre cette documentation : checkDriverInstall_question=Avez-vous installé les pilotes pour votre téléphone ? # Check windows driver installation @@ -303,3 +324,15 @@ checkDriverInstall_mTitle=Vérification de l'installation des drivers install_instr_waitRecoveryInstallStartAuto=veuillez patienter, l' installation du /e/ recovery va débuter automatiquement install_instr_leaveBootloader_holdPower=Maintenir le bouton "Alimentation" pressé jusqu'à ce que le téléphone s'éteigne (~12 secondes) script_error_cantFlashRecovery= + +script_error_cantFlashGz_a=Erreur de flash gz_a partition +script_error_cantFlashLk_a=Erreur de flash lk_a partition +script_error_cantFlashScp_a=Erreur de flash scp_a partiton +script_error_cantFlashMd1img_a=Erreur de flash md1img_a partition +script_error_cantFlashSpmfw_a =Erreur de flash spmfw_a partition +script_error_cantFlashSspm_a =Erreur de flash sspm_a partition +script_error_cantFlashTee_a =Erreur de flash tee_a partition +script_error_cantFlashBoot_a =Erreur de flash boot_a partition +script_error_cantFlashDtbo_a =Erreur de flash dtbo_a partition +script_error_cantFlashVbmeta_a =Erreur de flash vbmeta_a partition +script_error_cantFlashSuper =Erreur de flash super partition -- GitLab From 0f429d5c01fb4171fc6eb8cebfabe3cd3789f458 Mon Sep 17 00:00:00 2001 From: frankpreel Date: Tue, 10 May 2022 13:14:17 +0200 Subject: [PATCH 10/22] Add missing zadig.exe binary. Warning, by reading the install driver documentation (https://doc.e.foundation/easy-installer-faq) the process does *not* explain how to use zadig --- build.gradle | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.gradle b/build.gradle index 216d5dfb..e98557a7 100644 --- a/build.gradle +++ b/build.gradle @@ -147,6 +147,11 @@ tasks.jlink { from('buildSrc/windows/heimdall') into("${buildDir}/image/${appLauncher}-${windowsPlatform}/bin") include 'heimdall.exe', 'libusb-1.0.dll', 'libgcc_s_seh-1.dll', 'libstdc++-6.dll', 'libwinpthread-1.dll', 'wdi-simple.exe' + } + copy { + from('buildSrc/windows/heimdall/Drivers') + into("${buildDir}/image/${appLauncher}-${windowsPlatform}/bin") + include 'zadig.exe' } copy { from('buildSrc/windows/adb') -- GitLab From 04c347f77bef7ef11ff61c25e817824c8b1ae183 Mon Sep 17 00:00:00 2001 From: frankpreel Date: Tue, 10 May 2022 13:14:56 +0200 Subject: [PATCH 11/22] Typo --- flash-scripts/windows/wait-e-recovery-sideload.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flash-scripts/windows/wait-e-recovery-sideload.bat b/flash-scripts/windows/wait-e-recovery-sideload.bat index 84786429..668fc8f2 100644 --- a/flash-scripts/windows/wait-e-recovery-sideload.bat +++ b/flash-scripts/windows/wait-e-recovery-sideload.bat @@ -26,7 +26,7 @@ SET DEVICE_ID=%~1 SET ADB_FOLDER_PATH=%~2 -SET ADB_PATH=%ADB_FOLDER_PATH%adb +SET ADB_PATH="%ADB_FOLDER_PATH%adb" echo "waiting for recovery" echo %ADB_PATH% -s %DEVICE_ID% wait-for-sideload -- GitLab From bb054ee336d7639923164a28486fca4b6019b723 Mon Sep 17 00:00:00 2001 From: Frank Preel Date: Fri, 13 May 2022 16:08:12 +0200 Subject: [PATCH 12/22] Start hotdogb --- flash-scripts/linux/wait-reboot.sh | 2 +- src/main/resources/yaml/hotdogb_flash.yml | 127 ++++++++++++++++++++++ src/main/resources/yaml/hotdogb_fs.yml | 23 ++++ 3 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/yaml/hotdogb_flash.yml create mode 100644 src/main/resources/yaml/hotdogb_fs.yml diff --git a/flash-scripts/linux/wait-reboot.sh b/flash-scripts/linux/wait-reboot.sh index c30eff81..cdfbea2a 100755 --- a/flash-scripts/linux/wait-reboot.sh +++ b/flash-scripts/linux/wait-reboot.sh @@ -50,4 +50,4 @@ fi while "$ADB_PATH" -s "$DEVICE_ID" get-state 2> /dev/null do sleep 1 -done \ No newline at end of file +done diff --git a/src/main/resources/yaml/hotdogb_flash.yml b/src/main/resources/yaml/hotdogb_flash.yml new file mode 100644 index 00000000..a28d9b5b --- /dev/null +++ b/src/main/resources/yaml/hotdogb_flash.yml @@ -0,0 +1,127 @@ +## Copyright 2022 - ECORP SAS + +## 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 . +## Author: Frank Preel +--- +stepsCount: 6 +steps: + f0: + type: custom + stepNumber: 1 + nextStepKey: f1 + titleKey: stepTitle_enableOemUnlock + titleIconName: icon-download.png + instructions: + - install_instr_openSettings + - install_instr_searchOEM + - install_instr_enableOEMUnlocking + - install_instr_acceptOEMUnlockWarning + - install_instr_onceDoneThenContinue + f1: + type: load + stepNumber: 2 + nextStepKey: f2 + titleKey: stepTitle_rebootBootloader + instructions: + - install_instr_rebootingOnBootloader + averageTime: 12 + script: reboot-fastboot + parameters: + device_id: ${DEVICE_ID} + fastboot_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_unknown + 10: script_error_cantRebootBootloader + 101: script_error_serialNumber_missing + 102: script_error_fastboot_path_missing + f2: + type: custom-executable + stepNumber: 3 + nextStepKey: f3 + titleKey: stepTitle_oemUnlock + titleIconName: icon-download.png + instructions: + - install_instr_pressVolDownToAcceptOEMUnlocking + - install_instr_unlockingOem + - install_instr_waitInstallStartAuto + script: emerald-flashingUnlock + parameters: + device_id: ${DEVICE_ID} + fastboot_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_unknown + 2: script_error_fastboot_flashingUnlock_failed + 101: script_error_serialNumber_missing + 102: script_error_fastboot_path_missing + + f3: + type: load + stepNumber: 4 + nextStepKey: f4 + titleKey: stepTitle_installOS + instructions: + - install_instr_eosInstall + averageTime: 200 + script: emerald-install-from-bootloader + parameters: + device_id: ${DEVICE_ID} + archive_path: ${ARCHIVE_PATH} + fastboot_folder_path: ${ADB_FOLDER_PATH} + java_folder_path: ${JAVA_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_unknown + 10: script_error_cantUnpackSources + 11: script_error_cantWipeData + 12: script_error_cantWipeData + 20: script_error_cantFlashGz_a + 21: script_error_cantFlashLk_a + 22: script_error_cantFlashMd1img_a + 23: script_error_cantFlashScp_a + 24: script_error_cantFlashSpmfw_a + 25: script_error_cantFlashSspm_a + 26: script_error_cantFlashTee_a + 27: script_error_cantFlashBoot_a + 28: script_error_cantFlashDtbo_a + 29: script_error_cantFlashVbmeta_a + 30: script_error_cantFlashSuper + 101: script_error_serialNumber_missing + 102: script_error_installFromFastboot_102 + 103: script_error_fastboot_path_missing + f4: + type: askAccount + stepNumber: 5 + nextStepKey: f5 + f5: + type: custom-executable + stepNumber: 6 + nextStepKey: end + titleKey: stepTitle_rebootDevice + titleIconName: icon-download.png + instructions: + - install_instr_onceDeviceRebootThenContinue + script: emerald-wait-reboot-from-fastboot + parameters: + fastboot_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_unknown + 10: script_error_cantrebootFromFasboot + 101: script_error_noDeviceFoundInFastboot diff --git a/src/main/resources/yaml/hotdogb_fs.yml b/src/main/resources/yaml/hotdogb_fs.yml new file mode 100644 index 00000000..fd37345c --- /dev/null +++ b/src/main/resources/yaml/hotdogb_fs.yml @@ -0,0 +1,23 @@ +## Copyright 2022 - ECORP SAS + +## 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 . +## Author: Frank Preel +--- +sources: + rom: + url: https://images.ecloud.global/stable/emerald/IMG-e-latest-emerald.zip + filePath: IMG-e-latest-emerald.zip + twrp: + url: https://images.ecloud.global/stable/twrp/dream2lte/twrp-3.3.1-2-dream2lte.img + filePath: twrp-3.3.1-2-dream2lte.img -- GitLab From 702f37f0ccca24bdf616213aaa574493cda2b31f Mon Sep 17 00:00:00 2001 From: Frank Preel Date: Mon, 16 May 2022 17:22:23 +0200 Subject: [PATCH 13/22] Adjustements, Teracube specifics device management --- .../subcontrollers/DeviceDetectedController.java | 13 +++++++++++-- .../easy/installer/tasks/DeviceDetectionTask.java | 4 ++-- src/main/resources/lang/translation.properties | 2 ++ .../resources/lang/translation_fr_FR.properties | 3 +++ src/main/resources/yaml/emerald_flash.yml | 2 +- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/main/java/ecorp/easy/installer/controllers/subcontrollers/DeviceDetectedController.java b/src/main/java/ecorp/easy/installer/controllers/subcontrollers/DeviceDetectedController.java index 916cb4c7..dd237064 100644 --- a/src/main/java/ecorp/easy/installer/controllers/subcontrollers/DeviceDetectedController.java +++ b/src/main/java/ecorp/easy/installer/controllers/subcontrollers/DeviceDetectedController.java @@ -106,11 +106,20 @@ public class DeviceDetectedController extends AbstractSubController{ return; } - if("Teracube_2e".equals(phone.getAdbDevice()) || "2e".equals(phone.getAdbDevice())){ + if("2e".equals(phone.getAdbDevice())){ displayIncompatibleDeviceFound(phone.getAdbModel()); return; } + if("emerald".equals(phone.getAdbDevice()) || + "Teracube_2e".equals(phone.getAdbDevice()) ){ + final String serial = phone.getSerialNo(); + if ( ! serial.startsWith("202111") ) { + displayIncompatibleDeviceFound(phone.getAdbModel()); + return; + } + } + //If device is unauthorized if(!phone.isAdbAuthorized()){ displayUnauthorizedDeviceFound(); @@ -223,4 +232,4 @@ public class DeviceDetectedController extends AbstractSubController{ logger.debug("goToShop()"); parentController.openUrlInBrowser("https://esolutions.shop/"); } -} \ No newline at end of file +} diff --git a/src/main/java/ecorp/easy/installer/tasks/DeviceDetectionTask.java b/src/main/java/ecorp/easy/installer/tasks/DeviceDetectionTask.java index 0226c61e..f6d7583b 100644 --- a/src/main/java/ecorp/easy/installer/tasks/DeviceDetectionTask.java +++ b/src/main/java/ecorp/easy/installer/tasks/DeviceDetectionTask.java @@ -146,7 +146,7 @@ public class DeviceDetectionTask extends Task{ }else if(stringPart.contains("device:")){ logger.debug(" \"device\" keyword has been found"); String device = stringPart.substring("device:".length() ); - if(device.equals("2e")) device ="Teracube_2e"; + if(device.equals("Teracube_2e")) device ="emerald"; //if(device.equals("k63v2_64_bsp")) device="GS290"; //bad idea. Device not really compatible. result.setAdbDevice(device); } @@ -156,4 +156,4 @@ public class DeviceDetectionTask extends Task{ } return result; } -} \ No newline at end of file +} diff --git a/src/main/resources/lang/translation.properties b/src/main/resources/lang/translation.properties index 38ac954f..9134b384 100644 --- a/src/main/resources/lang/translation.properties +++ b/src/main/resources/lang/translation.properties @@ -186,6 +186,8 @@ install_instr_onceDeviceRebootThenContinue = Your device will reboot automatical install_instr_rebootingOnBootloader=Your device will reboot automatically on bootloader mode install_instr_pressVolUpToAcceptOEMUnlocking = Press "Volume up" to accept OEM unlocking install_instr_pressVolDownToAcceptOEMUnlocking = Press "Volume down" to accept OEM unlocking +install_instr_selectOEMUnlockingMenu = Accept OEM unlocking by using the phone keys (refer to the instructions on the screen of the phone) + install_instr_unlockingOem= Easy-installer is unlocking OEM install_instr_waitFastbootmodeDetected = The next step will start automatically once your device in fastboot mode will be detected. If it takes longer than 30 seconds, please check our FAQ by clicking on the "Need help" button install_instr_choose_e_recovery_select= On the device by using Up or Down volume keys, select "Recovery Mode" option. diff --git a/src/main/resources/lang/translation_fr_FR.properties b/src/main/resources/lang/translation_fr_FR.properties index e6285bc0..59d2ed34 100644 --- a/src/main/resources/lang/translation_fr_FR.properties +++ b/src/main/resources/lang/translation_fr_FR.properties @@ -281,6 +281,9 @@ script_error_fastboot_flashingUnlock_failed=Impossible de déverouiller le flash script_error_fastboot_path_missing=Aucun chemin vers l'outil fastboot n'a été fourni script_error_serialNumber_missing=Aucun numéro de série fourni install_instr_pressVolUpToAcceptOEMUnlocking=Appuyez sur "volume +" pour accepter le dévérouillage OEM +install_instr_pressVolDownToAcceptOEMUnlocking=Appuyez sur "volume -" pour accepter le dévérouillage OEM +install_instr_selectOEMUnlockingMenu = Acceptter le dévérouillage OEM en utilisant les touches du téléphone (se référer aux instructions sur l'écran du téléphone) + install_instr_rebootingOnBootloader=Votre téléphone va redémarrer automatiquement sur le mode bootloader install_instr_onceDeviceRebootThenContinue=Votre téléphone va redémarrer automatiquement. Une fois que c'est fait, vous pouvez cliquer sur continuer install_instr_waitInstallStartAuto=Veuillez patienter, l'installation va démarrer automatiquement diff --git a/src/main/resources/yaml/emerald_flash.yml b/src/main/resources/yaml/emerald_flash.yml index a28d9b5b..0bd8e25e 100644 --- a/src/main/resources/yaml/emerald_flash.yml +++ b/src/main/resources/yaml/emerald_flash.yml @@ -54,7 +54,7 @@ steps: titleKey: stepTitle_oemUnlock titleIconName: icon-download.png instructions: - - install_instr_pressVolDownToAcceptOEMUnlocking + - install_instr_selectOEMUnlockingMenu - install_instr_unlockingOem - install_instr_waitInstallStartAuto script: emerald-flashingUnlock -- GitLab From eefa8cdd697f74cf1d79fbf04089b46a2ffb1746 Mon Sep 17 00:00:00 2001 From: Frank Preel Date: Tue, 17 May 2022 18:27:48 +0200 Subject: [PATCH 14/22] Functionnal Linux 7T --- .../linux/install-from-e-recovery.sh | 6 + flash-scripts/linux/oneplus-flashingUnlock.sh | 62 +++++ .../ecorp/easy/installer/AppConstants.java | 21 +- .../subcontrollers/DownloadSrcController.java | 3 +- .../easy/installer/helpers/DeviceHelper.java | 3 +- .../easy/installer/utils/ConfigParser.java | 5 +- .../resources/lang/translation.properties | 7 + .../lang/translation_fr_FR.properties | 7 +- src/main/resources/yaml/OnePlus7T_flash.yml | 216 ++++++++++++++++++ .../yaml/{hotdogb_fs.yml => OnePlus7T_fs.yml} | 13 +- src/main/resources/yaml/hotdogb_flash.yml | 127 ---------- 11 files changed, 332 insertions(+), 138 deletions(-) create mode 100755 flash-scripts/linux/oneplus-flashingUnlock.sh create mode 100644 src/main/resources/yaml/OnePlus7T_flash.yml rename src/main/resources/yaml/{hotdogb_fs.yml => OnePlus7T_fs.yml} (60%) delete mode 100644 src/main/resources/yaml/hotdogb_flash.yml diff --git a/flash-scripts/linux/install-from-e-recovery.sh b/flash-scripts/linux/install-from-e-recovery.sh index bc6a1603..28ce53b8 100755 --- a/flash-scripts/linux/install-from-e-recovery.sh +++ b/flash-scripts/linux/install-from-e-recovery.sh @@ -56,4 +56,10 @@ ret=${?} echo "adb sideload retuns = "${ret} # ret = 0 if adb command is fine, 1 on error +if [ ${ret} -lt 2 ] +then + echo "handle adb: failed to read command: Success." + exit 0 +fi + exit ${ret} diff --git a/flash-scripts/linux/oneplus-flashingUnlock.sh b/flash-scripts/linux/oneplus-flashingUnlock.sh new file mode 100755 index 00000000..763b8d2d --- /dev/null +++ b/flash-scripts/linux/oneplus-flashingUnlock.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# Copyright (C) 2022 ECORP SAS - Author: Frank Preel +# +# 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: device id +# $2: fastboot folder path + +# Exit status +# - 0 : bootloader locked +# - 1 : unknown error +# - 2 : Flashing unlocked failed +# - 101 : $DEVICE_ID missing +# - 102 : $FASTBOOT_FOLDER_PATH is missing + +DEVICE_ID=$1 +FASTBOOT_FOLDER_PATH=$2 + +# check serial number has been provided +if [ -z "$DEVICE_ID" ] +then + exit 101 +fi + +# Check fastboot parent folder path has been provided +if [ -z "$FASTBOOT_FOLDER_PATH" ] +then + exit 102 +fi + +# Build fastboot path +FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" + +# Unlock bootloader +if ! "$FASTBOOT_PATH" -s "$DEVICE_ID" oem unlock +then + if ! "$FASTBOOT_PATH" -s "$DEVICE_ID" oem unlock 2>&1 | grep "Device already : unlocked" + then + exit 2 + fi + echo "The device is unlocked" + + if ! "$FASTBOOT_PATH" -s "$DEVICE_ID" reboot + then + exit 2 + fi +fi + +sleep 30 diff --git a/src/main/java/ecorp/easy/installer/AppConstants.java b/src/main/java/ecorp/easy/installer/AppConstants.java index e1b12dfb..6f7afe4e 100644 --- a/src/main/java/ecorp/easy/installer/AppConstants.java +++ b/src/main/java/ecorp/easy/installer/AppConstants.java @@ -52,7 +52,24 @@ public abstract class AppConstants { private static String TWRP_IMAGE_PATH; private static String E_ARCHIVE_PATH; private static String DEVICE_MODEL; - + private static String PATCH_PATH; + + /** + * Get the path of patch + * @return can return null if not already setted + */ + public static String getPatchPath() { + return PATCH_PATH; + } + + /** + * Define the path to access patch to flash + * @param eImagePath + */ + public static void setPatchPath(String patchPath) { + PATCH_PATH = patchPath; + } + /** * This methods set the model of the device * @todo remove this @@ -233,4 +250,4 @@ public abstract class AppConstants { public static boolean isWindowsOs(){ return OsName.toLowerCase().contains("win"); } -} \ No newline at end of file +} diff --git a/src/main/java/ecorp/easy/installer/controllers/subcontrollers/DownloadSrcController.java b/src/main/java/ecorp/easy/installer/controllers/subcontrollers/DownloadSrcController.java index 0196865d..a8ed2fc4 100644 --- a/src/main/java/ecorp/easy/installer/controllers/subcontrollers/DownloadSrcController.java +++ b/src/main/java/ecorp/easy/installer/controllers/subcontrollers/DownloadSrcController.java @@ -141,6 +141,7 @@ public class DownloadSrcController extends AbstractSubController { String sourcesFolderPath = AppConstants.getSourcesFolderPath(); CommandExecutionTask.updateCommonParam("TWRP_IMAGE_PATH", sourcesFolderPath+AppConstants.getTwrpImgPath()); CommandExecutionTask.updateCommonParam("ARCHIVE_PATH", sourcesFolderPath+AppConstants.getEArchivePath()); + CommandExecutionTask.updateCommonParam("PATCH_PATH", sourcesFolderPath+AppConstants.getPatchPath()); parentController.disableNextButton(false); } @@ -208,4 +209,4 @@ public class DownloadSrcController extends AbstractSubController { super.failed(); //no sure of its use. } } -} \ No newline at end of file +} diff --git a/src/main/java/ecorp/easy/installer/helpers/DeviceHelper.java b/src/main/java/ecorp/easy/installer/helpers/DeviceHelper.java index b5724e00..45fe31fb 100644 --- a/src/main/java/ecorp/easy/installer/helpers/DeviceHelper.java +++ b/src/main/java/ecorp/easy/installer/helpers/DeviceHelper.java @@ -51,6 +51,7 @@ public class DeviceHelper { put("GS290", "0009"); put("Teracube_2e", "0011"); put("emerald", "0012"); //Teracube A10 + put("OnePlus7T", "0013"); }}; /** @@ -122,4 +123,4 @@ public class DeviceHelper { return flashingProcess; } -} \ No newline at end of file +} diff --git a/src/main/java/ecorp/easy/installer/utils/ConfigParser.java b/src/main/java/ecorp/easy/installer/utils/ConfigParser.java index 0f05b1b8..d7f7f4be 100644 --- a/src/main/java/ecorp/easy/installer/utils/ConfigParser.java +++ b/src/main/java/ecorp/easy/installer/utils/ConfigParser.java @@ -248,9 +248,12 @@ public class ConfigParser { if(key.equals("twrp")){ AppConstants.setTwrpImgPath((String) source.get("filePath")); } + if(key.equals("patch")){ + AppConstants.setPatchPath((String) source.get("filePath")); + } logger.debug("--> url: {}, filePath: {}", source.get("url"), source.get("filePath")); result.put((String) source.get("url"), (String) source.get("filePath")); } return result; } -} \ No newline at end of file +} diff --git a/src/main/resources/lang/translation.properties b/src/main/resources/lang/translation.properties index 842c7212..7ea3a388 100644 --- a/src/main/resources/lang/translation.properties +++ b/src/main/resources/lang/translation.properties @@ -53,8 +53,10 @@ connect_lbl_2=We will automatically detect your phone to install /e/OS. Automati connect_lbl_3=In the next stages, we will help you activate 'Developer mode' if you haven't done it so far. #devMode & debugADB +devMode_mTitle_main=Enable the Developer mode devMode_mTitle=Enable the Developer mode (Part 1) devMode_lbl=Please follow these steps: +devMode_main= Your phone has just been unlocked, it has restarted devMode_instr_settings=Open the 'Settings' menu devMode_instr_build=Type 'Build' in the search bar devMode_instr_tap7=Tap 7 times on 'Build number' @@ -189,6 +191,7 @@ install_instr_pressVolDownToAcceptOEMUnlocking = Press "Volume down" to accept O install_instr_unlockingOem= Easy-installer is unlocking OEM install_instr_waitFastbootmodeDetected = The next step will start automatically once your device in fastboot mode will be detected. If it takes longer than 30 seconds, please check our FAQ by clicking on the "Need help" button install_instr_choose_e_recovery_select= On the device by using Up or Down volume keys, select "Recovery Mode" option. +install_instr_choose_e_recovery_select_details= The selection is made by using the volume keys of the phone. install_instr_choose_e_recovery_validate= Validate with Power install_instr_choose_e_recovery_validate_wait_for_result= After a while the device will reboot in recovery mode. install_instr_e_recovery_apply_update= Select "Apply update" @@ -283,6 +286,9 @@ script_error_cantRebootToFastboot=Failed to reboot into fastboot mode java_error_unknow= The installation encounter an internal error flash_process_cancelled=The installation process has been cancelled +#oneplus +install_instr_e_recovery_oneplus_copy_partition= Partition installation + #eAccount eAccount_mTitle=Create your e.email account eAccount_lbl_incitation=Your e.email account is at the center of the /e/OS ecosystem. @@ -356,3 +362,4 @@ stepTitle_enableOemUnlock= Enable OEM unlocking stepTitle_beforeInstallation= Before installation stepTitle_rebootDevice= Reboot device stepTitle_rebootBootloader = Rebooting in bootloader mode +stepTitle_installation = Factory reset and installation diff --git a/src/main/resources/lang/translation_fr_FR.properties b/src/main/resources/lang/translation_fr_FR.properties index 135bc3c1..88a23e1e 100644 --- a/src/main/resources/lang/translation_fr_FR.properties +++ b/src/main/resources/lang/translation_fr_FR.properties @@ -43,6 +43,8 @@ connect_lbl_2=Nous détecterons automatiquement votre téléphone pour installer connect_lbl_3=Dans les prochaines étapes, nous vous aiderons à activer le « mode développeur » si vous ne l'avez pas encore fait. #devMode & debugADB devMode_mTitle=Activer le mode développeur (Partie 1) +devMode_mTitle_main=Activer le mode développeur +devMode_main=Votre téléphone vient d'être dévérouillé, il a rédémarré : devMode_lbl=Veuillez suivre les étapes suivantes : devMode_instr_settings=Ouvrez les « Paramètres » devMode_instr_build=Tapez « Numéro » dans la barre de recherche @@ -227,7 +229,8 @@ all_lbl_tryAgain=Essayer à nouveau # @author Brittny Mendoza - +#oneplus +install_instr_e_recovery_oneplus_select_recovery= Installation de la partition #common view all_lbl_notImplemented=(Pas encore mis en œuvre) @@ -255,6 +258,7 @@ stepTitle_installRecovery=Installer le mode de récupération stepTitle_oemUnlock=Déverrouillage OEM stepTitle_verifyHeimdall=Vérifier Heimdall stepTitle3On7FP3=Déverrouiller le Bootloader et redémarrer l'appareil en Fastboot mode +stepTitle_installation = Réinitialisation d'usine et installation script_error_waitRebootFromFastboot_101=L'instruction n'a pas pu être lancée sur l'appareil script_error_installFromFastboot_102=L'archive d'installation de /e/ n'a pas pu être décompressée script_error_installFromSideload = Impossible d'installer /e/ depuis eRecovery @@ -303,6 +307,7 @@ detect_lbl_acceptComputerFingerprint=Si vous voyez, sur votre téléphone, un me install_instr_waitFastbootmodeDetected=La prochaine étape va démarrer automatiquement dès que votre téléphone sera détecté en mode fastboot. Si cela prend plus que 30 secondes, veuillez vérifier notre FAQ en cliquant sur le bouton "besoin d'aide" install_instr_choose_e_recovery_select= Sur le téléphone sélectionner l'option "Recovery Mode". +install_instr_choose_e_recovery_select_details= La selection se fait en utilisant les touches de volume du téléphone. install_instr_choose_e_recovery_validate= Validez en appuyant sur la touche Power. install_instr_choose_e_recovery_validate_wait_for_result= Le téléphone va rebooter en mode recovery au boot d'un certain temps. install_instr_e_recovery_apply_update= Selectionnez "Apply update" diff --git a/src/main/resources/yaml/OnePlus7T_flash.yml b/src/main/resources/yaml/OnePlus7T_flash.yml new file mode 100644 index 00000000..ebe07760 --- /dev/null +++ b/src/main/resources/yaml/OnePlus7T_flash.yml @@ -0,0 +1,216 @@ +## Copyright 2022 - ECORP SAS + +## 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 . +## Author: Frank Preel +--- +stepsCount: 12 +steps: + f0: + type: custom + stepNumber: 1 + nextStepKey: f1 + titleKey: stepTitle_enableOemUnlock + titleIconName: icon-download.png + instructions: + - install_instr_openSettings + - install_instr_searchOEM + - install_instr_enableOEMUnlocking + - install_instr_acceptOEMUnlockWarning + - install_instr_onceDoneThenContinue + f1: + type: load + stepNumber: 2 + nextStepKey: f2 + titleKey: stepTitle_rebootBootloader + instructions: + - install_instr_rebootingOnBootloader + averageTime: 10 + script: reboot-fastboot + parameters: + device_id: ${DEVICE_ID} + fastboot_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_unknown + 10: script_error_cantRebootBootloader + 101: script_error_serialNumber_missing + 102: script_error_fastboot_path_missing + f2: + type: load + stepNumber: 3 + nextStepKey: f3 + titleKey: stepTitle_oemUnlock + titleIconName: icon-download.png + averageTime: 25 + instructions: + - install_instr_unlockingOem + script: oneplus-flashingUnlock + parameters: + device_id: ${DEVICE_ID} + fastboot_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_unknown + 2: script_error_fastboot_flashingUnlock_failed + 101: script_error_serialNumber_missing + 102: script_error_fastboot_path_missing + f3: + type: custom + stepNumber: 4 + nextStepKey: f4 + titleKey: devMode_mTitle_main + titleIconName: icon-download.png + instructions: + - devMode_main + - devMode_lbl + - devMode_instr_settings + - devMode_instr_build + - devMode_instr_tap7 + - debugADB_instr_settings + - debugADB_instr_search + - debugADB_instr_androidDebug + - debugADB_instr_debugOn + - debugADB_instr_tapeOK + - debugADB_instr_acceptCertificate + f4: + type: load + stepNumber: 5 + nextStepKey: f5 + titleKey: stepTitle_rebootBootloader + instructions: + - install_instr_rebootingOnBootloader + averageTime: 8 + script: reboot-fastboot + parameters: + device_id: ${DEVICE_ID} + fastboot_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_unknown + 10: script_error_cantRebootBootloader + 101: script_error_serialNumber_missing + 102: script_error_fastboot_path_missing + f5: + type: load + stepNumber: 6 + nextStepKey: f6 + titleKey: stepTitle4On7 + instructions: + - install_instr_recoveryInstall + averageTime: 3 + script: install-e-recovery + parameters: + fastboot_folder_path: ${ADB_FOLDER_PATH} + twrp_image_path: ${TWRP_IMAGE_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_unknown + 101: script_error_installRecovery_101 + f6: + type: custom-executable + stepNumber: 7 + nextStepKey: f7 + titleKey: stepTitle5On7 + instructions: + - install_instr_choose_e_recovery_select + - install_instr_choose_e_recovery_select_details + - install_instr_choose_e_recovery_validate + - install_instr_choose_e_recovery_validate_wait_for_result + - install_instr_e_recovery_apply_update + - install_instr_e_recovery_apply_update_from_adb + - install_instr_e_recovery_apply_update_from_adb_wait_for_result + titleKeyIconName: icon-download.png + script: wait-e-recovery-sideload + parameters: + device_id: ${DEVICE_ID} + adb_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 101: script_error_waitSideload_101 + f7: + type: load + stepNumber: 8 + nextStepKey: f8 + titleKey: install_instr_eosInstall + instructions: + - install_instr_e_recovery_oneplus_select_recovery + averageTime: 150 + script: install-from-e-recovery + parameters: + device_id: ${DEVICE_ID} + archive_path: ${PATCH_PATH} + adb_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_installFromSideload + f8: + type: custom-executable + stepNumber: 9 + nextStepKey: f9 + titleKey: stepTitle_installation + instructions: + - install_instr_e_recovery_back + - install_instr_e_recovery_factory_reset + - install_instr_e_recovery_factory_reset_format_data + - install_instr_e_recovery_factory_reset_format_data_validate + - install_instr_e_recovery_back + - install_instr_e_recovery_apply_update + - install_instr_e_recovery_apply_update_from_adb + - install_instr_e_recovery_apply_update_from_adb_wait_for_result + titleKeyIconName: icon-download.png + script: wait-e-recovery-sideload + parameters: + device_id: ${DEVICE_ID} + adb_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 101: script_error_waitSideload_101 + f9: + type: load + stepNumber: 10 + nextStepKey: f10 + titleKey: install_instr_eosInstall + instructions: + - install_instr_e_recovery_oneplus_select_recovery + averageTime: 150 + script: install-from-e-recovery + parameters: + device_id: ${DEVICE_ID} + archive_path: ${ARCHIVE_PATH} + adb_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_installFromSideload + f10: + type: askAccount + stepNumber: 11 + nextStepKey: f11 + f11: + type: custom + stepNumber: 12 + nextStepKey: end + titleKey: stepTitle_rebootDevice + instructions: + - install_instr_e_recovery_back + - install_instr_e_recovery_reboot + - eAccount_lbl_alreadyAccount + titleKeyIconName: icon-download.png diff --git a/src/main/resources/yaml/hotdogb_fs.yml b/src/main/resources/yaml/OnePlus7T_fs.yml similarity index 60% rename from src/main/resources/yaml/hotdogb_fs.yml rename to src/main/resources/yaml/OnePlus7T_fs.yml index fd37345c..b8f827e1 100644 --- a/src/main/resources/yaml/hotdogb_fs.yml +++ b/src/main/resources/yaml/OnePlus7T_fs.yml @@ -16,8 +16,11 @@ --- sources: rom: - url: https://images.ecloud.global/stable/emerald/IMG-e-latest-emerald.zip - filePath: IMG-e-latest-emerald.zip - twrp: - url: https://images.ecloud.global/stable/twrp/dream2lte/twrp-3.3.1-2-dream2lte.img - filePath: twrp-3.3.1-2-dream2lte.img + url: https://images.ecloud.global/dev/hotdogb/e-0.23-r-20220405175826-dev-hotdogb.zip + filePath: e-0.23-r-20220405175826-dev-hotdogb.zip + twrp: + url: https://images.ecloud.global/dev/hotdogb/recovery-e-0.23-r-20220405175826-dev-hotdogb.img + filePath: recovery-e-0.23-r-20220405175826-dev-hotdogb.img + patch: + url: https://images.ecloud.global/dev/hotdogb/e-0.23-r-20220405175826-dev-hotdogb.zip + filePath: e-0.23-r-20220405175826-dev-hotdogb.zip diff --git a/src/main/resources/yaml/hotdogb_flash.yml b/src/main/resources/yaml/hotdogb_flash.yml deleted file mode 100644 index a28d9b5b..00000000 --- a/src/main/resources/yaml/hotdogb_flash.yml +++ /dev/null @@ -1,127 +0,0 @@ -## Copyright 2022 - ECORP SAS - -## 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 . -## Author: Frank Preel ---- -stepsCount: 6 -steps: - f0: - type: custom - stepNumber: 1 - nextStepKey: f1 - titleKey: stepTitle_enableOemUnlock - titleIconName: icon-download.png - instructions: - - install_instr_openSettings - - install_instr_searchOEM - - install_instr_enableOEMUnlocking - - install_instr_acceptOEMUnlockWarning - - install_instr_onceDoneThenContinue - f1: - type: load - stepNumber: 2 - nextStepKey: f2 - titleKey: stepTitle_rebootBootloader - instructions: - - install_instr_rebootingOnBootloader - averageTime: 12 - script: reboot-fastboot - parameters: - device_id: ${DEVICE_ID} - fastboot_folder_path: ${ADB_FOLDER_PATH} - okCodes: - 0: ~ - koCodes: - 1: script_error_unknown - 10: script_error_cantRebootBootloader - 101: script_error_serialNumber_missing - 102: script_error_fastboot_path_missing - f2: - type: custom-executable - stepNumber: 3 - nextStepKey: f3 - titleKey: stepTitle_oemUnlock - titleIconName: icon-download.png - instructions: - - install_instr_pressVolDownToAcceptOEMUnlocking - - install_instr_unlockingOem - - install_instr_waitInstallStartAuto - script: emerald-flashingUnlock - parameters: - device_id: ${DEVICE_ID} - fastboot_folder_path: ${ADB_FOLDER_PATH} - okCodes: - 0: ~ - koCodes: - 1: script_error_unknown - 2: script_error_fastboot_flashingUnlock_failed - 101: script_error_serialNumber_missing - 102: script_error_fastboot_path_missing - - f3: - type: load - stepNumber: 4 - nextStepKey: f4 - titleKey: stepTitle_installOS - instructions: - - install_instr_eosInstall - averageTime: 200 - script: emerald-install-from-bootloader - parameters: - device_id: ${DEVICE_ID} - archive_path: ${ARCHIVE_PATH} - fastboot_folder_path: ${ADB_FOLDER_PATH} - java_folder_path: ${JAVA_FOLDER_PATH} - okCodes: - 0: ~ - koCodes: - 1: script_error_unknown - 10: script_error_cantUnpackSources - 11: script_error_cantWipeData - 12: script_error_cantWipeData - 20: script_error_cantFlashGz_a - 21: script_error_cantFlashLk_a - 22: script_error_cantFlashMd1img_a - 23: script_error_cantFlashScp_a - 24: script_error_cantFlashSpmfw_a - 25: script_error_cantFlashSspm_a - 26: script_error_cantFlashTee_a - 27: script_error_cantFlashBoot_a - 28: script_error_cantFlashDtbo_a - 29: script_error_cantFlashVbmeta_a - 30: script_error_cantFlashSuper - 101: script_error_serialNumber_missing - 102: script_error_installFromFastboot_102 - 103: script_error_fastboot_path_missing - f4: - type: askAccount - stepNumber: 5 - nextStepKey: f5 - f5: - type: custom-executable - stepNumber: 6 - nextStepKey: end - titleKey: stepTitle_rebootDevice - titleIconName: icon-download.png - instructions: - - install_instr_onceDeviceRebootThenContinue - script: emerald-wait-reboot-from-fastboot - parameters: - fastboot_folder_path: ${ADB_FOLDER_PATH} - okCodes: - 0: ~ - koCodes: - 1: script_error_unknown - 10: script_error_cantrebootFromFasboot - 101: script_error_noDeviceFoundInFastboot -- GitLab From 77c95c9ca981352d9a1a5463a0d14dce44d73c2d Mon Sep 17 00:00:00 2001 From: frankpreel Date: Wed, 18 May 2022 12:45:35 +0200 Subject: [PATCH 15/22] Functional Windows process --- .../windows/emerald-flashingUnlock.bat | 4 +- flash-scripts/windows/install-e-recovery.bat | 85 ++++++++++--------- .../windows/install-from-e-recovery.bat | 11 ++- .../windows/oneplus-flashingUnlock.bat | 54 ++++++++++++ 4 files changed, 111 insertions(+), 43 deletions(-) create mode 100644 flash-scripts/windows/oneplus-flashingUnlock.bat diff --git a/flash-scripts/windows/emerald-flashingUnlock.bat b/flash-scripts/windows/emerald-flashingUnlock.bat index ddd1db8e..75b2ba9f 100755 --- a/flash-scripts/windows/emerald-flashingUnlock.bat +++ b/flash-scripts/windows/emerald-flashingUnlock.bat @@ -39,7 +39,9 @@ IF not defined %FASTBOOT_FOLDER_PATH ( SET FASTBOOT_PATH="%FASTBOOT_FOLDER_PATH%fastboot" %FASTBOOT_PATH% -s %DEVICE_ID% flashing unlock -if errorlevel 1 ( exit /b 2 ) +if errorlevel 1 ( + exit /b 2 +) timeout 1 >nul 2>&1 exit /b 0 diff --git a/flash-scripts/windows/install-e-recovery.bat b/flash-scripts/windows/install-e-recovery.bat index e83c0f78..78cc8fc1 100644 --- a/flash-scripts/windows/install-e-recovery.bat +++ b/flash-scripts/windows/install-e-recovery.bat @@ -1,48 +1,57 @@ -#!/bin/bash - -# Copyright (C) 2022 ECORP SAS - Author: Frank Preel -# -# 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: FASTBOOT_PATH -# $2: E_IMAGE_PATH need twrp path -# Exit status -# - 0 : Recovery installed -# - 101 : FASTBOOT_PATH missing -# - 102 : E_IMAGE_PATH missing - @echo off +:: !/bin/bash + +:: Copyright (C) 2022 ECORP SAS - Author: Frank Preel + +:: 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: FASTBOOT_PATH +:: $2: E_IMAGE_PATH need twrp path +:: Exit status +:: - 0 : Recovery installed +:: - 101 : FASTBOOT_PATH missing +:: - 102 : E_IMAGE_PATH missing + SET FASTBOOT_PATH=%~1 -SET %~1E_IMAGE_PATH=%~2 -IF "-z" "%FASTBOOT_PATH%" ( +SET E_IMAGE_PATH=%~2 + +IF not defined %FASTBOOT_PATH ( echo "Fastboot path is empty" - exit "101" + exit /b 101 ) -IF "-z" "%E_IMAGE_PATH%" ( + +IF not defined %E_IMAGE_PATH ( echo "E Image path is empty" - exit "102" + exit /b 102 ) -SET FASTBOOT_CMD=%FASTBOOT_PATH%"fastboot" -SET %FASTBOOT_PATH%ADB_CMD=%FASTBOOT_PATH%"adb" -IF ! "%FASTBOOT_CMD%" "erase" "userdata" ( - exit "11" +SET FASTBOOT_CMD="%FASTBOOT_PATH%fastboot" +SET ADB_CMD="%FASTBOOT_PATH%adb" + +%FASTBOOT_CMD% erase userdata +if errorlevel 1 ( + exit /b 11 ) + echo "user data wiped" -sleep "1" -IF ! "%FASTBOOT_CMD%" "erase" "metadata" ( - exit "12" + +timeout 1 >nul 2>&1 + +%FASTBOOT_CMD% erase metadata +if errorlevel 1 ( + exit /b 12 ) -"$FASTBOOT_CMD" "flash" "boot" "%E_IMAGE_PATH%" + +%FASTBOOT_CMD% flash boot %E_IMAGE_PATH% diff --git a/flash-scripts/windows/install-from-e-recovery.bat b/flash-scripts/windows/install-from-e-recovery.bat index 5b4f5d96..cc87ba30 100644 --- a/flash-scripts/windows/install-from-e-recovery.bat +++ b/flash-scripts/windows/install-from-e-recovery.bat @@ -41,10 +41,13 @@ SET FASTBOOT_FOLDER_PATH=%~3 SET ADB_CMD="%FASTBOOT_FOLDER_PATH%adb" "%ADB_CMD%" "sideload" "%ARCHIVE_FILE%" -if not errorlevel 1 ( +if errorlevel==0 ( echo "Sideload OK" exit /b 0 -) ELSE ( - echo "Sideload fails" - exit /b 1 ) +if errorlevel==1 ( + echo "Sideload OK" + exit /b 0 +) +echo "Sideload fails" +exit /b 1 diff --git a/flash-scripts/windows/oneplus-flashingUnlock.bat b/flash-scripts/windows/oneplus-flashingUnlock.bat new file mode 100644 index 00000000..a46ff43d --- /dev/null +++ b/flash-scripts/windows/oneplus-flashingUnlock.bat @@ -0,0 +1,54 @@ +@echo off + +:: Coyright (C) 2022 ECORP SAS - Author: Frank Preel + +:: 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: device id +:: $2: fastboot folder path + +:: Exit status +:: - 0 : bootloader locked +:: - 1 : unknown error +:: - 2 : Flashing unlocked failed +:: - 101 : $DEVICE_ID missing +:: - 102 : $FASTBOOT_FOLDER_PATH is missing + + +SET DEVICE_ID=%~1 +SET FASTBOOT_FOLDER_PATH=%~2 + +IF not defined %DEVICE_ID ( + exit /b 101 +) +IF not defined %FASTBOOT_FOLDER_PATH ( + exit /b 102 +) + +SET FASTBOOT_PATH="%FASTBOOT_FOLDER_PATH%fastboot" +%FASTBOOT_PATH% -s %DEVICE_ID% flashing unlock +if errorlevel 1 ( + %FASTBOOT_PATH% -s %DEVICE_ID% flashing unlock 2>&1 | findstr "Device already : unlocked" + if errorlevel 0 ( + echo "The device is unlocked" + %FASTBOOT_PATH% -s %DEVICE_ID% reboot + timeout 30 >nul 2>&1 + exit /b 0 + ) + exit /b 2 +) + +timeout 30 >nul 2>&1 +exit /b 0 -- GitLab From 22820cd05256004454afb1ef5c28fe989dc876a4 Mon Sep 17 00:00:00 2001 From: Frank Preel Date: Wed, 18 May 2022 17:32:31 +0200 Subject: [PATCH 16/22] Functional 1+8 linux --- flash-scripts/linux/install-e-recovery.sh | 22 +- flash-scripts/linux/oneplus-flashingUnlock.sh | 30 ++- .../easy/installer/helpers/DeviceHelper.java | 1 + .../resources/lang/translation.properties | 1 + .../lang/translation_fr_FR.properties | 1 + src/main/resources/yaml/OnePlus8_flash.yml | 218 ++++++++++++++++++ src/main/resources/yaml/OnePlus8_fs.yml | 26 +++ 7 files changed, 276 insertions(+), 23 deletions(-) create mode 100644 src/main/resources/yaml/OnePlus8_flash.yml create mode 100644 src/main/resources/yaml/OnePlus8_fs.yml diff --git a/flash-scripts/linux/install-e-recovery.sh b/flash-scripts/linux/install-e-recovery.sh index 91c9a0b5..ce789881 100755 --- a/flash-scripts/linux/install-e-recovery.sh +++ b/flash-scripts/linux/install-e-recovery.sh @@ -46,18 +46,18 @@ FASTBOOT_CMD=${FASTBOOT_PATH}"fastboot" ADB_CMD=${FASTBOOT_PATH}"adb" # Wipe user data -if ! "$FASTBOOT_CMD" erase userdata ; -then - exit 11 -fi +#if ! "$FASTBOOT_CMD" erase userdata ; +#then +# exit 11 +#fi -echo "user data wiped" -sleep 1 +#echo "user data wiped" +#sleep 1 -if ! "$FASTBOOT_CMD" erase metadata ; -then - exit 12 -fi +#if ! "$FASTBOOT_CMD" erase metadata ; +#then +# exit 12 +#fi -"$FASTBOOT_CMD" flash boot ${E_IMAGE_PATH} +echo "$FASTBOOT_CMD" flash recovery ${E_IMAGE_PATH} diff --git a/flash-scripts/linux/oneplus-flashingUnlock.sh b/flash-scripts/linux/oneplus-flashingUnlock.sh index 763b8d2d..5c08fcba 100755 --- a/flash-scripts/linux/oneplus-flashingUnlock.sh +++ b/flash-scripts/linux/oneplus-flashingUnlock.sh @@ -44,19 +44,25 @@ fi # Build fastboot path FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" -# Unlock bootloader -if ! "$FASTBOOT_PATH" -s "$DEVICE_ID" oem unlock -then - if ! "$FASTBOOT_PATH" -s "$DEVICE_ID" oem unlock 2>&1 | grep "Device already : unlocked" - then - exit 2 - fi - echo "The device is unlocked" - - if ! "$FASTBOOT_PATH" -s "$DEVICE_ID" reboot +if [ "$($FASTBOOT_PATH getvar unlocked 2>&1 | grep -q yes; echo $?)" = 1 ] +then + # Unlock bootloader + if ! "$FASTBOOT_PATH" -s "$DEVICE_ID" oem unlock then - exit 2 + exit 2 fi +else + sleep 30 + # Already unlocked use the same way + "$FASTBOOT_PATH" -s "$DEVICE_ID" reboot + exit 0 fi -sleep 30 +while [ "$($FASTBOOT_PATH getvar unlocked 2>&1 | grep -q yes; echo $?)" = 1 ] +do + echo "locked" + sleep 1 +done + +echo "unlock.." +sleep 1 diff --git a/src/main/java/ecorp/easy/installer/helpers/DeviceHelper.java b/src/main/java/ecorp/easy/installer/helpers/DeviceHelper.java index 45fe31fb..346ca1a6 100644 --- a/src/main/java/ecorp/easy/installer/helpers/DeviceHelper.java +++ b/src/main/java/ecorp/easy/installer/helpers/DeviceHelper.java @@ -52,6 +52,7 @@ public class DeviceHelper { put("Teracube_2e", "0011"); put("emerald", "0012"); //Teracube A10 put("OnePlus7T", "0013"); + put("OnePlus8", "0014"); }}; /** diff --git a/src/main/resources/lang/translation.properties b/src/main/resources/lang/translation.properties index 7ea3a388..4efc051c 100644 --- a/src/main/resources/lang/translation.properties +++ b/src/main/resources/lang/translation.properties @@ -123,6 +123,7 @@ install_instr_readAllWarning=Read all instructions before to start install_instr_followOfficialGuidanceAt=Follow official guidance at install_instr_selectUnlockBootloader=Select "UNLOCK BOOTLOADER" with "Volume" button install_instr_unlockBootloader=Confirm with "Power" button. After that the phone will reboot automatically +install_instr_unlockBootloader_already=If your phone is already unlocked, you don't have to do anything. The phone will then restart automatically install_instr_selectLockBootloader=Select "LOCK BOOTLOADER" with "Volume" button install_instr_lockBootloader=Confirm with "Power" button. After that the phone will reboot automatically install_instr_bootWarning= On the boot warning screen, you have 5 seconds to press "Volume Down", to enter options menu. diff --git a/src/main/resources/lang/translation_fr_FR.properties b/src/main/resources/lang/translation_fr_FR.properties index 88a23e1e..fb2ca371 100644 --- a/src/main/resources/lang/translation_fr_FR.properties +++ b/src/main/resources/lang/translation_fr_FR.properties @@ -245,6 +245,7 @@ install_instr_tapRebootPowerOff=Tapez sur 'Éteindre' install_instr_followOfficialGuidanceAt=Suivez le guide officiel sur install_instr_selectUnlockBootloader=Sélectionnez "UNLOCK BOOTLOADER" avec le bouton "Volume" install_instr_unlockBootloader=Confirmez avec le bouton "Marche/Arrêt". Le téléphone va ensuite redémarrer automatiquement +install_instr_unlockBootloader_already=Si votre téléphone est déjà dévérouillé, vous n'avez rien à faire. Le téléphone va ensuite redémarrer automatiquement install_instr_selectLockBootloader=Sélectionnez "LOCK BOOTLOADER" avec le bouton "Volume" install_instr_lockBootloader=Confirmez avec le bouton "Marche/Arrêt". Le téléphone va ensuite redémarrer automatiquement install_instr_bootWarning=Sur l'écran d'avertissement au démarrage, appuyez sur le bouton "Volume moins" pour entrer dans le menu des options diff --git a/src/main/resources/yaml/OnePlus8_flash.yml b/src/main/resources/yaml/OnePlus8_flash.yml new file mode 100644 index 00000000..4ac402a3 --- /dev/null +++ b/src/main/resources/yaml/OnePlus8_flash.yml @@ -0,0 +1,218 @@ +## Copyright 2022 - ECORP SAS + +## 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 . +## Author: Frank Preel +--- +stepsCount: 12 +steps: + f0: + type: custom + stepNumber: 1 + nextStepKey: f1 + titleKey: stepTitle_enableOemUnlock + titleIconName: icon-download.png + instructions: + - install_instr_openSettings + - install_instr_searchOEM + - install_instr_enableOEMUnlocking + - install_instr_acceptOEMUnlockWarning + - install_instr_onceDoneThenContinue + f1: + type: load + stepNumber: 2 + nextStepKey: f2 + titleKey: stepTitle_rebootBootloader + instructions: + - install_instr_rebootingOnBootloader + averageTime: 10 + script: reboot-fastboot + parameters: + device_id: ${DEVICE_ID} + fastboot_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_unknown + 10: script_error_cantRebootBootloader + 101: script_error_serialNumber_missing + 102: script_error_fastboot_path_missing + f2: + type: custom-executable + stepNumber: 3 + nextStepKey: f3 + titleKey: stepTitle_oemUnlock + titleIconName: icon-download.png + instructions: + - install_instr_unlockingOem + - install_instr_selectUnlockBootloader + - install_instr_unlockBootloader + - install_instr_unlockBootloader_already + script: oneplus-flashingUnlock + parameters: + device_id: ${DEVICE_ID} + fastboot_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_unknown + 2: script_error_fastboot_flashingUnlock_failed + 101: script_error_serialNumber_missing + 102: script_error_fastboot_path_missing + f3: + type: custom + stepNumber: 4 + nextStepKey: f4 + titleKey: devMode_mTitle_main + titleIconName: icon-download.png + instructions: + - devMode_main + - devMode_lbl + - devMode_instr_settings + - devMode_instr_build + - devMode_instr_tap7 + - debugADB_instr_settings + - debugADB_instr_search + - debugADB_instr_androidDebug + - debugADB_instr_debugOn + - debugADB_instr_tapeOK + - debugADB_instr_acceptCertificate + f4: + type: load + stepNumber: 5 + nextStepKey: f5 + titleKey: stepTitle_rebootBootloader + instructions: + - install_instr_rebootingOnBootloader + averageTime: 8 + script: reboot-fastboot + parameters: + device_id: ${DEVICE_ID} + fastboot_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_unknown + 10: script_error_cantRebootBootloader + 101: script_error_serialNumber_missing + 102: script_error_fastboot_path_missing + f5: + type: load + stepNumber: 6 + nextStepKey: f6 + titleKey: stepTitle4On7 + instructions: + - install_instr_recoveryInstall + averageTime: 3 + script: install-e-recovery + parameters: + fastboot_folder_path: ${ADB_FOLDER_PATH} + twrp_image_path: ${TWRP_IMAGE_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_unknown + 101: script_error_installRecovery_101 + f6: + type: custom-executable + stepNumber: 7 + nextStepKey: f7 + titleKey: stepTitle5On7 + instructions: + - install_instr_choose_e_recovery_select + - install_instr_choose_e_recovery_select_details + - install_instr_choose_e_recovery_validate + - install_instr_choose_e_recovery_validate_wait_for_result + - install_instr_e_recovery_apply_update + - install_instr_e_recovery_apply_update_from_adb + - install_instr_e_recovery_apply_update_from_adb_wait_for_result + titleKeyIconName: icon-download.png + script: wait-e-recovery-sideload + parameters: + device_id: ${DEVICE_ID} + adb_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 101: script_error_waitSideload_101 + f7: + type: load + stepNumber: 8 + nextStepKey: f8 + titleKey: install_instr_eosInstall + instructions: + - install_instr_e_recovery_oneplus_select_recovery + averageTime: 150 + script: install-from-e-recovery + parameters: + device_id: ${DEVICE_ID} + archive_path: ${PATCH_PATH} + adb_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_installFromSideload + f8: + type: custom-executable + stepNumber: 9 + nextStepKey: f9 + titleKey: stepTitle_installation + instructions: + - install_instr_e_recovery_back + - install_instr_e_recovery_factory_reset + - install_instr_e_recovery_factory_reset_format_data + - install_instr_e_recovery_factory_reset_format_data_validate + - install_instr_e_recovery_back + - install_instr_e_recovery_apply_update + - install_instr_e_recovery_apply_update_from_adb + - install_instr_e_recovery_apply_update_from_adb_wait_for_result + titleKeyIconName: icon-download.png + script: wait-e-recovery-sideload + parameters: + device_id: ${DEVICE_ID} + adb_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 101: script_error_waitSideload_101 + f9: + type: load + stepNumber: 10 + nextStepKey: f10 + titleKey: install_instr_eosInstall + instructions: + - install_instr_e_recovery_oneplus_select_recovery + averageTime: 150 + script: install-from-e-recovery + parameters: + device_id: ${DEVICE_ID} + archive_path: ${ARCHIVE_PATH} + adb_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_installFromSideload + f10: + type: askAccount + stepNumber: 11 + nextStepKey: f11 + f11: + type: custom + stepNumber: 12 + nextStepKey: end + titleKey: stepTitle_rebootDevice + instructions: + - install_instr_e_recovery_back + - install_instr_e_recovery_reboot + - eAccount_lbl_alreadyAccount + titleKeyIconName: icon-download.png diff --git a/src/main/resources/yaml/OnePlus8_fs.yml b/src/main/resources/yaml/OnePlus8_fs.yml new file mode 100644 index 00000000..007c6082 --- /dev/null +++ b/src/main/resources/yaml/OnePlus8_fs.yml @@ -0,0 +1,26 @@ +## Copyright 2022 - ECORP SAS + +## 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 . +## Author: Frank Preel +--- +sources: + rom: + url: https://images.ecloud.global/dev/instantnoodle/e-0.23-r-20220405175826-dev-instantnoodle.zip + filePath: e-0.23-r-20220405175826-dev-instantnoodle.zip + twrp: + url: https://images.ecloud.global/dev/instantnoodle/recovery-e-0.23-r-20220405175826-dev-instantnoodle.img + filePath: recovery-e-0.23-r-20220405175826-dev-instantnoodle.img + patch: + url: https://images.ecloud.global/dev/instantnoodle/e-0.23-r-20220405175826-dev-instantnoodle.zip + filePath: e-0.23-r-20220405175826-dev-instantnoodle.zip -- GitLab From ddf3a231109b1438f5c5e6a5ce1c8defb67c18bc Mon Sep 17 00:00:00 2001 From: Frank Preel Date: Wed, 18 May 2022 17:39:11 +0200 Subject: [PATCH 17/22] 1+7T better process --- src/main/resources/yaml/OnePlus7T_flash.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/resources/yaml/OnePlus7T_flash.yml b/src/main/resources/yaml/OnePlus7T_flash.yml index ebe07760..4ac402a3 100644 --- a/src/main/resources/yaml/OnePlus7T_flash.yml +++ b/src/main/resources/yaml/OnePlus7T_flash.yml @@ -48,14 +48,16 @@ steps: 101: script_error_serialNumber_missing 102: script_error_fastboot_path_missing f2: - type: load + type: custom-executable stepNumber: 3 nextStepKey: f3 titleKey: stepTitle_oemUnlock titleIconName: icon-download.png - averageTime: 25 instructions: - install_instr_unlockingOem + - install_instr_selectUnlockBootloader + - install_instr_unlockBootloader + - install_instr_unlockBootloader_already script: oneplus-flashingUnlock parameters: device_id: ${DEVICE_ID} -- GitLab From 146b1cfd67eb3e69b46df78fbe2f80ebcbc3fe0e Mon Sep 17 00:00:00 2001 From: Frank Preel Date: Wed, 18 May 2022 17:57:40 +0200 Subject: [PATCH 18/22] Windows & typo fix --- flash-scripts/linux/install-e-recovery.sh | 3 +- flash-scripts/windows/install-e-recovery.bat | 22 ++++++------- .../windows/oneplus-flashingUnlock.bat | 31 ++++++++++++------- 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/flash-scripts/linux/install-e-recovery.sh b/flash-scripts/linux/install-e-recovery.sh index ce789881..b31a2a0d 100755 --- a/flash-scripts/linux/install-e-recovery.sh +++ b/flash-scripts/linux/install-e-recovery.sh @@ -59,5 +59,4 @@ ADB_CMD=${FASTBOOT_PATH}"adb" # exit 12 #fi - -echo "$FASTBOOT_CMD" flash recovery ${E_IMAGE_PATH} +"$FASTBOOT_CMD" flash recovery ${E_IMAGE_PATH} diff --git a/flash-scripts/windows/install-e-recovery.bat b/flash-scripts/windows/install-e-recovery.bat index 78cc8fc1..9fac9a3c 100644 --- a/flash-scripts/windows/install-e-recovery.bat +++ b/flash-scripts/windows/install-e-recovery.bat @@ -40,18 +40,16 @@ IF not defined %E_IMAGE_PATH ( SET FASTBOOT_CMD="%FASTBOOT_PATH%fastboot" SET ADB_CMD="%FASTBOOT_PATH%adb" -%FASTBOOT_CMD% erase userdata -if errorlevel 1 ( - exit /b 11 -) - -echo "user data wiped" +:: %FASTBOOT_CMD% erase userdata +:: if errorlevel 1 ( +:: exit /b 11 +:: ) -timeout 1 >nul 2>&1 +:: timeout 1 >nul 2>&1 -%FASTBOOT_CMD% erase metadata -if errorlevel 1 ( - exit /b 12 -) +:: %FASTBOOT_CMD% erase metadata +:: if errorlevel 1 ( +:: exit /b 12 +:: ) -%FASTBOOT_CMD% flash boot %E_IMAGE_PATH% +%FASTBOOT_CMD% flash recovery %E_IMAGE_PATH% diff --git a/flash-scripts/windows/oneplus-flashingUnlock.bat b/flash-scripts/windows/oneplus-flashingUnlock.bat index a46ff43d..46cc5bd6 100644 --- a/flash-scripts/windows/oneplus-flashingUnlock.bat +++ b/flash-scripts/windows/oneplus-flashingUnlock.bat @@ -38,17 +38,26 @@ IF not defined %FASTBOOT_FOLDER_PATH ( ) SET FASTBOOT_PATH="%FASTBOOT_FOLDER_PATH%fastboot" -%FASTBOOT_PATH% -s %DEVICE_ID% flashing unlock -if errorlevel 1 ( - %FASTBOOT_PATH% -s %DEVICE_ID% flashing unlock 2>&1 | findstr "Device already : unlocked" - if errorlevel 0 ( - echo "The device is unlocked" - %FASTBOOT_PATH% -s %DEVICE_ID% reboot - timeout 30 >nul 2>&1 - exit /b 0 - ) - exit /b 2 + +%FASTBOOT_PATH% -s %DEVICE_ID% flashing unlock 2>&1 | findstr yes +if errorlevel 0 ( + echo "The device is unlocked" + %FASTBOOT_PATH% -s %DEVICE_ID% reboot + timeout 30 >nul 2>&1 + exit /b 0 +) else ( + %FASTBOOT_PATH% -s %DEVICE_ID% flashing unlock + if errorlevel 1 ( + exit /b 2 ) -timeout 30 >nul 2>&1 +:fastboot_detect +%FASTBOOT_PATH% getvar unlocked 2>&1 | findstr yes +if errorLevel 1 ( + timeout 2 >nul 2>&1 + goto :fastboot_detect +) + +call fastboot_detect + exit /b 0 -- GitLab From ff7e5264eefc061f7319991d85881b9a4855b3ed Mon Sep 17 00:00:00 2001 From: frankpreel Date: Wed, 18 May 2022 18:24:04 +0200 Subject: [PATCH 19/22] Typo --- flash-scripts/windows/oneplus-flashingUnlock.bat | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/flash-scripts/windows/oneplus-flashingUnlock.bat b/flash-scripts/windows/oneplus-flashingUnlock.bat index 46cc5bd6..27ba4901 100644 --- a/flash-scripts/windows/oneplus-flashingUnlock.bat +++ b/flash-scripts/windows/oneplus-flashingUnlock.bat @@ -39,21 +39,22 @@ IF not defined %FASTBOOT_FOLDER_PATH ( SET FASTBOOT_PATH="%FASTBOOT_FOLDER_PATH%fastboot" -%FASTBOOT_PATH% -s %DEVICE_ID% flashing unlock 2>&1 | findstr yes +%FASTBOOT_PATH% getvar unlocked 2>&1 | findstr "yes" if errorlevel 0 ( echo "The device is unlocked" %FASTBOOT_PATH% -s %DEVICE_ID% reboot timeout 30 >nul 2>&1 exit /b 0 ) else ( + echo "The device is locked" %FASTBOOT_PATH% -s %DEVICE_ID% flashing unlock - if errorlevel 1 ( - exit /b 2 + if errorlevel 1 ( exit /b 2) ) :fastboot_detect -%FASTBOOT_PATH% getvar unlocked 2>&1 | findstr yes +%FASTBOOT_PATH% getvar unlocked 2>&1 | findstr "yes" if errorLevel 1 ( + echo "..." timeout 2 >nul 2>&1 goto :fastboot_detect ) -- GitLab From 247a4a287f537fb0b2d6c072ea0d84709adc759a Mon Sep 17 00:00:00 2001 From: Frank Preel Date: Fri, 20 May 2022 12:24:41 +0200 Subject: [PATCH 20/22] Model detection by forking similar device --- .../easy/installer/helpers/DeviceHelper.java | 1 + src/main/resources/yaml/sunfish_flash.yml | 218 ++++++++++++++++++ src/main/resources/yaml/sunfish_fs.yml | 26 +++ 3 files changed, 245 insertions(+) create mode 100644 src/main/resources/yaml/sunfish_flash.yml create mode 100644 src/main/resources/yaml/sunfish_fs.yml diff --git a/src/main/java/ecorp/easy/installer/helpers/DeviceHelper.java b/src/main/java/ecorp/easy/installer/helpers/DeviceHelper.java index 346ca1a6..a84e61aa 100644 --- a/src/main/java/ecorp/easy/installer/helpers/DeviceHelper.java +++ b/src/main/java/ecorp/easy/installer/helpers/DeviceHelper.java @@ -53,6 +53,7 @@ public class DeviceHelper { put("emerald", "0012"); //Teracube A10 put("OnePlus7T", "0013"); put("OnePlus8", "0014"); + put("sunfish", "0015"); }}; /** diff --git a/src/main/resources/yaml/sunfish_flash.yml b/src/main/resources/yaml/sunfish_flash.yml new file mode 100644 index 00000000..4ac402a3 --- /dev/null +++ b/src/main/resources/yaml/sunfish_flash.yml @@ -0,0 +1,218 @@ +## Copyright 2022 - ECORP SAS + +## 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 . +## Author: Frank Preel +--- +stepsCount: 12 +steps: + f0: + type: custom + stepNumber: 1 + nextStepKey: f1 + titleKey: stepTitle_enableOemUnlock + titleIconName: icon-download.png + instructions: + - install_instr_openSettings + - install_instr_searchOEM + - install_instr_enableOEMUnlocking + - install_instr_acceptOEMUnlockWarning + - install_instr_onceDoneThenContinue + f1: + type: load + stepNumber: 2 + nextStepKey: f2 + titleKey: stepTitle_rebootBootloader + instructions: + - install_instr_rebootingOnBootloader + averageTime: 10 + script: reboot-fastboot + parameters: + device_id: ${DEVICE_ID} + fastboot_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_unknown + 10: script_error_cantRebootBootloader + 101: script_error_serialNumber_missing + 102: script_error_fastboot_path_missing + f2: + type: custom-executable + stepNumber: 3 + nextStepKey: f3 + titleKey: stepTitle_oemUnlock + titleIconName: icon-download.png + instructions: + - install_instr_unlockingOem + - install_instr_selectUnlockBootloader + - install_instr_unlockBootloader + - install_instr_unlockBootloader_already + script: oneplus-flashingUnlock + parameters: + device_id: ${DEVICE_ID} + fastboot_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_unknown + 2: script_error_fastboot_flashingUnlock_failed + 101: script_error_serialNumber_missing + 102: script_error_fastboot_path_missing + f3: + type: custom + stepNumber: 4 + nextStepKey: f4 + titleKey: devMode_mTitle_main + titleIconName: icon-download.png + instructions: + - devMode_main + - devMode_lbl + - devMode_instr_settings + - devMode_instr_build + - devMode_instr_tap7 + - debugADB_instr_settings + - debugADB_instr_search + - debugADB_instr_androidDebug + - debugADB_instr_debugOn + - debugADB_instr_tapeOK + - debugADB_instr_acceptCertificate + f4: + type: load + stepNumber: 5 + nextStepKey: f5 + titleKey: stepTitle_rebootBootloader + instructions: + - install_instr_rebootingOnBootloader + averageTime: 8 + script: reboot-fastboot + parameters: + device_id: ${DEVICE_ID} + fastboot_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_unknown + 10: script_error_cantRebootBootloader + 101: script_error_serialNumber_missing + 102: script_error_fastboot_path_missing + f5: + type: load + stepNumber: 6 + nextStepKey: f6 + titleKey: stepTitle4On7 + instructions: + - install_instr_recoveryInstall + averageTime: 3 + script: install-e-recovery + parameters: + fastboot_folder_path: ${ADB_FOLDER_PATH} + twrp_image_path: ${TWRP_IMAGE_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_unknown + 101: script_error_installRecovery_101 + f6: + type: custom-executable + stepNumber: 7 + nextStepKey: f7 + titleKey: stepTitle5On7 + instructions: + - install_instr_choose_e_recovery_select + - install_instr_choose_e_recovery_select_details + - install_instr_choose_e_recovery_validate + - install_instr_choose_e_recovery_validate_wait_for_result + - install_instr_e_recovery_apply_update + - install_instr_e_recovery_apply_update_from_adb + - install_instr_e_recovery_apply_update_from_adb_wait_for_result + titleKeyIconName: icon-download.png + script: wait-e-recovery-sideload + parameters: + device_id: ${DEVICE_ID} + adb_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 101: script_error_waitSideload_101 + f7: + type: load + stepNumber: 8 + nextStepKey: f8 + titleKey: install_instr_eosInstall + instructions: + - install_instr_e_recovery_oneplus_select_recovery + averageTime: 150 + script: install-from-e-recovery + parameters: + device_id: ${DEVICE_ID} + archive_path: ${PATCH_PATH} + adb_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_installFromSideload + f8: + type: custom-executable + stepNumber: 9 + nextStepKey: f9 + titleKey: stepTitle_installation + instructions: + - install_instr_e_recovery_back + - install_instr_e_recovery_factory_reset + - install_instr_e_recovery_factory_reset_format_data + - install_instr_e_recovery_factory_reset_format_data_validate + - install_instr_e_recovery_back + - install_instr_e_recovery_apply_update + - install_instr_e_recovery_apply_update_from_adb + - install_instr_e_recovery_apply_update_from_adb_wait_for_result + titleKeyIconName: icon-download.png + script: wait-e-recovery-sideload + parameters: + device_id: ${DEVICE_ID} + adb_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 101: script_error_waitSideload_101 + f9: + type: load + stepNumber: 10 + nextStepKey: f10 + titleKey: install_instr_eosInstall + instructions: + - install_instr_e_recovery_oneplus_select_recovery + averageTime: 150 + script: install-from-e-recovery + parameters: + device_id: ${DEVICE_ID} + archive_path: ${ARCHIVE_PATH} + adb_folder_path: ${ADB_FOLDER_PATH} + okCodes: + 0: ~ + koCodes: + 1: script_error_installFromSideload + f10: + type: askAccount + stepNumber: 11 + nextStepKey: f11 + f11: + type: custom + stepNumber: 12 + nextStepKey: end + titleKey: stepTitle_rebootDevice + instructions: + - install_instr_e_recovery_back + - install_instr_e_recovery_reboot + - eAccount_lbl_alreadyAccount + titleKeyIconName: icon-download.png diff --git a/src/main/resources/yaml/sunfish_fs.yml b/src/main/resources/yaml/sunfish_fs.yml new file mode 100644 index 00000000..007c6082 --- /dev/null +++ b/src/main/resources/yaml/sunfish_fs.yml @@ -0,0 +1,26 @@ +## Copyright 2022 - ECORP SAS + +## 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 . +## Author: Frank Preel +--- +sources: + rom: + url: https://images.ecloud.global/dev/instantnoodle/e-0.23-r-20220405175826-dev-instantnoodle.zip + filePath: e-0.23-r-20220405175826-dev-instantnoodle.zip + twrp: + url: https://images.ecloud.global/dev/instantnoodle/recovery-e-0.23-r-20220405175826-dev-instantnoodle.img + filePath: recovery-e-0.23-r-20220405175826-dev-instantnoodle.img + patch: + url: https://images.ecloud.global/dev/instantnoodle/e-0.23-r-20220405175826-dev-instantnoodle.zip + filePath: e-0.23-r-20220405175826-dev-instantnoodle.zip -- GitLab From bdc52b363ea82fcb51db79d297bdce93ca5dd5d8 Mon Sep 17 00:00:00 2001 From: Frank Preel Date: Fri, 20 May 2022 15:52:26 +0200 Subject: [PATCH 21/22] Functionnal Linux process --- .../linux/install-e-recovery-boot.sh | 64 +++++++++++ flash-scripts/linux/pixel-flashingUnlock.sh | 65 +++++++++++ src/main/resources/yaml/sunfish_flash.yml | 106 +++--------------- src/main/resources/yaml/sunfish_fs.yml | 11 +- 4 files changed, 149 insertions(+), 97 deletions(-) create mode 100755 flash-scripts/linux/install-e-recovery-boot.sh create mode 100755 flash-scripts/linux/pixel-flashingUnlock.sh diff --git a/flash-scripts/linux/install-e-recovery-boot.sh b/flash-scripts/linux/install-e-recovery-boot.sh new file mode 100755 index 00000000..1e09a9c4 --- /dev/null +++ b/flash-scripts/linux/install-e-recovery-boot.sh @@ -0,0 +1,64 @@ +#!/bin/bash + +# Copyright (C) 2022 ECORP SAS - Author: Frank Preel +# +# 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: FASTBOOT_PATH +# $2: E_IMAGE_PATH need twrp path +# Exit status +# - 0 : Recovery installed +# - 101 : FASTBOOT_PATH missing +# - 102 : E_IMAGE_PATH missing + +#This script performs the same kind of job like `install-e-recovery` on the boot partion (rather than recovery patition) + +FASTBOOT_PATH=$1 +E_IMAGE_PATH=$2 + +if [ -z "$FASTBOOT_PATH" ] +then + echo "Fastboot path is empty" + exit 101 +fi + +if [ -z "$E_IMAGE_PATH" ] +then + echo "E Image path is empty" + exit 102 +fi + +#"$FASTBOOT_CMD" reboot bootloader +#sleep 10 + +# Build fastboot and adb commands +FASTBOOT_CMD=${FASTBOOT_PATH}"fastboot" +ADB_CMD=${FASTBOOT_PATH}"adb" + +# Wipe user data +#if ! "$FASTBOOT_CMD" erase userdata ; +#then +# exit 11 +#fi + +#echo "user data wiped" +#sleep 1 + +#if ! "$FASTBOOT_CMD" erase metadata ; +#then +# exit 12 +#fi + +"$FASTBOOT_CMD" flash boot ${E_IMAGE_PATH} diff --git a/flash-scripts/linux/pixel-flashingUnlock.sh b/flash-scripts/linux/pixel-flashingUnlock.sh new file mode 100755 index 00000000..9bdd6d1a --- /dev/null +++ b/flash-scripts/linux/pixel-flashingUnlock.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +# Copyright (C) 2022 ECORP SAS - Author: Frank Preel +# +# 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: device id +# $2: fastboot folder path + +# Exit status +# - 0 : bootloader locked +# - 1 : unknown error +# - 2 : Flashing unlocked failed +# - 101 : $DEVICE_ID missing +# - 102 : $FASTBOOT_FOLDER_PATH is missing + +DEVICE_ID=$1 +FASTBOOT_FOLDER_PATH=$2 + +# check serial number has been provided +if [ -z "$DEVICE_ID" ] +then + exit 101 +fi + +# Check fastboot parent folder path has been provided +if [ -z "$FASTBOOT_FOLDER_PATH" ] +then + exit 102 +fi + +# Build fastboot path +FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" + +if [ "$($FASTBOOT_PATH getvar unlocked 2>&1 | grep -q yes; echo $?)" = 1 ] +then + # Unlock bootloader + if ! "$FASTBOOT_PATH" -s "$DEVICE_ID" flashing unlock + then + exit 2 + fi +else + exit 0 +fi + +while [ "$($FASTBOOT_PATH getvar unlocked 2>&1 | grep -q yes; echo $?)" = 1 ] +do + echo "locked" + sleep 1 +done + +echo "unlock.." +sleep 1 diff --git a/src/main/resources/yaml/sunfish_flash.yml b/src/main/resources/yaml/sunfish_flash.yml index 4ac402a3..b8cba20f 100644 --- a/src/main/resources/yaml/sunfish_flash.yml +++ b/src/main/resources/yaml/sunfish_flash.yml @@ -14,7 +14,7 @@ ## along with this program. If not, see . ## Author: Frank Preel --- -stepsCount: 12 +stepsCount: 8 steps: f0: type: custom @@ -57,8 +57,7 @@ steps: - install_instr_unlockingOem - install_instr_selectUnlockBootloader - install_instr_unlockBootloader - - install_instr_unlockBootloader_already - script: oneplus-flashingUnlock + script: pixel-flashingUnlock parameters: device_id: ${DEVICE_ID} fastboot_folder_path: ${ADB_FOLDER_PATH} @@ -70,51 +69,14 @@ steps: 101: script_error_serialNumber_missing 102: script_error_fastboot_path_missing f3: - type: custom + type: load stepNumber: 4 nextStepKey: f4 - titleKey: devMode_mTitle_main - titleIconName: icon-download.png - instructions: - - devMode_main - - devMode_lbl - - devMode_instr_settings - - devMode_instr_build - - devMode_instr_tap7 - - debugADB_instr_settings - - debugADB_instr_search - - debugADB_instr_androidDebug - - debugADB_instr_debugOn - - debugADB_instr_tapeOK - - debugADB_instr_acceptCertificate - f4: - type: load - stepNumber: 5 - nextStepKey: f5 - titleKey: stepTitle_rebootBootloader - instructions: - - install_instr_rebootingOnBootloader - averageTime: 8 - script: reboot-fastboot - parameters: - device_id: ${DEVICE_ID} - fastboot_folder_path: ${ADB_FOLDER_PATH} - okCodes: - 0: ~ - koCodes: - 1: script_error_unknown - 10: script_error_cantRebootBootloader - 101: script_error_serialNumber_missing - 102: script_error_fastboot_path_missing - f5: - type: load - stepNumber: 6 - nextStepKey: f6 titleKey: stepTitle4On7 instructions: - install_instr_recoveryInstall averageTime: 3 - script: install-e-recovery + script: install-e-recovery-boot parameters: fastboot_folder_path: ${ADB_FOLDER_PATH} twrp_image_path: ${TWRP_IMAGE_PATH} @@ -123,52 +85,16 @@ steps: koCodes: 1: script_error_unknown 101: script_error_installRecovery_101 - f6: + f4: type: custom-executable - stepNumber: 7 - nextStepKey: f7 + stepNumber: 5 + nextStepKey: f5 titleKey: stepTitle5On7 instructions: - install_instr_choose_e_recovery_select - install_instr_choose_e_recovery_select_details - install_instr_choose_e_recovery_validate - install_instr_choose_e_recovery_validate_wait_for_result - - install_instr_e_recovery_apply_update - - install_instr_e_recovery_apply_update_from_adb - - install_instr_e_recovery_apply_update_from_adb_wait_for_result - titleKeyIconName: icon-download.png - script: wait-e-recovery-sideload - parameters: - device_id: ${DEVICE_ID} - adb_folder_path: ${ADB_FOLDER_PATH} - okCodes: - 0: ~ - koCodes: - 101: script_error_waitSideload_101 - f7: - type: load - stepNumber: 8 - nextStepKey: f8 - titleKey: install_instr_eosInstall - instructions: - - install_instr_e_recovery_oneplus_select_recovery - averageTime: 150 - script: install-from-e-recovery - parameters: - device_id: ${DEVICE_ID} - archive_path: ${PATCH_PATH} - adb_folder_path: ${ADB_FOLDER_PATH} - okCodes: - 0: ~ - koCodes: - 1: script_error_installFromSideload - f8: - type: custom-executable - stepNumber: 9 - nextStepKey: f9 - titleKey: stepTitle_installation - instructions: - - install_instr_e_recovery_back - install_instr_e_recovery_factory_reset - install_instr_e_recovery_factory_reset_format_data - install_instr_e_recovery_factory_reset_format_data_validate @@ -185,13 +111,13 @@ steps: 0: ~ koCodes: 101: script_error_waitSideload_101 - f9: + f5: type: load - stepNumber: 10 - nextStepKey: f10 + stepNumber: 6 + nextStepKey: f6 titleKey: install_instr_eosInstall instructions: - - install_instr_e_recovery_oneplus_select_recovery + - install_instr_eosInstall averageTime: 150 script: install-from-e-recovery parameters: @@ -202,13 +128,13 @@ steps: 0: ~ koCodes: 1: script_error_installFromSideload - f10: + f6: type: askAccount - stepNumber: 11 - nextStepKey: f11 - f11: + stepNumber: 7 + nextStepKey: f7 + f7: type: custom - stepNumber: 12 + stepNumber: 8 nextStepKey: end titleKey: stepTitle_rebootDevice instructions: diff --git a/src/main/resources/yaml/sunfish_fs.yml b/src/main/resources/yaml/sunfish_fs.yml index 007c6082..3cf0671c 100644 --- a/src/main/resources/yaml/sunfish_fs.yml +++ b/src/main/resources/yaml/sunfish_fs.yml @@ -16,11 +16,8 @@ --- sources: rom: - url: https://images.ecloud.global/dev/instantnoodle/e-0.23-r-20220405175826-dev-instantnoodle.zip - filePath: e-0.23-r-20220405175826-dev-instantnoodle.zip + url: https://images.ecloud.global/dev/sunfish/e-0.23-r-20220405175826-dev-sunfish.zip + filePath: e-0.23-r-20220405175826-dev-sunfish.zip twrp: - url: https://images.ecloud.global/dev/instantnoodle/recovery-e-0.23-r-20220405175826-dev-instantnoodle.img - filePath: recovery-e-0.23-r-20220405175826-dev-instantnoodle.img - patch: - url: https://images.ecloud.global/dev/instantnoodle/e-0.23-r-20220405175826-dev-instantnoodle.zip - filePath: e-0.23-r-20220405175826-dev-instantnoodle.zip + url: https://images.ecloud.global/dev/sunfish/recovery-e-0.23-r-20220405175826-dev-sunfish.img + filePath: recovery-e-0.23-r-20220405175826-dev-sunfish.img -- GitLab From c12fc4e174473034630bcbe98903eb8636a55bb1 Mon Sep 17 00:00:00 2001 From: Frank Preel Date: Fri, 20 May 2022 16:34:36 +0200 Subject: [PATCH 22/22] Pixel process for windows --- .../windows/install-e-recovery-boot.bat | 55 ++++++++++++++++ .../windows/oneplus-flashingUnlock.bat | 2 +- .../windows/pixel-flashingUnlock.bat | 63 +++++++++++++++++++ 3 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 flash-scripts/windows/install-e-recovery-boot.bat create mode 100644 flash-scripts/windows/pixel-flashingUnlock.bat diff --git a/flash-scripts/windows/install-e-recovery-boot.bat b/flash-scripts/windows/install-e-recovery-boot.bat new file mode 100644 index 00000000..1965aa4e --- /dev/null +++ b/flash-scripts/windows/install-e-recovery-boot.bat @@ -0,0 +1,55 @@ +@echo off + +:: !/bin/bash + +:: Copyright (C) 2022 ECORP SAS - Author: Frank Preel + +:: 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: FASTBOOT_PATH +:: $2: E_IMAGE_PATH need twrp path +:: Exit status +:: - 0 : Recovery installed +:: - 101 : FASTBOOT_PATH missing +:: - 102 : E_IMAGE_PATH missing + +SET FASTBOOT_PATH=%~1 +SET E_IMAGE_PATH=%~2 + +IF not defined %FASTBOOT_PATH ( + echo "Fastboot path is empty" + exit /b 101 +) + +IF not defined %E_IMAGE_PATH ( + echo "E Image path is empty" + exit /b 102 +) +SET FASTBOOT_CMD="%FASTBOOT_PATH%fastboot" +SET ADB_CMD="%FASTBOOT_PATH%adb" + +:: %FASTBOOT_CMD% erase userdata +:: if errorlevel 1 ( +:: exit /b 11 +:: ) + +:: timeout 1 >nul 2>&1 + +:: %FASTBOOT_CMD% erase metadata +:: if errorlevel 1 ( +:: exit /b 12 +:: ) + +%FASTBOOT_CMD% flash boot %E_IMAGE_PATH% diff --git a/flash-scripts/windows/oneplus-flashingUnlock.bat b/flash-scripts/windows/oneplus-flashingUnlock.bat index 27ba4901..f1e327ef 100644 --- a/flash-scripts/windows/oneplus-flashingUnlock.bat +++ b/flash-scripts/windows/oneplus-flashingUnlock.bat @@ -47,7 +47,7 @@ if errorlevel 0 ( exit /b 0 ) else ( echo "The device is locked" - %FASTBOOT_PATH% -s %DEVICE_ID% flashing unlock + %FASTBOOT_PATH% -s %DEVICE_ID% oem unlock if errorlevel 1 ( exit /b 2) ) diff --git a/flash-scripts/windows/pixel-flashingUnlock.bat b/flash-scripts/windows/pixel-flashingUnlock.bat new file mode 100644 index 00000000..cf1a04ef --- /dev/null +++ b/flash-scripts/windows/pixel-flashingUnlock.bat @@ -0,0 +1,63 @@ +@echo off + +:: Coyright (C) 2022 ECORP SAS - Author: Frank Preel + +:: 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: device id +:: $2: fastboot folder path + +:: Exit status +:: - 0 : bootloader locked +:: - 1 : unknown error +:: - 2 : Flashing unlocked failed +:: - 101 : $DEVICE_ID missing +:: - 102 : $FASTBOOT_FOLDER_PATH is missing + + +SET DEVICE_ID=%~1 +SET FASTBOOT_FOLDER_PATH=%~2 + +IF not defined %DEVICE_ID ( + exit /b 101 +) +IF not defined %FASTBOOT_FOLDER_PATH ( + exit /b 102 +) + +SET FASTBOOT_PATH="%FASTBOOT_FOLDER_PATH%fastboot" + +%FASTBOOT_PATH% getvar unlocked 2>&1 | findstr "yes" +if errorlevel 0 ( + echo "The device is unlocked" + timeout 1 >nul 2>&1 + exit /b 0 +) else ( + echo "The device is locked" + %FASTBOOT_PATH% -s %DEVICE_ID% flashing unlock + if errorlevel 1 ( exit /b 2) +) + +:fastboot_detect +%FASTBOOT_PATH% getvar unlocked 2>&1 | findstr "yes" +if errorLevel 1 ( + echo "..." + timeout 2 >nul 2>&1 + goto :fastboot_detect +) + +call fastboot_detect + +exit /b 0 -- GitLab