Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5893bb9e authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

update linux scripts to allow to specify a custom adb & heimdall path

parent 23b7bf4b
Loading
Loading
Loading
Loading
+19 −6
Original line number Diff line number Diff line
#!/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
@@ -18,6 +19,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
@@ -30,6 +32,17 @@
DEVICE_ID=$1
ARCHIVE_PATH=$2
ARCHIVE_NAME=$(basename $2)
ADB_FOLDER_PATH=$3
ADB_PATH=""


if [ ! -z $ADB_FOLDER_PATH ]
then
  ADB_PATH=${ADB_FOLDER_PATH}"adb"
else
  ADB_PATH=adb
fi


if [ -z $DEVICE_ID ]
then
@@ -41,19 +54,19 @@ then
  exit 102
fi

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 [ $? != 0 ] ; then exit 2 ; fi

adb -s ${DEVICE_ID} shell twrp install /sdcard/${ARCHIVE_NAME}
$ADB_PATH -s ${DEVICE_ID} shell twrp install /sdcard/${ARCHIVE_NAME}

if [ $? != 0 ] ; then exit 3 ; fi

sleep 1

adb -s ${DEVICE_ID} shell rm /sdcard/${ARCHIVE_NAME}
$ADB_PATH -s ${DEVICE_ID} shell rm /sdcard/${ARCHIVE_NAME}

sleep 1
+14 −1
Original line number Diff line number Diff line
#!/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
@@ -17,6 +18,7 @@

# Parameter
# $1: TWRP_IMAGE_PATH need twrp path (${TWRP_FOLDER}/${TWRP})
# $2: The folder where heimdall runnable is stored

# Exit status
# - 0 : Recovery installed
@@ -24,10 +26,21 @@
# - 101 : TWRP_IMAGE_PATH missing

TWRP_IMAGE_PATH=$1
HEIMDALL_FOLDER_PATH=$2
HEIMDALL_PATH=""


if [ ! -z $HEIMDALL_FOLDER_PATH ]
then
  HEIMDALL_PATH=${HEIMDALL_FOLDER_PATH}"heimdall"
else
  HEIMDALL_PATH=heimdall
fi


if [ -z $TWRP_IMAGE_PATH ]
then
  exit 101
fi

heimdall flash --RECOVERY ${TWRP_IMAGE_PATH} --no-reboot
$HEIMDALL_PATH flash --RECOVERY ${TWRP_IMAGE_PATH} --no-reboot
+16 −1
Original line number Diff line number Diff line
#!/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
@@ -15,11 +16,25 @@
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

# Parameter
# $1: The folder where heimdall runnable is stored

# Exit status
# - 0 : OEM unlocked on device
# - 10 : heimdall error

heimdall print-pit
HEIMDALL_FOLDER_PATH=$1
HEIMDALL_PATH=""


if [ ! -z $HEIMDALL_FOLDER_PATH ]
then
  HEIMDALL_PATH=${HEIMDALL_FOLDER_PATH}"heimdall"
else
  HEIMDALL_PATH=heimdall
fi

$HEIMDALL_PATH print-pit

if [ $? = 1 ]
then
+15 −1
Original line number Diff line number Diff line
#!/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
@@ -16,12 +17,25 @@
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

# TODO: What if 2 devices detected?
# Parameter
# $1: The folder where heimdall runnable is stored

# Exit status
# - 0 : Device in download mode detected
# - 1 : Error

while [ "`heimdall detect > /dev/null 2>&1; echo $?`" = 1 ]
HEIMDALL_FOLDER_PATH=$1
HEIMDALL_PATH=""


if [ ! -z $HEIMDALL_FOLDER_PATH ]
then
  HEIMDALL_PATH=${HEIMDALL_FOLDER_PATH}"heimdall"
else
  HEIMDALL_PATH=heimdall
fi

while [ "`$HEIMDALL_PATH detect > /dev/null 2>&1; echo $?`" = 1 ]
do
  sleep 1s
done
+15 −2
Original line number Diff line number Diff line
#!/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
@@ -17,6 +18,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
@@ -25,6 +27,17 @@
# - 101 : DEVICE_ID is not detected

DEVICE_ID=$1
ADB_FOLDER_PATH=$2
ADB_PATH=""


if [ ! -z $ADB_FOLDER_PATH ]
then
  ADB_PATH=${ADB_FOLDER_PATH}"adb"
else
  ADB_PATH=adb
fi


if [ -z $DEVICE_ID ]
then
@@ -33,14 +46,14 @@ fi


#1 On check that device is in recovery mode
adb -s ${DEVICE_ID} get-state 2>&1 | grep "recovery"
$ADB_PATH -s ${DEVICE_ID} get-state 2>&1 | grep "recovery"
if [ $? != 0 ]
then
	exit 101
fi

#Then we wait that it left this state
while adb -s ${DEVICE_ID} get-state 2> /dev/null
while $ADB_PATH -s ${DEVICE_ID} get-state 2> /dev/null
do
	sleep 1
done
 No newline at end of file
Loading