diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4f8c00f1f36733a42ca04ecea15cd1c8c9032a6d..d8116a8690f8034f8fa3f6be7250989b726e5386 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -37,7 +37,7 @@ build-docker: - docker build --cache-from $CONTAINER_IMAGE:$CONTAINER_TAG -t $CONTAINER_IMAGE:$CONTAINER_TAG . - docker push $CONTAINER_IMAGE:$CONTAINER_TAG -build: +build-ubuntu: image: registry.gitlab.e.foundation:5000/e/tools/easy-installer:stable stage: build variables: @@ -50,7 +50,23 @@ build: paths: - easy-installer*.snap -publish: + +build-windows: + image: registry.gitlab.e.foundation:5000/e/tools/easy-installer:stable + stage: build + variables: + GIT_SUBMODULE_STRATEGY: recursive + script: + - ./gradlew jlink + - makensis windows-installer-mui.nsi + - sha256sum Easy-installer-setup.exe > Easy-installer-setup.exe.sha256sum + artifacts: + name: "easy-installer-windows" + paths: + - Easy-installer-setup.exe + - Easy-installer-setup.exe.sha256sum + +publish-ubuntu: image: registry.gitlab.e.foundation:5000/e/tools/easy-installer:stable stage: publish variables: @@ -62,3 +78,21 @@ publish: rules: - if: '$CI_COMMIT_TAG' when: manual + +publish-windows: + image: registry.gitlab.e.foundation:5000/e/tools/easy-installer:stable + stage: publish + variables: + RELEASE_TYPE: beta + PUBLISH_USER: "gitlab" + PUBLISH_URL: "images.ecloud.global" + PUBLISH_DEST: "/mnt/docker/builds/uploads/easy-installer" + RELEASE_DEST: "/mnt/docker/builds/full/easy-installer" + script: + - "rsync -avz Easy-installer-setup.exe* $PUBLISH_USER@$PUBLISH_URL:$PUBLISH_DEST" + - ssh $PUBLISH_USER@$PUBLISH_URL "mv $PUBLISH_DEST/* $RELEASE_DEST/" + rules: + # to enable at release + #- if: '$CI_COMMIT_TAG' + # when: manual + - when: always diff --git a/Dockerfile b/Dockerfile index 366ef37e307cc5ebb8ff21466742d9c483e5d26a..558810f261d7abfbd40ae61d86aeaca284855912 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,6 +42,11 @@ COPY --from=builder /snap/core18 /snap/core18 COPY --from=builder /snap/snapcraft /snap/snapcraft COPY --from=builder /snap/bin/snapcraft /snap/bin/snapcraft +RUN apt-get update +RUN apt-get install --yes \ + nsis \ + rsync + # Generate locale. RUN apt-get update && apt-get dist-upgrade --yes && apt-get install --yes sudo locales && locale-gen en_US.UTF-8 diff --git a/build.gradle b/build.gradle index ac4696b5b41dc535f530471c6380cb36b55b9465..7516150a39b40bf33a4bb0628b61406ee328be04 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ plugins { 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.12.0' + id 'org.beryx.jlink' version '2.21.2' } processResources{ @@ -88,6 +88,7 @@ jlink { } launcher { name = "${appLauncher}" + //noConsole = true //apply only on windows } } @@ -131,12 +132,12 @@ tasks.jlink { copy { from('buildSrc/windows/heimdall') into("${buildDir}/image/${appLauncher}-${windowsPlatform}/bin") - include 'heimdall.exe', 'libusb-1.0.dll' + 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/adb') into("${buildDir}/image/${appLauncher}-${windowsPlatform}/bin/adb") - include 'adb.exe', 'fastboot.exe' + include 'adb.exe', 'fastboot.exe', 'AdbWinApi.dll', 'AdbWinUsbApi.dll', 'libwinpthread-1.dll' } //Handle bug in eOS diff --git a/buildSrc/windows/easy-installer.ico b/buildSrc/windows/easy-installer.ico new file mode 100644 index 0000000000000000000000000000000000000000..1c3d7504b4d3d7e84d469a89ff25497436214a40 Binary files /dev/null and b/buildSrc/windows/easy-installer.ico differ diff --git a/buildSrc/windows/heimdall/QtCore4.dll b/buildSrc/windows/heimdall/QtCore4.dll deleted file mode 100644 index ad948311334058a681bd8d48e49cd5326e900919..0000000000000000000000000000000000000000 Binary files a/buildSrc/windows/heimdall/QtCore4.dll and /dev/null differ diff --git a/buildSrc/windows/heimdall/QtGui4.dll b/buildSrc/windows/heimdall/QtGui4.dll deleted file mode 100644 index ec0021f6466fcdcee812d01469d90d79ee3b2231..0000000000000000000000000000000000000000 Binary files a/buildSrc/windows/heimdall/QtGui4.dll and /dev/null differ diff --git a/buildSrc/windows/heimdall/QtXml4.dll b/buildSrc/windows/heimdall/QtXml4.dll deleted file mode 100644 index ad0bc6db2c4648085af70c8488fd9ebcb0609fd1..0000000000000000000000000000000000000000 Binary files a/buildSrc/windows/heimdall/QtXml4.dll and /dev/null differ diff --git a/buildSrc/windows/heimdall/heimdall-frontend.exe b/buildSrc/windows/heimdall/heimdall-frontend.exe deleted file mode 100755 index 15e5118e3e7b642f6ec6e3e65308617b7b2b6e9c..0000000000000000000000000000000000000000 Binary files a/buildSrc/windows/heimdall/heimdall-frontend.exe and /dev/null differ diff --git a/buildSrc/windows/heimdall/heimdall.exe b/buildSrc/windows/heimdall/heimdall.exe old mode 100755 new mode 100644 index 5a04c80bcc9d745f3890a97375c0e2d0876a6f18..509b289402aa13df5152f2980f5283b272c6f23a Binary files a/buildSrc/windows/heimdall/heimdall.exe and b/buildSrc/windows/heimdall/heimdall.exe differ diff --git a/buildSrc/windows/heimdall/libgcc_s_seh-1.dll b/buildSrc/windows/heimdall/libgcc_s_seh-1.dll new file mode 100644 index 0000000000000000000000000000000000000000..6d84b21cb24a687564ab8d94286915dc1932d427 Binary files /dev/null and b/buildSrc/windows/heimdall/libgcc_s_seh-1.dll differ diff --git a/buildSrc/windows/heimdall/libstdc++-6.dll b/buildSrc/windows/heimdall/libstdc++-6.dll new file mode 100644 index 0000000000000000000000000000000000000000..d1753d36ec367570ff55e90609f0dfc2da6f5788 Binary files /dev/null and b/buildSrc/windows/heimdall/libstdc++-6.dll differ diff --git a/buildSrc/windows/heimdall/libusb-1.0.dll b/buildSrc/windows/heimdall/libusb-1.0.dll deleted file mode 100644 index 51a25ca7c7b3d4f03266e7776cd0149734069e76..0000000000000000000000000000000000000000 Binary files a/buildSrc/windows/heimdall/libusb-1.0.dll and /dev/null differ diff --git a/buildSrc/windows/heimdall/libwinpthread-1.dll b/buildSrc/windows/heimdall/libwinpthread-1.dll new file mode 100644 index 0000000000000000000000000000000000000000..dd1eb67e0c91072e2f3a9ca89609be11ff61ce17 Binary files /dev/null and b/buildSrc/windows/heimdall/libwinpthread-1.dll differ diff --git a/buildSrc/windows/heimdall/wdi-simple.exe b/buildSrc/windows/heimdall/wdi-simple.exe new file mode 100755 index 0000000000000000000000000000000000000000..8cab8705fcea0493032f8cda99ce5f0316b55693 Binary files /dev/null and b/buildSrc/windows/heimdall/wdi-simple.exe differ diff --git a/buildSrc/windows/welcomePage.bmp b/buildSrc/windows/welcomePage.bmp new file mode 100644 index 0000000000000000000000000000000000000000..f7cdd51fb6f6975258e4768ddcad1f7219b769c1 Binary files /dev/null and b/buildSrc/windows/welcomePage.bmp differ diff --git a/flash-scripts/windows/get-from-ecloud.bat b/flash-scripts/windows/get-from-ecloud.bat deleted file mode 100755 index e0a4a6df95c96de62db87d8b35b430008fbdc66f..0000000000000000000000000000000000000000 --- a/flash-scripts/windows/get-from-ecloud.bat +++ /dev/null @@ -1,75 +0,0 @@ -:: Copyright (C) 2019-2020 ECORP SAS - Author: Romain Hunault, 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_URL -:: %2: FOLDER (will be created if doesn't exist) - -:: Exit status -:: - 0 : archive downloaded -:: - 1 : Generic error code (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html) -:: - 2 : Parse error—for instance, when parsing command-line options, the ‘.wgetrc’ or ‘.netrc’... (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html) -:: - 3 : File I/O error (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html) -:: - 4 : Network failure (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html) -:: - 5 : SSL verification failure (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html) -:: - 6 : Username/password authentication failure (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html) -:: - 7 : Protocol errors (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html) -:: - 8 : Server issued an error response (see wget exit status here: https://www.gnu.org/software/wget/manual/html_node/Exit-Status.html) -:: - 10: No internet connection -:: - 11: Invalid file downloaded -:: - 101 : ARCHIVE_URL missing -:: - 102 : FOLDER missing - -set "ARCHIVE_URL=%1" -set "FOLDER=%2" - -ping -n 1 gitlab.e.foundation 2>&1 > nul -if errorLevel 1 ( - exit /b 10 -) -if not defined %FOLDER ( - exit /b 101 -) -if not defined %ARCHIVE_URL ( - exit /b 102 -) -mkdir %FOLDER% - -:: I'm not certain of the below block -for %%a in ("%ARCHIVE_URL%") do ( - set "FILENAME=%%~na" -) - -Powershell.exe -ExecutionPolicy remotesigned -Command "ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; Invoke-WebRequest -Uri '%ARCHIVE_URL%.sha256sum' -OutFile '%FOLDER%\%FILENAME%.sha256sum'" - -:: the following two lines should be the last to transform into batch -:: FOLDER_ESCAPED=echo %FOLDER% | sed 's/\/$//' | sed 's/\//\\\//g' - -:: this is a simple concatenation -:: sed -i 's/\(.*\) \(.*\)/\1 '${FOLDER_ESCAPED}'\/\2/' ${FOLDER}/${FILENAME}.sha256sum - -CertUtil -hashfile %FOLDER%\%FILENAME%.sha256sum -if not errorLevel 1( - exit /b 0 -) - -curl -o %FOLDER%\%FILENAME% ARCHIVE_URL - -CertUtil -hashfile %FOLDER%\%FILENAME%.sha256sum - -if errorLevel 1 ( - rm ${FILENAME} - exit /b 11 -) diff --git a/flash-scripts/windows/install-from-recovery.bat b/flash-scripts/windows/install-from-recovery.bat old mode 100644 new mode 100755 index b0ea5fe184159c4c7be6ae8e9c945d0ed6245bd9..8bae9979a72e5264c59e9bfcfae9e51e7b11450f --- a/flash-scripts/windows/install-from-recovery.bat +++ b/flash-scripts/windows/install-from-recovery.bat @@ -1,5 +1,3 @@ -::!/bin/bash - :: Copyright (C) 2019 ECORP SAS - Author: Romain Hunault :: :: This program is free software: you can redistribute it and/or modify @@ -18,7 +16,7 @@ :: Parameter :: $1: DEVICE_ID device identifier :: $2: ARCHIVE_PATH path to the /e/ archive to flash - +:: $3: ADB_FOLDER_PATH: the path where runnable adb is stored :: Exit status :: - 0 : /e/ installed :: - 1 : Problems occurred (adb returns only 1 if an error occurs) @@ -27,11 +25,15 @@ :: - 101 : DEVICE_ID missing :: - 102 : ARCHIVE_PATH missing -set "DEVICE_ID=%1" -set "ARCHIVE_PATH=%2" +set DEVICE_ID="%1" +set ARCHIVE_PATH="%2" +set ADB_FOLDER_PATH=%~3 +set ADB_PATH="%ADB_FOLDER_PATH%adb" +:: get basename of archive for %%a in ("%ARCHIVE_PATH%") do ( - set "ARCHIVE_NAME=%%~na" + set "ARCHIVE_NAME=%%~nxa" + echo %ARCHIVE_NAME% ) if not defined %DEVICE_ID ( @@ -42,19 +44,22 @@ if not defined %ARCHIVE_PATH ( exit /b 102 ) -adb -s %DEVICE_ID% shell twrp wipe system -adb -s %DEVICE_ID% shell twrp wipe cache -adb -s %DEVICE_ID% shell twrp wipe data -adb -s %DEVICE_ID% push %ARCHIVE_PATH% /sdcard +%ADB_PATH% -s %DEVICE_ID% shell twrp wipe system +%ADB_PATH% -s %DEVICE_ID% shell twrp wipe cache +%ADB_PATH% -s %DEVICE_ID% shell twrp wipe data +%ADB_PATH% -s %DEVICE_ID% push %ARCHIVE_PATH% sdcard if errorLevel 1 ( exit /b 2 ) -adb -s %DEVICE_ID% shell twrp install /sdcard/%ARCHIVE_NAME% +%ADB_PATH% -s %DEVICE_ID% shell twrp install /sdcard/%ARCHIVE_NAME% if errorLevel 1 ( exit /b 3 ) -timeout 1 >nul +::Timeout 1 +ping 127.0.0.1 -n 2 -w 1000 >NUL + +%ADB_PATH% -s %DEVICE_ID% shell rm /sdcard/%ARCHIVE_NAME% -adb -s %DEVICE_ID% shell rm /sdcard/%ARCHIVE_NAME% +ping 127.0.0.1 -n 2 -w 1000 >NUL -timeout 1 >nul +exit /b 0 \ No newline at end of file diff --git a/flash-scripts/windows/install-recovery.bat b/flash-scripts/windows/install-recovery.bat old mode 100644 new mode 100755 index 9f5c9d0af53f84af5b89902a48b51d94e3d5661e..69ee6778fbcbb9ecb3760d72ec852da68edadf76 --- a/flash-scripts/windows/install-recovery.bat +++ b/flash-scripts/windows/install-recovery.bat @@ -1,6 +1,3 @@ - -::!/bin/bash - :: Copyright (C) 2019 ECORP SAS - Author: Romain Hunault :: :: This program is free software: you can redistribute it and/or modify @@ -18,16 +15,22 @@ :: Parameter :: $1: TWRP_IMAGE_PATH need twrp path (${TWRP_FOLDER}/${TWRP}) - +:: $2: The folder where heimdall runnable is stored :: Exit status :: - 0 : Recovery installed :: - 1 : No problems occurred (heimdall returns only 1 if an error occurs) :: - 101 : TWRP_IMAGE_PATH missing -set "TWRP_IMAGE_PATH=%1" +set TWRP_IMAGE_PATH=%1 +set HEIMDALL_FOLDER=%~2 if not defined %TWRP_IMAGE_PATH ( exit /b 101 ) +"%HEIMDALL_FOLDER%wdi-simple.exe" +ping 127.0.0.1 -n 3 -w 10000 >NUL + +set HEIMDALL_PATH="%HEIMDALL_FOLDER%heimdall" +%HEIMDALL_PATH% flash --RECOVERY %TWRP_IMAGE_PATH% --no-reboot -heimdall flash --RECOVERY %TWRP_IMAGE_PATH% --no-reboot +exit /b 0 \ No newline at end of file diff --git a/flash-scripts/windows/verify-heimdall.bat b/flash-scripts/windows/verify-heimdall.bat old mode 100644 new mode 100755 index 6889adddf3905802300e56a6c8c4193009a5eb62..8602940069b2537459a36c6f8d0abba11361152e --- a/flash-scripts/windows/verify-heimdall.bat +++ b/flash-scripts/windows/verify-heimdall.bat @@ -14,13 +14,22 @@ :: :: You should have received a copy of the GNU General Public License :: along with this program. If not, see . - +:: $1: The folder where heimdall runnable is stored :: Exit status :: - 0 : OEM unlocked on device :: - 10 : heimdall error +set HEIMDALL_FOLDER=%~1 + +set HEIMDALL_PATH="%HEIMDALL_FOLDER%heimdall" + +"%HEIMDALL_FOLDER%wdi-simple.exe" -heimdall print-pit +ping 127.0.0.1 -n 3 -w 10000 >NUL -if %errorLevel==1 ( exit /b 10 ) +%HEIMDALL_PATH% print-pit +if errorLevel 1 ( + EXIT /b 10 +) +ping 127.0.0.1 -n 2 -w 5000 >NUL -timeout 5 >nul +exit /b 0 \ No newline at end of file diff --git a/flash-scripts/windows/wait-download.bat b/flash-scripts/windows/wait-download.bat old mode 100644 new mode 100755 index 0a767cbece0e8f9829a89b28c52b7bb203b6ef59..58f7fc24b256ccc792717af8127bbb0184170515 --- a/flash-scripts/windows/wait-download.bat +++ b/flash-scripts/windows/wait-download.bat @@ -1,5 +1,3 @@ -::!/bin/bash - :: Copyright (C) 2019 ECORP SAS - Author: Romain Hunault :: :: This program is free software: you can redistribute it and/or modify @@ -16,19 +14,24 @@ :: along with this program. If not, see . :: TODO: What if 2 devices detected? - +:: $1: The folder where heimdall runnable is stored :: Exit status :: - 0 : Device in download mode detected :: - 1 : Error +set HEIMDALL_FOLDER=%~1 +if not defined %HEIMDALL_FOLDER (EXIT /b 1) +set HEIMDALL_PATH="%HEIMDALL_FOLDER%heimdall" :heimdall_detect -heimdall detect >nul +%HEIMDALL_PATH% detect >nul if errorLevel 1 ( - timeout 1 >nul + echo not found + ping 127.0.0.1 -n 2 -w 1000 >NUL goto :heimdall_detect -) +) else (echo succeed) +EXIT /B 0 call heimdall_detect -timeout 5 >nul +ping 127.0.0.1 -n 2 -w 5000 >NUL \ No newline at end of file diff --git a/flash-scripts/windows/wait-reboot.bat b/flash-scripts/windows/wait-reboot.bat old mode 100644 new mode 100755 index dea9f9e4c13c725a59f68239fb38785b9eb8bfab..77fc5386bbf8ee1c05ae352cc4721503d803f6e6 --- a/flash-scripts/windows/wait-reboot.bat +++ b/flash-scripts/windows/wait-reboot.bat @@ -1,5 +1,3 @@ -::!/bin/bash - :: Copyright (C) 2019 ECORP SAS - Author: Romain Hunault :: :: This program is free software: you can redistribute it and/or modify @@ -17,6 +15,7 @@ :: Parameter :: $1: DEVICE_ID Device we are waiting for reboot +:: $2: ADB_FOLDER_PATH: the path where runnable adb is stored :: Exit status :: - 0 : New device detected @@ -24,20 +23,26 @@ :: - 10 : DEVICE_ID is missing :: - 101 : DEVICE_ID is not detected -set "DEVICE_ID=%1" +set DEVICE_ID="%1" +set ADB_FOLDER_PATH=%~2 + +set ADB_PATH="%ADB_FOLDER_PATH%adb" + + +echo "ADB path:"%ADB_PATH% if not defined %DEVICE_ID ( exit /b 10) -adb -s %DEVICE_ID% get-state 2>&1 | grep "recovery" -if errorLevel 1 (exit /b 101) -:wait-leave-recovery -adb -s ${DEVICE_ID} get-state -if %errorLevel% == 0 -goto :wait-leave-recovery +:: On check that device is in recovery mode +%ADB_PATH% -s %DEVICE_ID% get-state 2>&1 | findstr "recovery" +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 ) call wait-leave-recovery - +exit /b 0 \ No newline at end of file diff --git a/flash-scripts/windows/wait-recovery.bat b/flash-scripts/windows/wait-recovery.bat old mode 100644 new mode 100755 index 7d210166d4ebba56d207d543c4550838edfb1fac..0b363de7f674a766821ee91b31dabd18fd34824d --- a/flash-scripts/windows/wait-recovery.bat +++ b/flash-scripts/windows/wait-recovery.bat @@ -1,5 +1,3 @@ -::!/bin/bash - :: Copyright (C) 2019 ECORP SAS - Author: Romain Hunault :: :: This program is free software: you can redistribute it and/or modify @@ -28,30 +26,30 @@ :: - 1 : Error :: - 101 : DEVICES_LOCKED_PATH missing -set "DEVICE_ID=%1" +set DEVICE_ID="%1" +set ADB_FOLDER_PATH=%~2 :: check device_ID est définit -if defined %DEVICE_ID ( -adb -s %DEVICE_ID% wait-for-recovery -if not errorlevel 1 ( - adb -s %DEVICE_ID% shell twrp mount system - exit /b 0 -) -) - -::While no devide_id defined: try to find one -:while-loop -for /F "tokens=*" %%a IN ('"adb get-serialno "') do ( -SET "DEVICE_ID=%%a" -) if not defined %DEVICE_ID ( - timeout 1 >nul - goto :while-loop -) + exit /b 101 +) + +set ADB_PATH="%ADB_FOLDER_PATH%adb" +echo "waiting for recovery" -adb -s %DEVICE_ID% wait-for-recovery -if not errorLevel 1 ( adb -s %DEVICE_ID% shell twrp mount system ) +%ADB_PATH% -s %DEVICE_ID% wait-for-recovery +if not errorlevel 1 ( + echo "device found in recovery" + %ADB_PATH% -s %DEVICE_ID% shell "twrp mount system" + if errorlevel 1 ( + echo "twrp mount system failed" + exit /b 1 + ) +) else ( + echo "device not detected in recovery" + exit /b 2 +) -echo %DEVICE_ID% +exit /b 0 \ No newline at end of file diff --git a/src/main/java/ecorp/easy/installer/AppConstants.java b/src/main/java/ecorp/easy/installer/AppConstants.java index eb45c4485949304db03c61046ac93af7ce0ecc5b..4fca44c51d10527cc37fcd955ba69dd06208ea28 100644 --- a/src/main/java/ecorp/easy/installer/AppConstants.java +++ b/src/main/java/ecorp/easy/installer/AppConstants.java @@ -105,7 +105,7 @@ public abstract class AppConstants { public static String getScriptsFolderPath(){ if (System.getProperty("IDE", null) != null) { String osPath = ""; - if (OsName.contains("win")) { + if (isWindowsOs()) { osPath = "windows"; } else if (isLinuxOs() || OsName.contains("mac") ) { osPath = "linux"; @@ -122,7 +122,7 @@ public abstract class AppConstants { public static String getADBFolderPath(){ if (System.getProperty("IDE", null) != null) { String osPath = ""; - if (OsName.contains("win")) { + if (isWindowsOs()) { osPath = "windows"; } else if (OsName.contains("mac")) { osPath = "OSX"; @@ -141,7 +141,7 @@ public abstract class AppConstants { public static String getHeimdallFolderPath(){ if (System.getProperty("IDE", null) != null) { String osPath = null; - if (OsName.contains("win")) { + if (isWindowsOs()) { osPath = "windows"; } else if (OsName.contains("mac")) { osPath = "OSX"; @@ -188,16 +188,26 @@ public abstract class AppConstants { // returns a path that is specific to snap and is writable. if ( isLinuxOs() && isSnap()){ return System.getenv("SNAP_USER_COMMON")+Separator; - }else{ + }else if(isWindowsOs()){ + return System.getenv("localappdata")+Separator+"easy-installer"+Separator; + }else return getRootPath(); - } + } /** * Tell if the current OS is linux/unix * @return true if linux or unix */ - private static boolean isLinuxOs(){ + public static boolean isLinuxOs(){ return OsName.contains("nix") || OsName.contains("nux"); } + + /** + * Tell if the current OS is linux/unix + * @return true if linux or unix + */ + public static boolean isWindowsOs(){ + return OsName.toLowerCase().contains("win"); + } } diff --git a/src/main/java/ecorp/easy/installer/EasyInstaller.java b/src/main/java/ecorp/easy/installer/EasyInstaller.java index 0647fe0bdb4b644e346540ed87bcb3f8bb89e3fc..6bf55b1679ddf6e7c5dcf624bd7d102dd5d27413 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.9.0-beta"); + stage.setTitle(i18n.getString("appTitle")+"v0.10-beta"); stage.setScene(scene); stage.setResizable(true); diff --git a/src/main/java/ecorp/easy/installer/models/Command.java b/src/main/java/ecorp/easy/installer/models/Command.java index 5e6cf95c3f80b07d52de66c567a381ee7bfbe2a8..cce01939d6dd66a72445a94031983353970421b0 100644 --- a/src/main/java/ecorp/easy/installer/models/Command.java +++ b/src/main/java/ecorp/easy/installer/models/Command.java @@ -16,12 +16,16 @@ */ package ecorp.easy.installer.models; +import ecorp.easy.installer.AppConstants; import java.io.BufferedReader; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.util.Arrays; import java.util.HashMap; import java.util.Map; +import java.util.regex.Pattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -36,14 +40,14 @@ public class Command { private String shellOutput; //The shell text output of the execution of the script Process pc; //Process which run the command Step step; //Object which contain data about the command like next step, ... - private final static Logger logger = LoggerFactory.getLogger(Command.class); - + private final static Logger logger = LoggerFactory.getLogger(Command.class); + + //private final static Pattern SPACE_PATTERN = Pattern.compile("\\s+"); /** * Constructor for instance in context of FlashThread * @param runScriptCmd * @param step */ - public Command(String runScriptCmd, Step step){ this.step = step; this.command = runScriptCmd+step.getScript(); @@ -131,11 +135,31 @@ public class Command { * @throws InterruptedException */ public void execAndReadOutput() throws IOException, InterruptedException{ - - logger.debug("execAndReadOutput(), command string = {} ", this.command); - - ProcessBuilder pb = new ProcessBuilder(getFinalCmd()); - + ProcessBuilder pb; + if(AppConstants.isWindowsOs()) + { + //pb = new ProcessBuilder(); + String[] commandArray= new String[parameters.size()+3]; + commandArray[0] = "cmd.exe"; + commandArray[1] = "/c"; + commandArray[2] = "\"\""+command+"\""; + + int i = 2; + for(String param : parameters.values()){ + String quotedParam = "\""+param+"\""; + if(i+1 == parameters.size()-1){ + quotedParam += "\""; + } + commandArray[++i] = quotedParam; + } + pb = new ProcessBuilder(commandArray); + logger.debug("command: {}", pb.command()); + //pb.directory(new File(AppConstants.getRootPath().substring(0, AppConstants.getRootPath().length()-2))); + //logger.debug("Pb dir: {}", pb.directory()); + //pb.command(commandArray); + }else{ + pb = new ProcessBuilder(getFinalCmd()); + } pb.redirectErrorStream(true); pc= pb.start(); logger.info("Command's Process started"); @@ -167,6 +191,29 @@ public class Command { } + /** + * This method try to solve issue of batch's args with space (windows only) + * if arg contain os's path separator & Space + * Try to split the given arg on Os's path separator + * Then seek each part with space + * when found, replace part with part surrounded with quote. + * + * NB: I think it would be easier with a regexp replace but I'm not good with regexp + * @return the quoted arg string + */ + /* private String quoteSpacedArg(String arg){ + if(arg.contains("\\") && SPACE_PATTERN.matcher(arg).find() ){ + String[] splittedArg = arg.split("\\\\"); //doesn't work with "AppConstants.Separator" + for(String part : splittedArg){ + if(SPACE_PATTERN.matcher(part).find()){ + arg = arg.replaceAll(part, "\""+part+"\""); + } + } + } + return arg; + }*/ + + public void cancel(){ logger.info("cancel()"); this.cancelled = true; diff --git a/src/main/java/ecorp/easy/installer/threads/DeviceDetectionTask.java b/src/main/java/ecorp/easy/installer/threads/DeviceDetectionTask.java index 47b913fcca26ba2ce7aa03968370999626476f58..bab621ac36949d2fa3ce97e234d9d53d65e1d0eb 100644 --- a/src/main/java/ecorp/easy/installer/threads/DeviceDetectionTask.java +++ b/src/main/java/ecorp/easy/installer/threads/DeviceDetectionTask.java @@ -20,6 +20,7 @@ import ecorp.easy.installer.AppConstants; import ecorp.easy.installer.exceptions.TooManyDevicesException; import ecorp.easy.installer.models.Command; import ecorp.easy.installer.models.Device; +import java.util.regex.Pattern; import javafx.concurrent.Task; import org.slf4j.Logger; @@ -32,7 +33,8 @@ import org.slf4j.LoggerFactory; 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{ @@ -62,7 +64,7 @@ public class DeviceDetectionTask extends Task{ Device detectedDevice = null; - String[] outputs = cmd.getShellOutput().split("\\R"); + String[] outputs = LINEBREAK_PATTERN.split(cmd.getShellOutput()); logger.debug(" raw shell outputs = {} ", cmd.getShellOutput()); if(outputs.length <=1){ logger.info(" Waiting"); @@ -101,7 +103,7 @@ public class DeviceDetectionTask extends Task{ Device result = null; //Split string on each space - String[] datas = resultLine.split("\\s+"); + String[] datas = SPACE_PATTERN.split(resultLine); //loop over each subString for(String stringPart : datas){ diff --git a/src/main/java/ecorp/easy/installer/threads/ThreadFactory.java b/src/main/java/ecorp/easy/installer/threads/ThreadFactory.java index 0ad19acce88e4d709562c0673f85e566713c36bb..f44978fc9ac5cabbb47c4223533b69aa119defd4 100644 --- a/src/main/java/ecorp/easy/installer/threads/ThreadFactory.java +++ b/src/main/java/ecorp/easy/installer/threads/ThreadFactory.java @@ -221,7 +221,6 @@ public class ThreadFactory { flashMould.getSteps().entrySet().forEach((entry) -> { - //@TODO: it's may be there that I should handle askAccount step result.addCommand(entry.getKey(), new Command(AppConstants.getScriptsFolderPath(), new Step( entry.getValue() ) ) ); }); return result; diff --git a/src/main/resources/yaml/hero2lte.yml b/src/main/resources/yaml/hero2lte.yml index d0bf18d217ea8dd2f91ded168e7b4dc30b4b8d5b..7a06b4c802fbf98d1b476a755b6caa53f7367a37 100644 --- a/src/main/resources/yaml/hero2lte.yml +++ b/src/main/resources/yaml/hero2lte.yml @@ -27,32 +27,8 @@ flash: 1: script_error_waitDownload_1 output: ~ succeed: f2 - failed: ~ - f2: - script: verify-heimdall - parameters: - heimdall_folder_path: ${HEIMDALL_FOLDER_PATH} - codes: - ok: - 0: ~ - ko: - 10: script_error_oemUnlock_10 - output: ~ - succeed: f3 failed: ~ - f3: - script: wait-download - parameters: - heimdall_folder_path: ${HEIMDALL_FOLDER_PATH} - codes: - ok: - 0: ~ - ko: - 1: script_error_waitDownload_1 - output: ~ - succeed: f4 - failed: ~ - f4: + f2: script: install-recovery parameters: twrp_image_path: ${TWRP_IMAGE_PATH} @@ -64,9 +40,9 @@ flash: 1: script_error_unknown 101: script_error_installRecovery_101 output: ~ - succeed: f5 + succeed: f3 failed: ~ - f5: + f3: script: wait-recovery parameters: device_id: ${DEVICE_ID} @@ -79,9 +55,9 @@ flash: 101: script_error_waitRecovery_101 102: script_error_waitRecovery_102 output: ~ - succeed: f6 + succeed: f4 failed: ~ - f6: + f4: script: install-from-recovery parameters: device_id: ${DEVICE_ID} @@ -97,16 +73,16 @@ flash: 101: script_error_installFromRecovery_101 102: script_error_installFromRecovery_102 output: ~ - succeed: f7 + succeed: f5 failed: ~ - f7: + f5: script: askAccount parameters: ~ codes: ~ output: ~ - succeed: f8 + succeed: f6 failed: ~ - f8: + f6: script: wait-reboot parameters: device_id: ${DEVICE_ID} diff --git a/src/main/resources/yaml/hero2lte_fs.yml b/src/main/resources/yaml/hero2lte_fs.yml index ab7c0238a8313566c40333c4a52e36732a2631d2..afa1c0c27a0f3d6b73bef9a0922a9617bfb24b6e 100644 --- a/src/main/resources/yaml/hero2lte_fs.yml +++ b/src/main/resources/yaml/hero2lte_fs.yml @@ -30,35 +30,17 @@ flash: - install_instr_turnOff - install_instr_startDownload - install_instr_acceptWarning - stepNumber: 1/7 + stepNumber: 1/5 titleIcon: icon-download.png f2: - ui: - type: load - title: stepTitle2On7 - instruction: - - install_instr_verifyHeimdall - stepNumber: 2/7 - averageTime: 8 - f3: - ui: - type: action - title: stepTitle3On7 - instruction: - - install_instr_turnOffAgain - - install_instr_startDownload - - install_instr_acceptWarning - stepNumber: 3/7 - titleIcon: icon-download.png - f4: ui: type: load title: stepTitle4On7 instruction: - install_instr_recoveryInstall - stepNumber: 4/7 + stepNumber: 2/5 averageTime: 6 - f5: + f3: ui: type: action title: stepTitle5On7 @@ -66,20 +48,20 @@ flash: - install_instr_leaveDownload - install_instr_startRecovery - install_instr_swipeTwrp - stepNumber: 5/7 + stepNumber: 3/5 titleIcon: icon-download.png - f6: + f4: ui: type: load title: stepTitle6On7 instruction: - install_instr_eosInstall - stepNumber: 6/7 + stepNumber: 4/5 averageTime: 475 - f7: + f5: ui: type: askAccount - f8: + f6: ui: type: action title: stepTitle7On7 @@ -96,5 +78,5 @@ flash: - install_instr_swipeForOk - install_instr_tapRebootSystem - install_instr_doNotInstall - stepNumber: 7/7 + stepNumber: 5/5 titleIcon: icon-search.png \ No newline at end of file diff --git a/src/main/resources/yaml/herolte.yml b/src/main/resources/yaml/herolte.yml index e8dd83a9d46c86f4fc8c494ded46bb5b90416310..8021fbca705165655b5b8a5e2df6679dbfda79f9 100644 --- a/src/main/resources/yaml/herolte.yml +++ b/src/main/resources/yaml/herolte.yml @@ -27,32 +27,8 @@ flash: 1: script_error_waitDownload_1 output: ~ succeed: f2 - failed: ~ - f2: - script: verify-heimdall - parameters: - heimdall_folder_path: ${HEIMDALL_FOLDER_PATH} - codes: - ok: - 0: ~ - ko: - 10: script_error_oemUnlock_10 - output: ~ - succeed: f3 failed: ~ - f3: - script: wait-download - parameters: - heimdall_folder_path: ${HEIMDALL_FOLDER_PATH} - codes: - ok: - 0: ~ - ko: - 1: script_error_waitDownload_1 - output: ~ - succeed: f4 - failed: ~ - f4: + f2: script: install-recovery parameters: twrp_image_path: ${TWRP_IMAGE_PATH} @@ -64,9 +40,9 @@ flash: 1: script_error_unknown 101: script_error_installRecovery_101 output: ~ - succeed: f5 + succeed: f3 failed: ~ - f5: + f3: script: wait-recovery parameters: device_id: ${DEVICE_ID} @@ -79,9 +55,9 @@ flash: 101: script_error_waitRecovery_101 102: script_error_waitRecovery_102 output: ~ - succeed: f6 + succeed: f4 failed: ~ - f6: + f4: script: install-from-recovery parameters: device_id: ${DEVICE_ID} @@ -97,16 +73,16 @@ flash: 101: script_error_installFromRecovery_101 102: script_error_installFromRecovery_102 output: ~ - succeed: f7 + succeed: f5 failed: ~ - f7: + f5: script: askAccount parameters: ~ codes: ~ output: ~ - succeed: f8 + succeed: f6 failed: ~ - f8: + f6: script: wait-reboot parameters: device_id: ${DEVICE_ID} diff --git a/src/main/resources/yaml/herolte_fs.yml b/src/main/resources/yaml/herolte_fs.yml index 0773e5cc75bc9c24e66df1e68e2df546358837b2..36bf18af23cd39766b4b90fc77d0da0e00826f58 100644 --- a/src/main/resources/yaml/herolte_fs.yml +++ b/src/main/resources/yaml/herolte_fs.yml @@ -30,35 +30,17 @@ flash: - install_instr_turnOff - install_instr_startDownload - install_instr_acceptWarning - stepNumber: 1/7 + stepNumber: 1/5 titleIcon: icon-download.png f2: - ui: - type: load - title: stepTitle2On7 - instruction: - - install_instr_verifyHeimdall - stepNumber: 2/7 - averageTime: 8 - f3: - ui: - type: action - title: stepTitle3On7 - instruction: - - install_instr_turnOffAgain - - install_instr_startDownload - - install_instr_acceptWarning - stepNumber: 3/7 - titleIcon: icon-download.png - f4: ui: type: load title: stepTitle4On7 instruction: - install_instr_recoveryInstall - stepNumber: 4/7 + stepNumber: 2/5 averageTime: 6 - f5: + f3: ui: type: action title: stepTitle5On7 @@ -66,20 +48,20 @@ flash: - install_instr_leaveDownload - install_instr_startRecovery - install_instr_swipeTwrp - stepNumber: 5/7 + stepNumber: 3/5 titleIcon: icon-download.png - f6: + f4: ui: type: load title: stepTitle6On7 instruction: - install_instr_eosInstall - stepNumber: 6/7 + stepNumber: 4/5 averageTime: 475 - f7: + f5: ui: type: askAccount - f8: + f6: ui: type: action title: stepTitle7On7 @@ -96,5 +78,5 @@ flash: - install_instr_swipeForOk - install_instr_tapRebootSystem - install_instr_doNotInstall - stepNumber: 7/7 + stepNumber: 5/5 titleIcon: icon-search.png \ No newline at end of file diff --git a/src/main/resources/yaml/star2lte.yml b/src/main/resources/yaml/star2lte.yml index 90d9e32b380658223e6092aed0a4f4dd0c50c003..b3a10633bea9dd7896e915fef0c03962acc2f6cf 100644 --- a/src/main/resources/yaml/star2lte.yml +++ b/src/main/resources/yaml/star2lte.yml @@ -27,32 +27,8 @@ flash: 1: script_error_waitDownload_1 output: ~ succeed: f2 - failed: ~ - f2: - script: verify-heimdall - parameters: - heimdall_folder_path: ${HEIMDALL_FOLDER_PATH} - codes: - ok: - 0: ~ - ko: - 10: script_error_oemUnlock_10 - output: ~ - succeed: f3 failed: ~ - f3: - script: wait-download - parameters: - heimdall_folder_path: ${HEIMDALL_FOLDER_PATH} - codes: - ok: - 0: ~ - ko: - 1: script_error_waitDownload_1 - output: ~ - succeed: f4 - failed: ~ - f4: + f2: script: install-recovery parameters: twrp_image_path: ${TWRP_IMAGE_PATH} @@ -64,9 +40,9 @@ flash: 1: script_error_unknown 101: script_error_installRecovery_101 output: ~ - succeed: f5 + succeed: f3 failed: ~ - f5: + f3: script: wait-recovery parameters: device_id: ${DEVICE_ID} @@ -79,9 +55,9 @@ flash: 101: script_error_waitRecovery_101 102: script_error_waitRecovery_102 output: ~ - succeed: f6 + succeed: f4 failed: ~ - f6: + f4: script: wait-reboot parameters: device_id: ${DEVICE_ID} @@ -94,9 +70,9 @@ flash: 10: script_error_waitReboot_10 101: script_error_waitReboot_101 output: ~ - succeed: f7 + succeed: f5 failed: ~ - f7: + f5: script: wait-recovery parameters: device_id: ${DEVICE_ID} @@ -109,9 +85,9 @@ flash: 101: script_error_waitRecovery_101 102: script_error_waitRecovery_102 output: ~ - succeed: f8 + succeed: f6 failed: ~ - f8: + f6: script: install-from-recovery parameters: device_id: ${DEVICE_ID} @@ -127,9 +103,9 @@ flash: 101: script_error_installFromRecovery_101 102: script_error_installFromRecovery_102 output: ~ - succeed: f9 + succeed: f7 failed: ~ - f9: + f7: script: install-from-recovery parameters: device_id: ${DEVICE_ID} @@ -145,9 +121,9 @@ flash: 101: script_error_installFromRecovery_101 102: script_error_installFromRecovery_102 output: ~ - succeed: f10 + succeed: f8 failed: ~ - f10: + f8: script: install-from-recovery parameters: device_id: ${DEVICE_ID} @@ -163,16 +139,16 @@ flash: 101: script_error_installFromRecovery_101 102: script_error_installFromRecovery_102 output: ~ - succeed: f11 + succeed: f9 failed: ~ - f11: + f9: script: askAccount parameters: ~ codes: ~ output: ~ - succeed: f12 + succeed: f10 failed: ~ - f12: + f10: script: wait-reboot parameters: device_id: ${DEVICE_ID} diff --git a/src/main/resources/yaml/star2lte_fs.yml b/src/main/resources/yaml/star2lte_fs.yml index 08446638f56dd61acb0372ef2fedfbc33575fba6..2ac7edbe69e3f17d4db1aae6a39630cbf6ee88df 100644 --- a/src/main/resources/yaml/star2lte_fs.yml +++ b/src/main/resources/yaml/star2lte_fs.yml @@ -29,24 +29,6 @@ sources: filePath: no-verity-opt-encrypt-samsung-1.0.zip flash: f1: - ui: - type: action - title: stepTitle1On7 - instruction: - - install_instr_turnOff - - install_instr_startDl_pressPowerBixbyVolDown - - install_instr_acceptWarning - stepNumber: 1/7 - titleIcon: icon-download.png - f2: - ui: - type: load - title: stepTitle_verifyHeimdall - instruction: - - install_instr_verifyHeimdall - stepNumber: 2/7 - averageTime: 8 - f3: ui: type: action title: stepTitle_oemUnlock @@ -57,17 +39,17 @@ flash: - install_instr_acceptFactoryReset - install_instr_startDl_pressPowerBixbyVolDown - install_instr_acceptWarning - stepNumber: 3/7 + stepNumber: 1/9 titleIcon: icon-download.png - f4: + f2: ui: type: load title: stepTitle4On7 instruction: - install_instr_recoveryInstall - stepNumber: 4/7 + stepNumber: 2/9 averageTime: 6 - f5: + f3: ui: type: action title: stepTitle5On7 @@ -75,9 +57,9 @@ flash: - install_instr_leaveDl_pressPowerBixbyVolDown - install_instr_startRec_pressPowerBixbyVolUp - install_instr_keepReadOnly - stepNumber: 5/7 + stepNumber: 3/9 titleIcon: icon-download.png - f6: + f4: ui: type: action title: stepTitle5On7 @@ -90,44 +72,44 @@ flash: - install_instr_tapReboot - install_instr_tapRebootRecovery - install_instr_doNotInstall - stepNumber: 5/7 + stepNumber: 4/9 titleIcon: icon-download.png - f7: + f5: ui: type: action title: stepTitle5On7 instruction: - install_instr_swipeTwrp - stepNumber: 5/7 + stepNumber: 5/9 titleIcon: icon-download.png - f8: + f6: ui: type: load title: stepTitle6On7 instruction: - install_instr_patchInstall - stepNumber: 6/7 + stepNumber: 6/9 averageTime: 55 - f9: + f7: ui: type: load title: stepTitle6On7 instruction: - install_instr_vendorInstall - stepNumber: 6/7 + stepNumber: 7/9 averageTime: 65 - f10: + f8: ui: type: load title: stepTitle6On7 instruction: - install_instr_eosInstall - stepNumber: 6/7 + stepNumber: 8/9 averageTime: 440 - f11: + f9: ui: type: askAccount - f12: + f10: ui: type: action title: stepTitle7On7 @@ -144,5 +126,5 @@ flash: - install_instr_swipeForOk - install_instr_tapRebootSystem - install_instr_doNotInstall - stepNumber: 7/7 + stepNumber: 9/9 titleIcon: icon-download.png \ No newline at end of file diff --git a/src/main/resources/yaml/starlte.yml b/src/main/resources/yaml/starlte.yml index 6e83655255388c2ea4b0b195dea8357c5c055029..64edfdf4ca515cb207f8419623dc0c7b34286c78 100644 --- a/src/main/resources/yaml/starlte.yml +++ b/src/main/resources/yaml/starlte.yml @@ -16,7 +16,7 @@ --- name: starlte flash: - f1: + f1: script: wait-download parameters: heimdall_folder_path: ${HEIMDALL_FOLDER_PATH} @@ -27,32 +27,8 @@ flash: 1: script_error_waitDownload_1 output: ~ succeed: f2 - failed: ~ - f2: - script: verify-heimdall - parameters: - heimdall_folder_path: ${HEIMDALL_FOLDER_PATH} - codes: - ok: - 0: ~ - ko: - 10: script_error_oemUnlock_10 - output: ~ - succeed: f3 failed: ~ - f3: - script: wait-download - parameters: - heimdall_folder_path: ${HEIMDALL_FOLDER_PATH} - codes: - ok: - 0: ~ - ko: - 1: script_error_waitDownload_1 - output: ~ - succeed: f4 - failed: ~ - f4: + f2: script: install-recovery parameters: twrp_image_path: ${TWRP_IMAGE_PATH} @@ -64,9 +40,9 @@ flash: 1: script_error_unknown 101: script_error_installRecovery_101 output: ~ - succeed: f5 + succeed: f3 failed: ~ - f5: + f3: script: wait-recovery parameters: device_id: ${DEVICE_ID} @@ -80,9 +56,9 @@ flash: 101: script_error_waitRecovery_101 102: script_error_waitRecovery_102 output: ~ - succeed: f6 + succeed: f4 failed: ~ - f6: + f4: script: wait-reboot parameters: device_id: ${DEVICE_ID} @@ -95,9 +71,9 @@ flash: 10: script_error_waitReboot_10 101: script_error_waitReboot_101 output: ~ - succeed: f7 + succeed: f5 failed: ~ - f7: + f5: script: wait-recovery parameters: device_id: ${DEVICE_ID} @@ -110,9 +86,9 @@ flash: 101: script_error_waitRecovery_101 102: script_error_waitRecovery_102 output: ~ - succeed: f8 + succeed: f6 failed: ~ - f8: + f6: script: install-from-recovery parameters: device_id: ${DEVICE_ID} @@ -128,9 +104,9 @@ flash: 101: script_error_installFromRecovery_101 102: script_error_installFromRecovery_102 output: ~ - succeed: f9 + succeed: f7 failed: ~ - f9: + f7: script: install-from-recovery parameters: device_id: ${DEVICE_ID} @@ -146,9 +122,9 @@ flash: 101: script_error_installFromRecovery_101 102: script_error_installFromRecovery_102 output: ~ - succeed: f10 + succeed: f8 failed: ~ - f10: + f8: script: install-from-recovery parameters: device_id: ${DEVICE_ID} @@ -164,16 +140,16 @@ flash: 101: script_error_installFromRecovery_101 102: script_error_installFromRecovery_102 output: ~ - succeed: f11 + succeed: f9 failed: ~ - f11: + f9: script: askAccount parameters: ~ codes: ~ output: ~ - succeed: f12 + succeed: f10 failed: ~ - f12: + f10: script: wait-reboot parameters: device_id: ${DEVICE_ID} diff --git a/src/main/resources/yaml/starlte_fs.yml b/src/main/resources/yaml/starlte_fs.yml index 426d32c9edd1d4bedf4b1e46c67ebcae008cf4ea..bbb54969aa66a5afdfbcc217286e73e2050680ae 100644 --- a/src/main/resources/yaml/starlte_fs.yml +++ b/src/main/resources/yaml/starlte_fs.yml @@ -29,24 +29,6 @@ sources: filePath: no-verity-opt-encrypt-samsung-1.0.zip flash: f1: - ui: - type: action - title: stepTitle1On7 - instruction: - - install_instr_turnOff - - install_instr_startDl_pressPowerBixbyVolDown - - install_instr_acceptWarning - stepNumber: 1/7 - titleIcon: icon-download.png - f2: - ui: - type: load - title: stepTitle_verifyHeimdall - instruction: - - install_instr_verifyHeimdall - stepNumber: 2/7 - averageTime: 8 - f3: ui: type: action title: stepTitle_oemUnlock @@ -57,17 +39,17 @@ flash: - install_instr_acceptFactoryReset - install_instr_startDl_pressPowerBixbyVolDown - install_instr_acceptWarning - stepNumber: 3/7 + stepNumber: 1/9 titleIcon: icon-download.png - f4: + f2: ui: type: load title: stepTitle4On7 instruction: - install_instr_recoveryInstall - stepNumber: 4/7 + stepNumber: 2/9 averageTime: 6 - f5: + f3: ui: type: action title: stepTitle5On7 @@ -75,9 +57,9 @@ flash: - install_instr_leaveDl_pressPowerBixbyVolDown - install_instr_startRec_pressPowerBixbyVolUp - install_instr_keepReadOnly - stepNumber: 5/7 + stepNumber: 3/9 titleIcon: icon-download.png - f6: + f4: ui: type: action title: stepTitle5On7 @@ -90,44 +72,44 @@ flash: - install_instr_tapReboot - install_instr_tapRebootRecovery - install_instr_doNotInstall - stepNumber: 5/7 + stepNumber: 4/9 titleIcon: icon-download.png - f7: + f5: ui: type: action title: stepTitle5On7 instruction: - install_instr_swipeTwrp - stepNumber: 5/7 + stepNumber: 5/9 titleIcon: icon-download.png - f8: + f6: ui: type: load title: stepTitle6On7 instruction: - install_instr_patchInstall - stepNumber: 6/7 + stepNumber: 6/9 averageTime: 55 - f9: + f7: ui: type: load title: stepTitle6On7 instruction: - install_instr_vendorInstall - stepNumber: 6/7 + stepNumber: 7/9 averageTime: 65 - f10: + f8: ui: type: load title: stepTitle6On7 instruction: - install_instr_eosInstall - stepNumber: 6/7 + stepNumber: 8/9 averageTime: 440 - f11: + f9: ui: type: askAccount - f12: + f10: ui: type: action title: stepTitle7On7 @@ -144,5 +126,5 @@ flash: - install_instr_swipeForOk - install_instr_tapRebootSystem - install_instr_doNotInstall - stepNumber: 7/7 + stepNumber: 9/9 titleIcon: icon-download.png \ No newline at end of file diff --git a/src/main/resources/yaml/zeroflte.yml b/src/main/resources/yaml/zeroflte.yml index b8b05d06e06c27a93297f43819cb97fbe1ccf117..efdddb6b19c61ff3cfa789d06c7c8c39a87e48a5 100644 --- a/src/main/resources/yaml/zeroflte.yml +++ b/src/main/resources/yaml/zeroflte.yml @@ -28,31 +28,7 @@ flash: output: ~ succeed: f2 failed: ~ - f2: - script: verify-heimdall - parameters: - heimdall_folder_path: ${HEIMDALL_FOLDER_PATH} - codes: - ok: - 0: ~ - ko: - 10: script_error_oemUnlock_10 - output: ~ - succeed: f3 - failed: ~ - f3: - script: wait-download - parameters: - heimdall_folder_path: ${HEIMDALL_FOLDER_PATH} - codes: - ok: - 0: ~ - ko: - 1: script_error_waitDownload_1 - output: ~ - succeed: f4 - failed: ~ - f4: + f2: script: install-recovery parameters: twrp_image_path: ${TWRP_IMAGE_PATH} @@ -64,9 +40,9 @@ flash: 1: script_error_unknown 101: script_error_installRecovery_101 output: ~ - succeed: f5 + succeed: f3 failed: ~ - f5: + f3: script: wait-recovery parameters: device_id: ${DEVICE_ID} @@ -79,9 +55,9 @@ flash: 101: script_error_waitRecovery_101 102: script_error_waitRecovery_102 output: ~ - succeed: f6 + succeed: f4 failed: ~ - f6: + f4: script: install-from-recovery parameters: device_id: ${DEVICE_ID} @@ -97,16 +73,16 @@ flash: 101: script_error_installFromRecovery_101 102: script_error_installFromRecovery_102 output: ~ - succeed: f7 + succeed: f5 failed: ~ - f7: + f5: script: askAccount parameters: ~ codes: ~ output: ~ - succeed: f8 + succeed: f6 failed: ~ - f8: + f6: script: wait-reboot parameters: device_id: ${DEVICE_ID} diff --git a/src/main/resources/yaml/zeroflte_fs.yml b/src/main/resources/yaml/zeroflte_fs.yml index 377c7a55b7f29cf30417702e5cd75243be3cda7d..7cb1a9e205d171c9a78812d98443d3e9b3b563b0 100644 --- a/src/main/resources/yaml/zeroflte_fs.yml +++ b/src/main/resources/yaml/zeroflte_fs.yml @@ -30,35 +30,17 @@ flash: - install_instr_turnOff - install_instr_startDownload - install_instr_acceptWarning - stepNumber: 1/7 + stepNumber: 1/5 titleIcon: icon-download.png f2: - ui: - type: load - title: stepTitle2On7 - instruction: - - install_instr_verifyHeimdall - stepNumber: 2/7 - averageTime: 10 - f3: - ui: - type: action - title: stepTitle3On7 - instruction: - - install_instr_turnOffAgain - - install_instr_startDownload - - install_instr_acceptWarning - stepNumber: 3/7 - titleIcon: icon-download.png - f4: ui: type: load title: stepTitle4On7 instruction: - install_instr_recoveryInstall - stepNumber: 4/7 + stepNumber: 2/5 averageTime: 20 - f5: + f3: ui: type: action title: stepTitle5On7 @@ -66,20 +48,20 @@ flash: - install_instr_leaveDownload - install_instr_startRecovery - install_instr_swipeTwrp - stepNumber: 5/7 + stepNumber: 3/5 titleIcon: icon-download.png - f6: + f4: ui: type: load title: stepTitle6On7 instruction: - install_instr_eosInstall - stepNumber: 6/7 + stepNumber: 4/5 averageTime: 475 - f7: + f5: ui: type: askAccount - f8: + f6: ui: type: action title: stepTitle7On7 @@ -96,5 +78,5 @@ flash: - install_instr_swipeForOk - install_instr_tapRebootSystem - install_instr_doNotInstall - stepNumber: 7/7 + stepNumber: 5/5 titleIcon: icon-search.png \ No newline at end of file diff --git a/windows-installer-mui.nsi b/windows-installer-mui.nsi new file mode 100644 index 0000000000000000000000000000000000000000..8411436621c0989a31e8fc8b8b4cd11dd8698fbd --- /dev/null +++ b/windows-installer-mui.nsi @@ -0,0 +1,112 @@ +#Include Modern UI and others +#-------------------------------- +!include LogicLib.nsh +!include "WordFunc.nsh" + !insertmacro VersionCompare +!include "MUI2.nsh" + +# General settings +#-------------------------------- +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" +Name "Easy-installer ${appVersion}" +# define installation directory +InstallDir "$PROGRAMFILES64\easy-installer" +InstallDirRegKey HKCU "Software\ecorp\easy-installer" "installDir" +# name the installer +OutFile "Easy-installer-setup.exe" + +Icon "buildSrc/windows/easy-installer.ico" +# Pages +#-------------------------------- +!define MUI_WELCOMEFINISHPAGE_BITMAP "buildSrc/windows/welcomePage.bmp" +!define MUI_WELCOMEPAGE_TITLE "Welcome to the easy-installer setup wizard" +!define MUI_WELCOMEPAGE_TEXT "The easy-installer will allow to flash /e/ OS on compatible device" +!insertmacro MUI_PAGE_WELCOME + +!define MUI_PAGE_HEADER_TEXT "Licence agreement" +!define MUI_PAGE_HEADER_SUBTEXT "Please review the licence terms before installing easy-installer" +!define MUI_LICENSEPAGE_TEXT_TOP "Scroll down to read the rest of the agreement" +!define MUI_LICENSEPAGE_TEXT_BOTTOM "If you accept the terms of the agreement, click 'I agree' to continue. You must accept the agreement to setup easy-installer" +!insertmacro MUI_PAGE_LICENSE "LICENSE" + +!define MUI_PAGE_HEADER_TEXT "Choose easy-installer location" +!insertmacro MUI_PAGE_DIRECTORY +#!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder +!insertmacro MUI_PAGE_INSTFILES +!define MUI_FINISHPAGE_TITLE "Set up completed" +!define MUI_FINISHPAGE_TEXT "You can click on the 'close' button to exit" +!define MUI_FINISHPAGE_BITMAP "buildSrc/windows/welcomePage.bmp" +!insertmacro MUI_PAGE_FINISH + +!insertmacro MUI_UNPAGE_WELCOME +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES +!insertmacro MUI_UNPAGE_FINISH + +!insertmacro MUI_LANGUAGE "English" + +# Behaviour +#-------------------------------- +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 + + +# Section +#-------------------------------- + +# 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' + # Add uninstaller in "add/remove" control panel + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\easy-installer" "DisplayName" "Easy-installer" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\easy-installer" "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\easy-installer" "DisplayIcon" "$\"$INSTDIR\easy-installer.ico$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\easy-installer" "InstallLocation" "$\"$INSTDIR$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\easy-installer" "Publisher" "ECORP SAS" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\easy-installer" "DisplayVersion" "${appVersion}" +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 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\easy-installer" + DeleteRegKey HKCU "Software\ecorp\easy-installer" +SectionEnd \ No newline at end of file diff --git a/windows-installer.nsi b/windows-installer.nsi new file mode 100644 index 0000000000000000000000000000000000000000..410eb8bf83c7c23d74bc41be1b6045190cdf59b4 --- /dev/null +++ b/windows-installer.nsi @@ -0,0 +1,68 @@ +!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