diff --git a/.gitignore b/.gitignore index 9a2b876c5f8bfbd8727db797d4553bb5294c4bbf..fe1d19fe02ee1bc9d905c680e4e52d90c54512be 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ build/ dist/ issues/ scripts/ +sources/ .e/ .twrp/ .waiting.lock diff --git a/build.gradle b/build.gradle index 7516150a39b40bf33a4bb0628b61406ee328be04..9778c7ec2f6fcdd4af90d27792960be65ef1bf28 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,6 @@ plugins { id 'application' id 'java' - id 'jacoco' //I don't know what is is id 'org.openjfx.javafxplugin' version '0.0.8' id 'org.beryx.jlink' version '2.21.2' } @@ -38,10 +37,11 @@ repositories { def isRunTask = gradle.startParameter.getTaskNames().contains("run") +def isTestTask = gradle.startParameter.getTaskNames().contains("test") javafx { version = "13" modules = [ 'javafx.controls', 'javafx.fxml' ] - configuration = isRunTask ? 'implementation' : 'compileOnly' + configuration = isRunTask || isTestTask ? 'implementation' : 'compileOnly' } description = 'Modular easy-installer' @@ -52,7 +52,7 @@ dependencies { compile 'ch.qos.logback:logback-classic:1.2.3' compile 'ch.qos.logback:logback-core:1.2.3' compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30' - compile 'org.yaml:snakeyaml:1.25' + compile 'org.yaml:snakeyaml:1.26' testCompile 'junit:junit:4.12' //compile 'org.slf4j:slf4j-log4j1:1.7.5' @@ -74,6 +74,11 @@ ext { jlink { imageZip = project.file("${buildDir}/distributions/${appPackaging}.zip") options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages'] + mergedModule { + requires "java.logging" + requires "java.naming" + requires "java.xml" + } targetPlatform(linuxPlatform) { jdkHome = "buildSrc/linux/jdk-11.0.2" addExtraModulePath("buildSrc/linux/javafx-jmods-13.0.1") @@ -109,7 +114,12 @@ tasks.jlink { copy { from('buildSrc/OSX/adb') into("${buildDir}/image/${appLauncher}-${macPlatform}/bin/adb") - include 'adb', 'fastboot' + include 'adb', 'fastboot', 'mke2fs' + } + copy { + from('buildSrc/OSX/jdk-11.0.2/bin') + into("${buildDir}/image/${appLauncher}-${macPlatform}/bin") + include 'jar' } copy { from('flash-scripts/linux') @@ -123,7 +133,12 @@ tasks.jlink { copy { from('buildSrc/linux/adb') into("${buildDir}/image/${appLauncher}-${linuxPlatform}/bin/adb") - include 'adb', 'fastboot' + include 'adb', 'fastboot', 'mke2fs' + } + copy { + from('buildSrc/linux/jdk-11.0.2/bin') + into("${buildDir}/image/${appLauncher}-${linuxPlatform}/bin") + include 'jar' } copy { from('flash-scripts/windows') @@ -137,9 +152,14 @@ tasks.jlink { copy { from('buildSrc/windows/adb') into("${buildDir}/image/${appLauncher}-${windowsPlatform}/bin/adb") - include 'adb.exe', 'fastboot.exe', 'AdbWinApi.dll', 'AdbWinUsbApi.dll', 'libwinpthread-1.dll' + include 'adb.exe', 'fastboot.exe', 'mke2fs.exe', 'AdbWinApi.dll', 'AdbWinUsbApi.dll', 'libwinpthread-1.dll' } - + copy { + from('buildSrc/windows/jdk-11.0.2/bin') + into("${buildDir}/image/${appLauncher}-${windowsPlatform}/bin") + include 'jar.exe' + } + //Handle bug in eOS def launcherFilePath = "${buildDir}/image/${appLauncher}-${linuxPlatform}/bin/easy-installer" def launcherContent = file(launcherFilePath).getText('UTF-8') @@ -157,7 +177,7 @@ tasks.run{ task dist{ dependsOn clean, jlinkZip description "Calls clean and then jlinkZip [default]" - + } diff --git a/flash-scripts/linux/fp3_get_oem_unlockcode.sh b/flash-scripts/linux/fp3_get_oem_unlockcode.sh new file mode 100755 index 0000000000000000000000000000000000000000..6fdd59e262ccd7ee86e929ab2ee186383845cbfd --- /dev/null +++ b/flash-scripts/linux/fp3_get_oem_unlockcode.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +# Copyright (C) 2020 ECORP SAS - Author: Vincent Bourgmayer +# +# 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: The folder where adb runnable is stored +# $2: serial number of device + +# Exit status +# - 0 : OEM unlocked on device +# - 10 : Missing ADB folder path +# - 11 : Missing device ID +# - 12: can't get IMEI + +ADB_FOLDER_PATH=$1 + +DEVICE_ID=$2 +if [ -z "$ADB_FOLDER_PATH" ] +then + exit 10 +fi + +if [ -z "$DEVICE_ID" ] +then + exit 11 +fi + + +ADB_PATH=${ADB_FOLDER_PATH}"adb" +echo "ADB path: $ADB_PATH" + +# get Imei +DEVICE_IMEI=$($ADB_PATH shell "service call iphonesubinfo 1 | cut -c 52-66 | tr -d '.[:space:]'") +if [ -z "$DEVICE_IMEI" ] +then + exit 12 +fi + +URL="https://factory.fairphone.com/api/unlock-codes/$DEVICE_IMEI/$DEVICE_ID" +RESULT=$(curl -X POST $URL) + +echo "${RESULT:9:8}" \ No newline at end of file diff --git a/flash-scripts/linux/fp3_install-from-fastboot.sh b/flash-scripts/linux/fp3_install-from-fastboot.sh new file mode 100755 index 0000000000000000000000000000000000000000..486c73eb94f24a703659b9e1120e66949255eedd --- /dev/null +++ b/flash-scripts/linux/fp3_install-from-fastboot.sh @@ -0,0 +1,105 @@ +#!/bin/bash + +# Copyright (C) 2020 - Author: Ingo +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Parameter +# $1: ARCHIVE_PATH path to the /e/ archive to flash +# $2: FASTBOOT_FOLDER_PATH: the path where runnable fastboot is stored +# $3: JAVA_FOLDER_PATH: the path where runnable jar is stored (to unpack ZIP file) + +# Exit status +# - 0 : /e/ installed +# - 1 : user data wipe failed +# - 2 : flashing of a partition failed +# - 101 : ARCHIVE_PATH missing +# - 102 : archive could not be unpacked + +ARCHIVE_PATH=$1 +ARCHIVE_FOLDER_PATH=$(dirname "$1")"/" +FASTBOOT_FOLDER_PATH=$2 +FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" +JAVA_FOLDER_PATH=$3 +JAR_PATH=${JAVA_FOLDER_PATH}"/bin/jar" + +echo "archive path : $ARCHIVE_PATH" +echo "archive folder path : $ARCHIVE_FOLDER_PATH" +echo "fastboot path : $FASTBOOT_PATH" +echo "jar path : $JAR_PATH" + +if [ -z "$ARCHIVE_PATH" ] +then + exit 101 +fi + +cd "$ARCHIVE_FOLDER_PATH" + +sleep 1 + +if ! "$JAR_PATH" -x -v -f "$ARCHIVE_PATH" ; +then exit 102 ; fi + +echo "unpacked archive" + +sleep 1 + +if ! "$FASTBOOT_PATH" -w ; +then exit 1 ; fi + +echo "user data wiped" + +sleep 5 + +if ! "$FASTBOOT_PATH" flash system system.img ; +then exit 2 ; fi + +echo "flashed system" + +sleep 1 + +if ! "$FASTBOOT_PATH" flash boot boot.img ; +then exit 2 ; fi + +echo "flashed boot" + +sleep 1 + +if ! "$FASTBOOT_PATH" flash vendor vendor.img ; +then exit 2 ; fi + +echo "flashed vendor" + +sleep 1 + +if ! "$FASTBOOT_PATH" flash dtbo dtbo.img ; +then exit 2 ; fi + +echo "flashed dtbo" + +sleep 1 + +if ! "$FASTBOOT_PATH" flash product product.img ; +then exit 2 ; fi + +echo "flashed product" + +sleep 1 + +if ! "$FASTBOOT_PATH" flash vbmeta vbmeta.img ; +then exit 2 ; fi + +echo "flashed vbmeta" + +sleep 1 \ No newline at end of file diff --git a/flash-scripts/linux/fp3_oem-unlock.sh b/flash-scripts/linux/fp3_oem-unlock.sh new file mode 100755 index 0000000000000000000000000000000000000000..60a909914a8027916c1d7480372bf914bcd15ed8 --- /dev/null +++ b/flash-scripts/linux/fp3_oem-unlock.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Copyright (C) 2020 - Author: Ingo +# +# 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: The folder where fastboot runnable is stored + +# Exit status +# - 0 : OEM unlocked on device +# - 10 : fastboot error + +FASTBOOT_FOLDER_PATH=$1 +FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" + +echo "fastboot path: $FASTBOOT_PATH" + +if [ "$($FASTBOOT_PATH oem unlock; echo $?)" = 1 ] +then + echo "OEM-unlock fails" + exit 10 +fi + +sleep 10s +echo "OEM unlocked" \ No newline at end of file diff --git a/flash-scripts/linux/wait-fastboot-unlocked.sh b/flash-scripts/linux/wait-fastboot-unlocked.sh new file mode 100755 index 0000000000000000000000000000000000000000..3277f371f169a9d40f783c5908556a884265a646 --- /dev/null +++ b/flash-scripts/linux/wait-fastboot-unlocked.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Copyright (C) 2020 - Author: Ingo +# +# 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 . + +# TODO: What if 2 devices detected? +# Parameter +# $1: The folder where fastboot runnable is stored + +# Exit status +# - 0 : Device in fastboot mode detected and bootloader unlocked +# - 1 : Error + +FASTBOOT_FOLDER_PATH=$1 +FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" + +echo "fastboot path: $FASTBOOT_PATH" + +while [ "$($FASTBOOT_PATH getvar unlocked 2>&1 | grep -q yes; echo $?)" = 1 ] +do + sleep 2s +done + +sleep 5s +echo "fastboot mode detected, phone is unlocked" \ No newline at end of file diff --git a/flash-scripts/linux/wait-fastboot.sh b/flash-scripts/linux/wait-fastboot.sh new file mode 100755 index 0000000000000000000000000000000000000000..a8dd8b122140443c4c81dfdc208baf8645f2fa3b --- /dev/null +++ b/flash-scripts/linux/wait-fastboot.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Copyright (C) 2020 - Author: Ingo +# +# 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 . + +# TODO: What if 2 devices detected? +# Parameter +# $1: The folder where fastboot runnable is stored + +# Exit status +# - 0 : Device in fastboot mode detected +# - 1 : Error + +FASTBOOT_FOLDER_PATH=$1 +FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" + +echo "fastboot path: $FASTBOOT_PATH" + +while [ "$($FASTBOOT_PATH devices | grep -q fastboot; echo $?)" = 1 ] +do + sleep 1s +done + +sleep 5s +echo "fastboot mode detected" \ No newline at end of file diff --git a/flash-scripts/linux/wait-reboot-from-fastboot.sh b/flash-scripts/linux/wait-reboot-from-fastboot.sh new file mode 100755 index 0000000000000000000000000000000000000000..25d8f093bfe71c1151f27d7e5cdba5fb5d231808 --- /dev/null +++ b/flash-scripts/linux/wait-reboot-from-fastboot.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# Copyright (C) 2020 ECORP SAS - Author: Vincent Bourgmayer +# +# 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 : Error +# - 101 : no device found in fastboot +# - 102 : locking the bootloader failed + +FASTBOOT_FOLDER_PATH=$1 +FASTBOOT_PATH=${FASTBOOT_FOLDER_PATH}"fastboot" + +echo "fastboot path: $FASTBOOT_PATH" + +#1 On 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 + +# Lock the bootloader +if ! "$FASTBOOT_PATH" flashing lock ; +then exit 102 ; 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/flash-scripts/windows/fp3_install-from-fastboot.bat b/flash-scripts/windows/fp3_install-from-fastboot.bat new file mode 100644 index 0000000000000000000000000000000000000000..4d60a48a959d9c344144e85670ccb6a63292851d --- /dev/null +++ b/flash-scripts/windows/fp3_install-from-fastboot.bat @@ -0,0 +1,104 @@ +:: Copyright (C) 2020 - Author: Ingo +:: Copyright (C) 2020 ECORP SAS - Author: Vincent Bourgmayer +:: +:: This program is free software: you can redistribute it and/or modify +:: it under the terms of the GNU General Public License as published by +:: the Free Software Foundation, either version 3 of the License, or +:: (at your option) any later version. +:: +:: This program is distributed in the hope that it will be useful, +:: but WITHOUT ANY WARRANTY; without even the implied warranty of +:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +:: GNU General Public License for more details. +:: +:: You should have received a copy of the GNU General Public License +:: along with this program. If not, see . + +:: Parameter +:: $1: ARCHIVE_PATH path to the /e/ archive to flash +:: $2: FASTBOOT_FOLDER_PATH: the path where runnable fastboot is stored +:: $3: JAVA_FOLDER_PATH: the path where runnable jar is stored (to unpack ZIP file) + +:: Exit status +:: - 0 : /e/ installed +:: - 1 : user data wipe failed +:: - 2 : flashing of a partition failed +:: - 101 : ARCHIVE_PATH missing +:: - 102 : archive could not be unpacked + +set ARCHIVE_PATH=%~1 +set FASTBOOT_FOLDER_PATH=%~2 +set FASTBOOT_PATH="%FASTBOOT_FOLDER_PATH%fastboot" +set JAVA_FOLDER_PATH=%~3 +set JAR_PATH="%JAVA_FOLDER_PATH%\bin\jar" + +if not defined %ARCHIVE_PATH ( + exit /b 101 +) + +for %%a in ("%ARCHIVE_PATH%") do ( + set ARCHIVE_NAME="%%~na" +) + +for %%a in ("%ARCHIVE_PATH%") do ( + set ARCHIVE_FOLDER_PATH="%%~dpa" +) + +echo "archive path : "%ARCHIVE_PATH% +echo "archive folder path : "%ARCHIVE_FOLDER_PATH% +echo "fastboot path : "%FASTBOOT_PATH% +echo "jar path : "%JAR_PATH% + +cd "%ARCHIVE_FOLDER_PATH%" + +timeout 1 >nul 2>&1 + +%JAR_PATH% -x -v -f "%ARCHIVE_PATH%" +if errorLevel 1 ( exit /b 102 ) +echo "unpacked archive" + +timeout 1 >nul 2>&1 + +%FASTBOOT_PATH% -w +if errorLevel 1 ( exit /b 1 ) +echo "user data wiped" + +timeout 5 >nul 2>&1 + +%FASTBOOT_PATH% flash system system.img +if errorLevel 1 ( exit /b 2 ) +echo "flashed system" + +timeout 1 >nul 2>&1 + +%FASTBOOT_PATH% flash boot boot.img +if errorLevel 1 ( exit /b 2 ) +echo "flashed boot" + +timeout 1 >nul 2>&1 + +%FASTBOOT_PATH% flash vendor vendor.img +if errorLevel 1 ( exit /b 2 ) +echo "flashed vendor" + +timeout 1 >nul 2>&1 + +%FASTBOOT_PATH% flash dtbo dtbo.img +if errorLevel 1 ( exit /b 2 ) +echo "flashed dtbo" + +timeout 1 >nul 2>&1 + +%FASTBOOT_PATH% flash product product.img +if errorLevel 1 ( exit /b 2 ) +echo "flashed product" + +timeout 1 >nul 2>&1 + +%FASTBOOT_PATH% flash vbmeta vbmeta.img +if errorLevel 1 ( exit /b 2 ) +echo "flashed vbmeta" + +timeout 1 >nul 2>&1 + +exit /b 0 \ No newline at end of file diff --git a/flash-scripts/windows/fp3_oem-unlock.bat b/flash-scripts/windows/fp3_oem-unlock.bat new file mode 100644 index 0000000000000000000000000000000000000000..7adfb2ea37bba975f73ed4e16955d2e60966d100 --- /dev/null +++ b/flash-scripts/windows/fp3_oem-unlock.bat @@ -0,0 +1,38 @@ +:: Copyright (C) 2020 - Author: Ingo +:: Copyright (C) 2020 ECORP SAS - Author: Vincent Bourgmayer +:: +:: 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: The folder where fastboot runnable is stored + +:: Exit status +:: - 0 : OEM unlocked on device +:: - 10 : fastboot error + +set FASTBOOT_FOLDER_PATH=%~1 +set FASTBOOT_PATH="%FASTBOOT_FOLDER_PATH%fastboot" +echo "FASTBOOT path:"%FASTBOOT_PATH% + +%FASTBOOT_PATH% oem unlock + +if errorLevel 1 ( + echo "OEM-unlock fails" + exit /b 10 +) + +timeout 10 >nul +echo "OEM unlocked" + +exit /b 0 \ No newline at end of file diff --git a/flash-scripts/windows/install-from-recovery.bat b/flash-scripts/windows/install-from-recovery.bat index 8bae9979a72e5264c59e9bfcfae9e51e7b11450f..d0c0c5322ae879e36d3438aa743d71d7242dd9fd 100755 --- a/flash-scripts/windows/install-from-recovery.bat +++ b/flash-scripts/windows/install-from-recovery.bat @@ -1,4 +1,4 @@ -:: Copyright (C) 2019 ECORP SAS - Author: Romain Hunault +:: Copyright (C) 2020 ECORP SAS - Author: Vincent Bourgmayer :: :: 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 diff --git a/flash-scripts/windows/install-recovery.bat b/flash-scripts/windows/install-recovery.bat index 69ee6778fbcbb9ecb3760d72ec852da68edadf76..e8c789628de2d8a5c30cd835dc8ac61d6d342707 100755 --- a/flash-scripts/windows/install-recovery.bat +++ b/flash-scripts/windows/install-recovery.bat @@ -1,4 +1,4 @@ -:: Copyright (C) 2019 ECORP SAS - Author: Romain Hunault +:: Copyright (C) 2020 ECORP SAS - Author: Vincent Bourgmayer :: :: 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 diff --git a/flash-scripts/windows/verify-heimdall.bat b/flash-scripts/windows/verify-heimdall.bat index 8602940069b2537459a36c6f8d0abba11361152e..8018cff57d2ce132bb34628c3f960135c15dac85 100755 --- a/flash-scripts/windows/verify-heimdall.bat +++ b/flash-scripts/windows/verify-heimdall.bat @@ -1,6 +1,4 @@ -::!/bin/bash - -:: Copyright (C) 2019 ECORP SAS - Author: Romain Hunault +:: Copyright (C) 2020 ECORP SAS - Author: Vincent Bourgmayer :: :: 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 diff --git a/flash-scripts/windows/wait-download.bat b/flash-scripts/windows/wait-download.bat index 58f7fc24b256ccc792717af8127bbb0184170515..25a8175642ea107b9cf29aec35b3d5aecdb916fd 100755 --- a/flash-scripts/windows/wait-download.bat +++ b/flash-scripts/windows/wait-download.bat @@ -1,4 +1,4 @@ -:: Copyright (C) 2019 ECORP SAS - Author: Romain Hunault +:: Copyright (C) 2020 ECORP SAS - Author: Vincent Bourgmayer :: :: 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 diff --git a/flash-scripts/windows/wait-fastboot-unlocked.bat b/flash-scripts/windows/wait-fastboot-unlocked.bat new file mode 100644 index 0000000000000000000000000000000000000000..5db8ceb379fcbbe197e2a26b9670e63f187cd9af --- /dev/null +++ b/flash-scripts/windows/wait-fastboot-unlocked.bat @@ -0,0 +1,40 @@ +:: Copyright (C) 2020 - Author: Ingo +:: Copyright (C) 2020 ECORP SAS - Author: Vincent Bourgmayer +:: +:: 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 . + +:: TODO: What if 2 devices detected? +:: $1: The folder where fastboot runnable is stored + +:: Exit status +:: - 0 : Device in fastboot mode detected +:: - 1 : Error + +set FASTBOOT_FOLDER_PATH=%~1 +set FASTBOOT_PATH="%FASTBOOT_FOLDER_PATH%fastboot" +echo "FASTBOOT path:"%FASTBOOT_PATH% + +:fastboot_detect +%FASTBOOT_PATH% getvar unlocked 2>&1 | findstr yes +if errorLevel 1 ( + timeout 2 >nul 2>&1 + goto :fastboot_detect +) + +call fastboot_detect + +timeout 5 >nul +echo "fastboot mode detected, phone is unlocked" + +exit /b 0 \ No newline at end of file diff --git a/flash-scripts/windows/wait-fastboot.bat b/flash-scripts/windows/wait-fastboot.bat new file mode 100644 index 0000000000000000000000000000000000000000..769a8ad5b59d50ab5718a609c373ce772e83c42a --- /dev/null +++ b/flash-scripts/windows/wait-fastboot.bat @@ -0,0 +1,40 @@ +:: Copyright (C) 2020 - Author: Ingo +:: Copyright (C) 2020 ECORP SAS - Author: Vincent Bourgmayer +:: +:: 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 . + +:: TODO: What if 2 devices detected? +:: $1: The folder where fastboot runnable is stored + +:: Exit status +:: - 0 : Device in fastboot mode detected +:: - 1 : Error + +set FASTBOOT_FOLDER_PATH=%~1 +set FASTBOOT_PATH="%FASTBOOT_FOLDER_PATH%fastboot" +echo "FASTBOOT path:"%FASTBOOT_PATH% + +:fastboot_detect +%FASTBOOT_PATH% devices 2>&1 | findstr fastboot +if errorLevel 1 ( + timeout 1 >nul 2>&1 + goto :fastboot_detect +) + +call fastboot_detect + +timeout 5 >nul +echo "fastboot mode detected" + +exit /b 0 \ No newline at end of file diff --git a/flash-scripts/windows/wait-reboot-from-fastboot.bat b/flash-scripts/windows/wait-reboot-from-fastboot.bat new file mode 100644 index 0000000000000000000000000000000000000000..4748f04162e3911ba9b5c6fbd01c0b5f3bf60800 --- /dev/null +++ b/flash-scripts/windows/wait-reboot-from-fastboot.bat @@ -0,0 +1,45 @@ +:: Copyright (C) 2020 ECORP SAS - Author: Vincent Bourgmayer +:: +:: 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 . + +:: TODO: What if 2 devices detected? +:: $1: The folder where fastboot runnable is stored + +:: Exit status +:: - 0 : Device in fastboot mode detected +:: - 1 : Error +:: - 101: device not in fastboot anymore +:: - 102: locking the bootloader failed + +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 1 (exit /b 101) + +%FASTBOOT_PATH% flashing lock +if errorLevel 1 ( exit /b 102 ) + +:wait-leave-fastboot +%FASTBOOT_PATH% devices 2>Nul | findstr fastboot +if %errorLevel% == 0 ( + ping 127.0.0.1 -n 2 -w 1000 >NUL + goto :wait-leave-fastboot +) + +call wait-leave-fastboot + +exit /b 0 \ No newline at end of file diff --git a/flash-scripts/windows/wait-reboot.bat b/flash-scripts/windows/wait-reboot.bat index 77fc5386bbf8ee1c05ae352cc4721503d803f6e6..9bbd91a0208a0a548e9a94d97a7d2286eadc53c2 100755 --- a/flash-scripts/windows/wait-reboot.bat +++ b/flash-scripts/windows/wait-reboot.bat @@ -1,4 +1,4 @@ -:: Copyright (C) 2019 ECORP SAS - Author: Romain Hunault +:: Copyright (C) 2020 ECORP SAS - Author: Vincent Bourgmayer :: :: 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 @@ -41,7 +41,10 @@ if errorLevel 1 (exit /b 101) :wait-leave-recovery %ADB_PATH% -s %DEVICE_ID% get-state 2>Nul -if %errorLevel% == 0 ( goto :wait-leave-recovery ) +if %errorLevel% == 0 ( + ping 127.0.0.1 -n 2 -w 1000 >NUL + goto :wait-leave-recovery +) call wait-leave-recovery diff --git a/flash-scripts/windows/wait-recovery.bat b/flash-scripts/windows/wait-recovery.bat index 0b363de7f674a766821ee91b31dabd18fd34824d..d21834eab332758fe8cb0b6291d60ce7a07e27e3 100755 --- a/flash-scripts/windows/wait-recovery.bat +++ b/flash-scripts/windows/wait-recovery.bat @@ -1,4 +1,4 @@ -:: Copyright (C) 2019 ECORP SAS - Author: Romain Hunault +:: Copyright (C) 2020 ECORP SAS - Author: Vincent Bourgmayer :: :: 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 diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index b4313d09a06ae06f90cfa6512ccc736d1e6d7b50..00e06e6bbd1abae9842f48a5aaa0b5a8be11057d 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: easy-installer -version: 'v0.9.0-beta' +version: 'v0.11.0-beta' 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 4fca44c51d10527cc37fcd955ba69dd06208ea28..ac06badc9f30b4f4fcbbfa417763b9089a3ccc86 100644 --- a/src/main/java/ecorp/easy/installer/AppConstants.java +++ b/src/main/java/ecorp/easy/installer/AppConstants.java @@ -34,11 +34,18 @@ public abstract class AppConstants { public final static String HeimdallFolderName = "heimdall"; public final static String AdbFolderName = "adb"; - public final static String ASK_ACCOUNT_KEY="askAccount"; + public final static String FEEDBACK_STORAGE_URL ="https://ecloud.global/s/QLwyiZ4fysodiz3"; public final static String LOG_STORAGE_URL ="https://ecloud.global/s/4qRxWjeM5Yb72b4"; private final static String BuildSrcFolderName = "buildSrc"; + //step type key + public final static String USER_ACTION_KEY="action"; + public final static String LOAD_KEY="load"; + public final static String ASK_ACCOUNT_KEY="askAccount"; + public final static String UNLOCK_OEM_KEY="enableOemUnlock"; + + // Not fully constructed private static String TWRP_IMAGE_PATH; private static String E_ARCHIVE_PATH; diff --git a/src/main/java/ecorp/easy/installer/EasyInstaller.java b/src/main/java/ecorp/easy/installer/EasyInstaller.java index 6bf55b1679ddf6e7c5dcf624bd7d102dd5d27413..d375f8eb6cd21411d25f9f6df15aa6c423ca99c4 100644 --- a/src/main/java/ecorp/easy/installer/EasyInstaller.java +++ b/src/main/java/ecorp/easy/installer/EasyInstaller.java @@ -62,7 +62,7 @@ public class EasyInstaller extends Application { //Defines some properties Scene scene = new Scene(root); - stage.setTitle(i18n.getString("appTitle")+"v0.10-beta"); + stage.setTitle(i18n.getString("appTitle")+"v0.11.0-beta"); stage.setScene(scene); stage.setResizable(true); diff --git a/src/main/java/ecorp/easy/installer/controllers/MainWindowController.java b/src/main/java/ecorp/easy/installer/controllers/MainWindowController.java index 4bb5739f076cece9bac19bf21b4683d0eb8bdbbd..7daee3dae05c1c72903db915210d3c46f30248ff 100644 --- a/src/main/java/ecorp/easy/installer/controllers/MainWindowController.java +++ b/src/main/java/ecorp/easy/installer/controllers/MainWindowController.java @@ -45,6 +45,7 @@ import org.slf4j.LoggerFactory; * Main window Controller class * * @author Vincent Bourgmayer + * @author Ingo */ public class MainWindowController implements Initializable { private final static Logger logger = LoggerFactory.getLogger(MainWindowController.class); diff --git a/src/main/java/ecorp/easy/installer/controllers/subcontrollers/AbstractSubController.java b/src/main/java/ecorp/easy/installer/controllers/subcontrollers/AbstractSubController.java index e363f9d4f9c16fa2f614ed0719cdcc77fce48555..1eca555be31bf0449d85bb050f8ebf8b5d876f26 100644 --- a/src/main/java/ecorp/easy/installer/controllers/subcontrollers/AbstractSubController.java +++ b/src/main/java/ecorp/easy/installer/controllers/subcontrollers/AbstractSubController.java @@ -41,7 +41,5 @@ public abstract class AbstractSubController implements Initializable{ @Override public void initialize(URL location, ResourceBundle resources) { i18n = resources; - //DO nothing } - } diff --git a/src/main/java/ecorp/easy/installer/controllers/subcontrollers/FeedbackController.java b/src/main/java/ecorp/easy/installer/controllers/subcontrollers/FeedbackController.java index 6215f83a7d571677a88286ab5aa4391adf7f22f6..5b477370501794877e1812c484213acb2760c3c0 100644 --- a/src/main/java/ecorp/easy/installer/controllers/subcontrollers/FeedbackController.java +++ b/src/main/java/ecorp/easy/installer/controllers/subcontrollers/FeedbackController.java @@ -131,8 +131,9 @@ public class FeedbackController extends AbstractSubController { String answerFilePath = AppConstants.getWritableFolder()+"feedback-"+UUID.randomUUID()+".txt"; try(PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(answerFilePath, true)))) { - out.write("Timestamp: "+System.currentTimeMillis()+"\n"); - out.write("Device model: "+this.deviceModel); + out.write("Timestamp: "+System.currentTimeMillis()); + out.write("\nDevice model: "+this.deviceModel); + out.write("\nOS name: "+AppConstants.OsName); if(selectedFeelings != null){ out.write("\nFeelings: "+selectedFeelings.getId()); } diff --git a/src/main/java/ecorp/easy/installer/controllers/subcontrollers/FlashSceneController.java b/src/main/java/ecorp/easy/installer/controllers/subcontrollers/FlashSceneController.java index d7e5943517046f4b9f0efd339789c8da71d4d54b..07c518ddfe134530a93e2ba0ee5f72b92ecf99c8 100644 --- a/src/main/java/ecorp/easy/installer/controllers/subcontrollers/FlashSceneController.java +++ b/src/main/java/ecorp/easy/installer/controllers/subcontrollers/FlashSceneController.java @@ -53,6 +53,7 @@ import org.slf4j.LoggerFactory; * FXML Controller class * * @author Vincent Bourgmayer + * @author Ingo */ public class FlashSceneController extends AbstractSubSteppedController implements IFlashHandler { //Current step UI element @@ -87,7 +88,7 @@ public class FlashSceneController extends AbstractSubSteppedController implement public void initialize(URL location, ResourceBundle resources) { super.initialize(location, resources); logger.debug("Initialize FlashSceneController.java"); - + sendLogBtn.managedProperty().bind(sendLogBtn.visibleProperty()); loadStepProgressIndicator.managedProperty().bind(loadStepProgressIndicator.visibleProperty()); logScrollPane.managedProperty().bind(logScrollPane.visibleProperty()); @@ -133,12 +134,12 @@ public class FlashSceneController extends AbstractSubSteppedController implement if(i18n.containsKey(instruction)){ label.setText(i18n.getString(instruction)); }else label.setText("missing translation"); - + label.setWrapText(true); //make text resize if longer than width label.minWidthProperty().bind(instructionsFlow.widthProperty()); //avoid to display two instruction on the same line label.maxWidthProperty().bind(instructionsFlow.widthProperty()); //Set max Width to its parent width instructionsFlow.getChildren().add(label); - + } /** @@ -194,12 +195,24 @@ public class FlashSceneController extends AbstractSubSteppedController implement } //Get Type of step ("action" or "load") - String stepType = db.getString("stepType"); - if(stepType.equals("action") ){ onActionStepType(db); } - else if( stepType.equals("load") ) { onLoadStepType(db); } - else if (stepType.equals(AppConstants.ASK_ACCOUNT_KEY) ) { - displayEAccountView(); + switch(db.getString("stepType")){ + case AppConstants.USER_ACTION_KEY: + onActionStepType(db); + break; + case AppConstants.LOAD_KEY: + onLoadStepType(db); + break; + case AppConstants.ASK_ACCOUNT_KEY: + displaySpecificView("6-2-eAccount.fxml"); + break; + case AppConstants.UNLOCK_OEM_KEY: + displaySpecificView("6-3-unlockOEM.fxml"); + break; + default: + logger.warn("Try to load invalid step's type"); + break; } + } /** @@ -207,13 +220,13 @@ public class FlashSceneController extends AbstractSubSteppedController implement * Note: This could be replace by a call to parentController.loadSubUI("6-2-eAccount.fxml") * but how to reset current ui to this one after ? */ - private void displayEAccountView(){ + private void displaySpecificView(String fxmlName){ //Masque previous UI //@TODO it's better to apply to each children flashSceneRoot.setVisible(false); flashSceneRoot.setManaged(false); //Affiche the new One - final String tempRootId = parentController.loadSubUI("6-2-eAccount.fxml"); + final String tempRootId = parentController.loadSubUI(fxmlName); parentController.setNextButtonOnClickListener(( MouseEvent event) -> { parentController.resetNextButtonEventHandler(); parentController.removeNodeFromRoot(tempRootId); @@ -222,7 +235,6 @@ public class FlashSceneController extends AbstractSubSteppedController implement synchronized (pauseLock) { pauseLock.notify(); } - }); } @@ -288,7 +300,7 @@ public class FlashSceneController extends AbstractSubSteppedController implement stepTitleLabel.setText(i18n.getString(errorMsgKey)); logger.debug("errorMsgKey = {}", errorMsgKey); - + instructionsFlow.setManaged(false); instructionsFlow.setVisible(false); sendLogBtn.setVisible(true); @@ -353,12 +365,12 @@ public class FlashSceneController extends AbstractSubSteppedController implement ch.qos.logback.classic.Logger rootLogger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); GUIAppender appender = (GUIAppender) rootLogger.getAppender("GUI"); - + String text = showHideLogBtn.getText(); if(text.equals(">")){ showHideLogBtn.setText("V"); logScrollPane.setVisible(false); - + logFlow.getChildren().clear(); appender.setContainer(null); }else{ @@ -423,21 +435,21 @@ public class FlashSceneController extends AbstractSubSteppedController implement //Si currenttype est action final ObservableList children = instructionsFlow.getChildren(); final int instructionsNumber = children.size(); - - + + /* check that there is more than 1 instruction. (children's size is > 1). Then if it's not the case, just return. This behaviour is only expected when there is more than 2 instructions. */ if(instructionsNumber <= 1) return; - + /* No need to check that currentSubStepId isn't equal or over size This won't happens because the next button should be hidden at the last instruction */ - - //get CurrentLabel + + //get CurrentLabel Label currentSubStepLabel = (Label) children.get(currentSubStepId); //get previousLabel Label nextSubStepLabel = (Label) children.get(currentSubStepId+1); @@ -449,9 +461,9 @@ public class FlashSceneController extends AbstractSubSteppedController implement Image img; try{ img = new Image(getClass().getResourceAsStream("/images/"+instructionsImagesBundle.getString(instruction))); - }catch(Exception e){ + }catch(Exception e){ logger.warn("onNextButtonClicked(), image key = {}, error = {}", instruction, e.toString()); - img = null; + img = null; } instructionImage.setImage(img); diff --git a/src/main/java/ecorp/easy/installer/controllers/subcontrollers/UnlockOemController.java b/src/main/java/ecorp/easy/installer/controllers/subcontrollers/UnlockOemController.java new file mode 100644 index 0000000000000000000000000000000000000000..87a0a666b08256d0f6a6a2e93f611ae7a2c110ab --- /dev/null +++ b/src/main/java/ecorp/easy/installer/controllers/subcontrollers/UnlockOemController.java @@ -0,0 +1,62 @@ +/* + * Copyright 2019-2020 - 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 . + */ +package ecorp.easy.installer.controllers.subcontrollers; + +import ecorp.easy.installer.controllers.MainWindowController; +import ecorp.easy.installer.graphics.FlashGlobalProgressManager; +import java.net.URL; +import java.util.ResourceBundle; +import javafx.fxml.FXML; +import javafx.scene.control.Hyperlink; +import javafx.scene.control.Label; +import javafx.scene.layout.Border; +import javafx.scene.layout.HBox; + +/** + * This controller is for UI about unlocking OEM on the stock ROM + * It's main goal is to allow to get extra code from website or API + * + * @author vincent + */ +public class UnlockOemController extends AbstractSubController{ + + @FXML Label instruction; + @FXML Hyperlink link; + @FXML HBox globalProgressIndicator; + private FlashGlobalProgressManager globalProgressMgr; + + + @Override + public void initialize(URL location, ResourceBundle resources){ + super.initialize(location, resources); + link.setBorder(Border.EMPTY); + } + + @Override + public void setParentController(MainWindowController parentController){ + super.setParentController(parentController); + parentController.setNextButtonVisible(true); + + globalProgressMgr = new FlashGlobalProgressManager( parentController.getThreadFactory().getStepsCount() ); + globalProgressIndicator.getChildren().addAll(globalProgressMgr.getSegments()); + globalProgressMgr.updateProgression(); + } + + public void openUrl(){ + parentController.openUrlInBrowser(link.getText()); + } +} diff --git a/src/main/java/ecorp/easy/installer/helpers/DeviceHelper.java b/src/main/java/ecorp/easy/installer/helpers/DeviceHelper.java index 62ff0c61d11a0565f86dc6cc63e67a16da256d33..0c151c72f1451d3ec432dcc3b5bc414e095997f1 100644 --- a/src/main/java/ecorp/easy/installer/helpers/DeviceHelper.java +++ b/src/main/java/ecorp/easy/installer/helpers/DeviceHelper.java @@ -1,11 +1,11 @@ /* - * Copyright 2019-2020 - ECORP SAS + * Copyright 2019-2020 - 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 @@ -18,7 +18,9 @@ package ecorp.easy.installer.helpers; import java.util.HashMap; /** * - * @author André Lam, Vincen Bourgmayer + * @author André Lam + * @author Vincent Bourgmayer + * @author Ingo */ public class DeviceHelper { private static final HashMap map = new HashMap() {{ @@ -29,9 +31,10 @@ public class DeviceHelper { put("zeroflte", "0005"); put("dream2lte", "0006"); put("dreamlte", "0007"); + put("FP3", "0008"); }}; - - + + /** * Return internal code for a given device * @param key the device code's name (example: Samsung galaxy S7 => herolte) diff --git a/src/main/java/ecorp/easy/installer/models/Device.java b/src/main/java/ecorp/easy/installer/models/Device.java index 596beaf9fd4b8b6854d4df8a9ac9bf60158f19c0..947d8a45ef63199c60db55c86600da8731d86579 100644 --- a/src/main/java/ecorp/easy/installer/models/Device.java +++ b/src/main/java/ecorp/easy/installer/models/Device.java @@ -19,6 +19,7 @@ package ecorp.easy.installer.models; /** * Encapsulate data about the device * @author Vincent Bourgmayer + * @author Ingo */ public class Device { private String model; @@ -29,7 +30,7 @@ public class Device { private String osApi; private String IMEI; private String adbId; - + public Device(String adbId){ this.adbId = adbId; } diff --git a/src/main/java/ecorp/easy/installer/threads/DeviceDetectionTask.java b/src/main/java/ecorp/easy/installer/threads/DeviceDetectionTask.java index bab621ac36949d2fa3ce97e234d9d53d65e1d0eb..3a73786ca2af9aff30665ca872efd1bac48bddce 100644 --- a/src/main/java/ecorp/easy/installer/threads/DeviceDetectionTask.java +++ b/src/main/java/ecorp/easy/installer/threads/DeviceDetectionTask.java @@ -27,15 +27,16 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * + * This class provide task which run ADB command in background to detect that a device is reachable * @author vincent Bourgmayer + * @author Ingo */ public class DeviceDetectionTask extends Task{ final String CMD_adbDevices = "devices"; private final static Logger logger = LoggerFactory.getLogger(DeviceDetectionTask.class); private final static Pattern LINEBREAK_PATTERN = Pattern.compile("\\R"); private final static Pattern SPACE_PATTERN = Pattern.compile("\\s+"); - + @Override protected Device call() throws Exception{ Device detectedDevice = null; diff --git a/src/main/java/ecorp/easy/installer/threads/DownloadTask.java b/src/main/java/ecorp/easy/installer/threads/DownloadTask.java index a98b2f1f787a73cdca23d9bc962744e2f9ba94c2..659dbe4c9be5bb943aa8f0e1bdecabacebd51267 100644 --- a/src/main/java/ecorp/easy/installer/threads/DownloadTask.java +++ b/src/main/java/ecorp/easy/installer/threads/DownloadTask.java @@ -41,6 +41,7 @@ import org.slf4j.LoggerFactory; /** * this class verify the checksum of a file and download it * @author vincent Bourgmayer + * @author Ingo */ public class DownloadTask extends Task{ private final static Logger logger = LoggerFactory.getLogger(DownloadTask.class); @@ -81,10 +82,11 @@ public class DownloadTask extends Task{ // Download checksum. If file not downloaded return false and stop downloadin because integrity isn't guaranteed if( !downloadFile(targetUrl+".sha256sum", checksumFilePath) ){ + logger.error("Could not download "+fileName+".sha256sum"); this.updateMessage(i18n.getString("download_lbl_cantcheckIntegrity")); return false; } - + //If checksum valid it means that file is already there and up to date if ( validChecksum(checksumFilePath) ){ this.updateMessage(i18n.getString("download_lbl_fileAlreadyUptoDate")); @@ -92,14 +94,15 @@ public class DownloadTask extends Task{ } if(isCancelled()) return false; - + this.updateTitle("Downloading "+fileName); - + if ( downloadFile(targetUrl, localFilePath) )//Download file { return validChecksum(checksumFilePath); }else{ + logger.error("Could not download "+fileName); this.updateMessage(i18n.getString("download_lbl_downloadError")); return false; } @@ -113,29 +116,31 @@ public class DownloadTask extends Task{ * @return boolean true if file has been successfully downloaded, false either */ private boolean downloadFile(final String fileURL, final String localFilePath) throws MalformedURLException, IOException, InterruptedException{ + logger.info("Start downloading " + fileURL); HttpURLConnection connect = (HttpURLConnection) new URL(fileURL).openConnection(); connect.setReadTimeout(30000); connect.setConnectTimeout(30000); - + if(connect.getResponseCode() != HttpURLConnection.HTTP_OK){ //return false it resources is unreachable + logger.error("HTTP connection failed with {} {}", connect.getResponseCode(), connect.getResponseMessage()); return false; } final double fileSize = connect.getContentLengthLong(); final String formattedFileSize = formatFileSize(fileSize); //used for UI - + //Update UI updateProgress(-1, fileSize); updateMessage(formatFileSize(0.0)+" / "+formattedFileSize ); - + boolean downloaded = false; //Download the file try(FileOutputStream fos = new FileOutputStream(localFilePath); InputStream is = connect.getInputStream(); - ReadableByteChannel rbc = Channels.newChannel(connect.getInputStream()); - + ReadableByteChannel rbc = Channels.newChannel(connect.getInputStream()); + ){ TimeOutRunnable timeoutRunnable = new TimeOutRunnable(); Thread timeoutThread = new Thread(timeoutRunnable); @@ -144,12 +149,12 @@ public class DownloadTask extends Task{ long downloadAmount =0; long precedentAmount = 0; - + while ( rbc.isOpen() && !isCancelled() && ! downloaded ){ //long d = downloadAmount + 1<<24; precedentAmount = downloadAmount; downloadAmount += fos.getChannel().transferFrom(rbc,downloadAmount,1 << 18); - + if(precedentAmount >= downloadAmount){ downloaded = false; rbc.close(); @@ -159,7 +164,7 @@ public class DownloadTask extends Task{ updateProgress(downloadAmount, fileSize); updateMessage( formatFileSize(downloadAmount)+" / "+formattedFileSize); - + fos.flush(); downloaded = (downloadAmount == fileSize); } @@ -172,10 +177,16 @@ public class DownloadTask extends Task{ //If cancelled or not download, delete the partially downloaded file if(isCancelled() || ! downloaded){ + if (isCancelled()) { + logger.warn("Download was cancelled"); + } else { + logger.warn("Download amount was smaller than precedent amount"); + } new File(localFilePath).delete(); return false; } - + + logger.info("Finished downloading " + fileURL); return downloaded; } diff --git a/src/main/java/ecorp/easy/installer/threads/FlashThread.java b/src/main/java/ecorp/easy/installer/threads/FlashThread.java index 705d3cdd32e64741f2855c2cdad40886eb74cd3b..8685a9b9982a0ec95e49f7392828ee0287c3f41d 100644 --- a/src/main/java/ecorp/easy/installer/threads/FlashThread.java +++ b/src/main/java/ecorp/easy/installer/threads/FlashThread.java @@ -1,6 +1,5 @@ /* * Copyright 2019-2020 - 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 @@ -35,6 +34,7 @@ import org.slf4j.LoggerFactory; /** * * @author Vincent Bourgmayer + * @author Ingo */ public class FlashThread extends Thread { final protected static char COMMON_PARAM_IDENTIFIER = '$';//allow to identify when an param of a step is to load from common parameter @@ -66,7 +66,7 @@ public class FlashThread extends Thread { public FlashThread(IFlashHandler controller, String firstCommandKey, Object pauseLock, Device device){ this.commands = new HashMap<>(); this.commonParameters = new HashMap<>(); - this.firstCommandKey = firstCommandKey; + this.firstCommandKey = firstCommandKey; //this is the key of the command's hashmap this.application = controller; this.pauseLock = pauseLock; this.device = device; @@ -80,6 +80,7 @@ public class FlashThread extends Thread { this.commonParameters.put("HEIMDALL_FOLDER_PATH", AppConstants.getHeimdallFolderPath()); this.commonParameters.put("DEVICE_ID", device.getAdbId()); this.commonParameters.put("DEVICE_DEVICE", device.getDevice()); + this.commonParameters.put("JAVA_FOLDER_PATH", AppConstants.JavaHome); } @@ -199,39 +200,39 @@ public class FlashThread extends Thread { //Update UI final Command cmd = commands.get(currentStepCode); final DataBundle bundle = new DataBundle(); - if(cmd.getCommand().contains(AppConstants.ASK_ACCOUNT_KEY)){ - bundle.putString("stepType", AppConstants.ASK_ACCOUNT_KEY); - //@TODO: Tell UI To update - Platform.runLater(()->{ - logger.debug("runLater-> Update UI for"+cmd.getCommand()); - application.onStepStart(bundle); - }); - try{ - synchronized(pauseLock){ - pauseLock.wait(); - } - }catch (InterruptedException e) { - logger.error("error = "+e.toString()); - } //Ignore the issue - //@TODO Find a way to prevent end the run process of this command before to try to run a script - //A posibility is to add a (cmd != null) ? cmd.execAndReadOutput : ; in AbsttractThread class and then here: se cmd to null. - }else{ + + //Prepare datas for UI + final String stepType = cmd.getNewUIValues().getType(); + bundle.putString("stepType", stepType); + + if( stepType.equals(AppConstants.USER_ACTION_KEY) || stepType.equals(AppConstants.LOAD_KEY)){ //UpdateUI - StepUi newUIValues = (StepUi) cmd.getNewUIValues(); + final StepUi newUIValues = (StepUi) cmd.getNewUIValues(); if(newUIValues != null) { //@todo: Must define bundle key as a static String at a single place. - bundle.putString("stepType", newUIValues.getType()); - bundle.putString("stepTitle", newUIValues.getTitle()); - bundle.putList("stepInstructions", String.class.getSimpleName(), newUIValues.getInstructions()); - bundle.putString("stepType", newUIValues.getType()); - if(newUIValues.getType().equals("action")){ + if(stepType.equals(AppConstants.USER_ACTION_KEY)){ bundle.putString("titleIconName", newUIValues.getTitleIconName()); + }else{ + bundle.putInteger("averageTime", newUIValues.getAverageTime()); } - bundle.putInteger("averageTime", newUIValues.getAverageTime()); - Platform.runLater(()->{ - logger.debug("runLater-> Update UI for"+cmd.getCommand()); - application.onStepStart(bundle); - }); + bundle.putString("stepTitle", newUIValues.getTitle()); + bundle.putList("stepInstructions", String.class.getSimpleName(), newUIValues.getInstructions()); + + } + } + + //Update UI + Platform.runLater(()->{ + logger.debug("runLater-> Update UI for"+cmd.getCommand()); + application.onStepStart(bundle); + }); + + if(stepType.equals(AppConstants.ASK_ACCOUNT_KEY) || stepType.equals(AppConstants.UNLOCK_OEM_KEY)) + { + try{ + synchronized(pauseLock){ pauseLock.wait(); } + }catch (InterruptedException e) { + logger.error("error = "+e.toString()); } } } @@ -292,17 +293,18 @@ public class FlashThread extends Thread { updateParameters(); //UpdateUI - doBeforeToRunCommand(); - if(! cmd.getCommand().contains(AppConstants.ASK_ACCOUNT_KEY)){ - //write into logger + doBeforeToRunCommand(); + final String stepType = cmd.getNewUIValues().getType(); + if( stepType.equals(AppConstants.USER_ACTION_KEY) + || stepType.equals(AppConstants.LOAD_KEY) ) + { logger.debug("Run(), Command = "+cmd.getCommand()); - //run command cmd.execAndReadOutput(); success = handleResult(cmd); }else{ success = true; } - + doAfterToRunCommand(); nextCommandKey = cmd.getNextCommandKey(); diff --git a/src/main/java/ecorp/easy/installer/threads/ThreadFactory.java b/src/main/java/ecorp/easy/installer/threads/ThreadFactory.java index f44978fc9ac5cabbb47c4223533b69aa119defd4..771e68e7f9ed20da31347369364b278624b1c5a8 100644 --- a/src/main/java/ecorp/easy/installer/threads/ThreadFactory.java +++ b/src/main/java/ecorp/easy/installer/threads/ThreadFactory.java @@ -225,4 +225,13 @@ public class ThreadFactory { }); return result; } + + /** + * get the number of steps inside the current ProcessMould + * @return 0 if processMould is null + */ + public int getStepsCount(){ + if(flashMould == null) return 0; + return flashMould.getSteps().size(); + } } diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 420afa7e35be357b58155235a68b09efa6ea1323..d34871f37fa7b27663f94ba36bf80dd0e2207724 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -15,6 +15,11 @@ * along with this program. If not, see . */ +/** + * This file list java modules required by Easy-installer + * @author Vincent Bourgmayer + * @author Ingo + */ module ecorp.easy.installer { requires java.net.http; requires javafx.fxml; @@ -22,12 +27,14 @@ module ecorp.easy.installer { requires javafx.graphics; requires javafx.base; requires jdk.crypto.ec; //REQUIRED TO DOWNLOAD OVER HTTPS + requires jdk.jartool; // REQUIRED TO UNZIP DOWNLOADED ARCHIVES FOR SOME PHONES requires org.yaml.snakeyaml; requires org.slf4j; + requires logback.classic; opens ecorp.easy.installer to javafx.fxml; opens ecorp.easy.installer.controllers to javafx.fxml; opens ecorp.easy.installer.controllers.subcontrollers to javafx.fxml; - + exports ecorp.easy.installer.logger; exports ecorp.easy.installer; } diff --git a/src/main/resources/css/style.css b/src/main/resources/css/style.css index e3c868fa9198a5cd3d9be4db04572ef82375c315..2be2fb63f58b757fe0ba8ca05031c9805281a8ed 100644 --- a/src/main/resources/css/style.css +++ b/src/main/resources/css/style.css @@ -26,6 +26,15 @@ Label { -fx-font-size: 1em; } +Text { + -fx-fill: #333333; + -fx-font-size: 1em; +} + +Hyperlink { + -fx-font-size: 1em; +} + .subtitle { -fx-text-fill: #1789E9; -fx-font-size: 1.2em; diff --git a/src/main/resources/fxml/6-3-unlockOEM.fxml b/src/main/resources/fxml/6-3-unlockOEM.fxml new file mode 100644 index 0000000000000000000000000000000000000000..0c7b36a5d2c169ddccfd22b60752c35b6dcb0752 --- /dev/null +++ b/src/main/resources/fxml/6-3-unlockOEM.fxml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/images/FP3_bootloader_mode.png b/src/main/resources/images/FP3_bootloader_mode.png new file mode 100644 index 0000000000000000000000000000000000000000..bc3142cd98a1539f379485e836f95583a8ba0752 Binary files /dev/null and b/src/main/resources/images/FP3_bootloader_mode.png differ diff --git a/src/main/resources/images/FP3_bootscreen_warning-2.png b/src/main/resources/images/FP3_bootscreen_warning-2.png new file mode 100644 index 0000000000000000000000000000000000000000..ea7e1a4609b28245fd46e66b363e543366ac91aa Binary files /dev/null and b/src/main/resources/images/FP3_bootscreen_warning-2.png differ diff --git a/src/main/resources/images/FP3_bootscreen_warning.png b/src/main/resources/images/FP3_bootscreen_warning.png new file mode 100644 index 0000000000000000000000000000000000000000..d82161b977f04620e0dc95d88ebb696e0773e7fb Binary files /dev/null and b/src/main/resources/images/FP3_bootscreen_warning.png differ diff --git a/src/main/resources/images/FP3_lock_bootloader-2.png b/src/main/resources/images/FP3_lock_bootloader-2.png new file mode 100644 index 0000000000000000000000000000000000000000..ec1d3d49673eb0f781dd579ad0b8c4277a11c62e Binary files /dev/null and b/src/main/resources/images/FP3_lock_bootloader-2.png differ diff --git a/src/main/resources/images/FP3_lock_bootloader.png b/src/main/resources/images/FP3_lock_bootloader.png new file mode 100644 index 0000000000000000000000000000000000000000..5c216ffa60b624a097a38e78936a80b077e9c3da Binary files /dev/null and b/src/main/resources/images/FP3_lock_bootloader.png differ diff --git a/src/main/resources/images/FP3_options_menu-2.png b/src/main/resources/images/FP3_options_menu-2.png new file mode 100644 index 0000000000000000000000000000000000000000..db67570593ff89bc6039581ab69644b1978302c5 Binary files /dev/null and b/src/main/resources/images/FP3_options_menu-2.png differ diff --git a/src/main/resources/images/FP3_options_menu.png b/src/main/resources/images/FP3_options_menu.png new file mode 100644 index 0000000000000000000000000000000000000000..f3bde996e63e0fabb7c4baf30184addd0ac73902 Binary files /dev/null and b/src/main/resources/images/FP3_options_menu.png differ diff --git a/src/main/resources/images/FP3_select_lock_bootloader.png b/src/main/resources/images/FP3_select_lock_bootloader.png new file mode 100644 index 0000000000000000000000000000000000000000..da3dad7aee09caa361ef4eec605d2c7954eda623 Binary files /dev/null and b/src/main/resources/images/FP3_select_lock_bootloader.png differ diff --git a/src/main/resources/images/FP3_select_unlock_bootloader.png b/src/main/resources/images/FP3_select_unlock_bootloader.png new file mode 100644 index 0000000000000000000000000000000000000000..10f02e9b24e9feb9531a4a31304e3da3191fe0c9 Binary files /dev/null and b/src/main/resources/images/FP3_select_unlock_bootloader.png differ diff --git a/src/main/resources/images/FP3_unlock_bootloader-2.png b/src/main/resources/images/FP3_unlock_bootloader-2.png new file mode 100644 index 0000000000000000000000000000000000000000..52fd2aa7de59976a0d75f77f4d22ed788253fdc0 Binary files /dev/null and b/src/main/resources/images/FP3_unlock_bootloader-2.png differ diff --git a/src/main/resources/images/FP3_unlock_bootloader.png b/src/main/resources/images/FP3_unlock_bootloader.png new file mode 100644 index 0000000000000000000000000000000000000000..019fa247ec4ea8885880bbf77b95c280ad594e72 Binary files /dev/null and b/src/main/resources/images/FP3_unlock_bootloader.png differ diff --git a/src/main/resources/instructions/imageName_en_EN_0008.properties b/src/main/resources/instructions/imageName_en_EN_0008.properties new file mode 100644 index 0000000000000000000000000000000000000000..94d83192f32dc955eb5760aca4b915a3ae183276 --- /dev/null +++ b/src/main/resources/instructions/imageName_en_EN_0008.properties @@ -0,0 +1,24 @@ +# Copyright 2019-2020 - 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 . + +install_instr_startFastboot=FP3_bootloader_mode.png +#install_instr_oemUnlock=FP3_unlock_bootloader.png +install_instr_selectUnlockBootloader=FP3_select_unlock_bootloader.png +install_instr_unlockBootloader=FP3_unlock_bootloader-2.png +install_instr_bootWarning=FP3_bootscreen_warning-2.png +install_instr_turnOffAgain=FP3_bootloader_mode.png +install_instr_selectLockBootloader=FP3_select_lock_bootloader.png +install_instr_lockBootloader=FP3_lock_bootloader-2.png +install_instr_startFastbootFromOptions=FP3_options_menu-2.png \ No newline at end of file diff --git a/src/main/resources/lang/translation.properties b/src/main/resources/lang/translation.properties index 71b19885fc964440733023bd83c8cdc744feeb09..07c2714c7cc697ea69ec71f86e8cae9a849223ee 100644 --- a/src/main/resources/lang/translation.properties +++ b/src/main/resources/lang/translation.properties @@ -102,13 +102,24 @@ download_lbl_connectionLost= Connection lost. Trying to reconnect... download_lbl_fileAlreadyUptoDate = File is already here and up-to-date. #install +##FP3 +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_selectLockBootloader=Select "LOCK BOOTLOADER" with "Volume" button +install_instr_lockBootloader=Confirm with "Power" button. After that the phone will reboot automatically + +## General install_title_Log=Log install_btn_sendLog=Send to support install_btn_sendLogAgain=Failure. Send again install_btn_sendLogSuccess=Log sent install_instr_turnOff=Turn off the phone install_instr_turnOffAgain=Turn off the phone again -install_instr_startDownload=Keep pressing simultaneously "Power" & "Home" & "Volume Down" until a blue screen appear to access Download Mode +install_instr_bootWarning=On the boot warning screen, press "Volume Down" to enter options menu +install_instr_startDownload=Keep pressing simultaneously "Power" & "Home" & "Volume Down" until a blue screen appear to access Download Mode +install_instr_startFastboot=Keep pressing simultaneously "Power" & "Volume Down" until a screen with green "START" appears to access Fastboot Mode +install_instr_startFastbootFromOptions=From options menu use "Volume Up/Down" to select "Fastboot" and "Power" to confirm install_instr_acceptWarning=Accept warning by pressing on "Volume Up" install_instr_verifyHeimdall=Verify Heimdall install_instr_oemUnlock=OEM Unlocking @@ -146,6 +157,7 @@ install_instr_startDl_pressPowerBixbyVolDown= Keep pressing simultaneously "Powe install_instr_startRec_pressPowerBixbyVolUp= Keep pressing simultaneously "Power" & "Bixby" & "Volume Up" until 'teamwin' screen appears install_instr_leaveDl_pressPowerBixbyVolDown= Keep pressing simultaneously "Power" & "Bixby" & "Volume Down" until device turns off script_error_waitDownload_1 = Can't detect device in "Download mode" +script_error_waitFastboot_1 = Can't detect device in "fastboot mode" script_error_oemUnlock_10 = Can't allow custom OS installation on your device script_error_installRecovery_101=Can't install TWRP script_error_waitRecovery_1 = Can't mount the "system" folder @@ -156,8 +168,14 @@ script_error_installFromRecovery_2 = Can't push the required file on the device script_error_installFromRecovery_3 = An error happened during the installation script_error_installFromRecovery_101 = No device's serial number provided script_error_installFromRecovery_102 = Can't locate the required file +script_error_installFromFastboot_1 = Could not wipe user data +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_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 script_error_unknown= The installation encounter an error java_error_unknow= The installation encounter an internal error flash_process_cancelled=The installation process has been cancelled @@ -215,6 +233,7 @@ installationTitle = Installation stepTitle1On7 = Connect device and start Download mode stepTitle2On7 = Unlock OEM stepTitle3On7 = Restart device in Download mode +stepTitle3On7FP3 = Unlock Bootloader and restart device in Fastboot mode stepTitle4On7 = Recovery installation stepTitle5On7 = Restart device in Recovery mode stepTitle6On7 = /e/ Installation @@ -226,4 +245,5 @@ stepTitle_startRecovery = Start in Recovery mode stepTitle_formatDataTurnOff = Format data and turn off stepTitle_restartRecovery = Restart in Recovery mode stepTitle_installOS = /e/ Installation -stepTitle_resizeDataPartition = Resize Data partition \ No newline at end of file +stepTitle_resizeDataPartition = Resize Data partition +stepTitle_StartInFastbootFP3 = Start device in Fastboot mode \ No newline at end of file diff --git a/src/main/resources/yaml/FP3.yml b/src/main/resources/yaml/FP3.yml new file mode 100644 index 0000000000000000000000000000000000000000..2a36c2eaaa98c073f4106dd14787857af12dba7f --- /dev/null +++ b/src/main/resources/yaml/FP3.yml @@ -0,0 +1,99 @@ +## Copyright 2019-2020 - 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: Vincent Bourgmayer +--- +name: FP3 +flash: + f1: + script: enableOemUnlock + parameters: ~ + codes: ~ + output: ~ + succeed: f2 + failed: ~ + f2: + script: wait-fastboot + parameters: + fastboot_folder_path: ${ADB_FOLDER_PATH} + codes: + ok: + 0: ~ + ko: + 1: script_error_waitFastboot_1 + output: ~ + succeed: f3 + failed: ~ + f3: + script: fp3_oem-unlock + parameters: + fastboot_folder_path: ${ADB_FOLDER_PATH} + codes: + ok: + 0: ~ + ko: + 10: script_error_oemUnlock_10 + output: ~ + succeed: f4 + failed: ~ + f4: + script: wait-fastboot-unlocked + parameters: + fastboot_folder_path: ${ADB_FOLDER_PATH} + codes: + ok: + 0: ~ + ko: + 1: script_error_waitFastboot_1 + output: ~ + succeed: f5 + failed: ~ + f5: + script: fp3_install-from-fastboot + parameters: + archive_path: ${ARCHIVE_PATH} + fastboot_folder_path: ${ADB_FOLDER_PATH} + java_folder_path: ${JAVA_FOLDER_PATH} + codes: + ok: + 0: ~ + ko: + 1: script_error_installFromFastboot_1 + 2: script_error_installFromFastboot_2 + 3: script_error_installFromFastboot_3 + 101: script_error_installFromFastboot_101 + 102: script_error_installFromFastboot_102 + output: ~ + succeed: f6 + failed: ~ + f6: + script: askAccount + parameters: ~ + codes: ~ + output: ~ + succeed: f7 + failed: ~ + f7: + script: wait-reboot-from-fastboot + parameters: + fastboot_folder_path: ${ADB_FOLDER_PATH} + codes: + ok: + 0: ~ + ko: + 1: script_error_unknown + 101: script_error_waitRebootFromFastboot_101 + output: ~ + succeed: ~ + failed: ~ \ No newline at end of file diff --git a/src/main/resources/yaml/FP3_fs.yml b/src/main/resources/yaml/FP3_fs.yml new file mode 100644 index 0000000000000000000000000000000000000000..7c2bc630facf30c980377becc6e4db5ce4040d12 --- /dev/null +++ b/src/main/resources/yaml/FP3_fs.yml @@ -0,0 +1,72 @@ +## Copyright 2019-2020 - 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: Vincent Bourgmayer +--- +sources: + rom: + url: https://images.ecloud.global/stable/FP3/IMG-e-latest-FP3.zip + filePath: IMG-e-latest-FP3.zip +flash: + f1: + ui: + type: enableOemUnlock + f2: + ui: + type: action + title: stepTitle_StartInFastbootFP3 + instruction: + - install_instr_turnOff + - install_instr_startFastboot + stepNumber: 1/5 + titleIcon: icon-download.png + f3: + ui: + type: load + title: stepTitle2On7 + instruction: + - install_instr_oemUnlock + stepNumber: 2/5 + averageTime: 12 + f4: + ui: + type: action + title: stepTitle3On7FP3 + instruction: + - install_instr_selectUnlockBootloader + - install_instr_unlockBootloader + - install_instr_bootWarning + - install_instr_startFastbootFromOptions + stepNumber: 3/5 + titleIcon: icon-download.png + f5: + ui: + type: load + title: stepTitle6On7 + instruction: + - install_instr_eosInstall + stepNumber: 4/5 + averageTime: 200 + f6: + ui: + type: askAccount + f7: + ui: + type: action + title: + instruction: + - install_instr_selectLockBootloader + - install_instr_lockBootloader + stepNumber: 5/5 + titleIcon: icon-download.png diff --git a/windows-installer-mui.nsi b/windows-installer-mui.nsi index 8411436621c0989a31e8fc8b8b4cd11dd8698fbd..7724c1337ca4c72c0dac220a33ae7a90a920cbc3 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 "0.10-beta" +!define appVersion "v0.11.0-beta" Name "Easy-installer ${appVersion}" # define installation directory InstallDir "$PROGRAMFILES64\easy-installer" diff --git a/windows-installer.nsi b/windows-installer.nsi deleted file mode 100644 index 410eb8bf83c7c23d74bc41be1b6045190cdf59b4..0000000000000000000000000000000000000000 --- a/windows-installer.nsi +++ /dev/null @@ -1,68 +0,0 @@ -!include LogicLib.nsh -!include "WordFunc.nsh" - !insertmacro VersionCompare -# this is a test nsis file -RequestExecutionLevel admin -!define appVersion "0.10-beta" -Name "Easy-installer ${appVersion}" -Icon "buildSrc/windows/easy-installer.ico" -# name the installer -OutFile "Easy-installer-setup.exe" - -# define installation directory -InstallDir "$PROGRAMFILES64\easy-installer" -InstallDirRegKey HKCU "Software\ecorp\easy-installer" "installDir" - -Page directory -Page instfiles -UninstPage uninstConfirm -UninstPage instfiles -Function .onInit -ReadRegStr $0 HKCU "Software\ecorp\easy-installer\uninstallTest" "uninstaller_loc" -${If} $0 != "" - ReadRegStr $1 HKCU "Software\ecorp\easy-installer" "version" - ${VersionCompare} $1 ${appVersion} $2 - ${If} $2 == 2 - ${If} ${Cmd} `MessageBox MB_YESNO|MB_ICONQUESTION "An older version is installed. Do you want to override it ?" /SD IDYES IDNO` - Quit - ${EndIf} - ${Else} - MessageBox MB_OK|MB_ICONEXCLAMATION "You already have the latest version" - Quit - ${EndIf} -${EndIf} -FunctionEnd - -# Default section start; every NSIS script has at least one section -Section - SetOutPath "$INSTDIR" - # Adds file(s) to be extracted to the current output path ($OUTDIR). - File /r "build/image/easy-installer-windows-x64/*" - File "buildSrc/windows/easy-installer.ico" - # create the uninstaller - WriteUninstaller "$INSTDIR\uninstall.exe" - # create a shortcut named "easy-installer" in the start menu programs directory - # point the new shortcut at the program uninstaller - CreateShortcut "$SMPROGRAMS\easy-installer.lnk" "$INSTDIR\bin\javaw.exe" "-m ecorp.easy.installer/ecorp.easy.installer.EasyInstaller" "$INSTDIR\easy-installer.ico" 0 - # create a shortcut named "easy-installer-uninstall" in the start menu programs directory - # point the new shortcut at the program uninstaller - CreateShortcut "$SMPROGRAMS\easy-installer-uninstall.lnk" "$INSTDIR\uninstall.exe" - WriteRegStr HKCU "Software\ecorp\easy-installer" "installDir" $INSTDIR - WriteRegStr HKCU "Software\ecorp\easy-installer" "version" ${appVersion} - WriteRegStr HKCU "Software\ecorp\easy-installer\uninstallTest" "uninstaller_loc" "$INSTDIR\uninstall.exe" - WriteRegStr HKCU "Software\ecorp\easy-installer\uninstallTest" "quietUninstaller_loc" '"$INSTDIR\uninstall.exe" /S' -SectionEnd -# Uninstaller -Section "uninstall" - # first, delete the uninstaller - Delete "$INSTDIR\uninstall.exe" - # second, remove the link from the start menu - Delete "$SMPROGRAMS\easy-installer-uninstall.lnk" - Delete "$SMPROGRAMS\easy-installer.lnk" - #remove the installation directory - RMDir /r "$INSTDIR" - RMDir /r "$LOCALAPPDATA\easy-installer" - #clean the registry - DeleteRegKey HKCU "Software\ecorp\easy-installer\uninstallTest" - DeleteRegKey HKCU "Software\ecorp\easy-installer" -SectionEnd