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

Commit c331fcd4 authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

update install-from-recovery.sh

parent bc78a5e8
Loading
Loading
Loading
Loading
+20 −20
Original line number Diff line number Diff line
@@ -31,42 +31,42 @@

DEVICE_ID=$1
ARCHIVE_PATH=$2
ARCHIVE_NAME=$(basename $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 ]
echo "adb path : $ADB_PATH"
if [ -z "$DEVICE_ID" ]
then
  exit 101
fi

if [ -z $ARCHIVE_PATH ]
if [ -z "$ARCHIVE_PATH" ]
then
  exit 102
fi
# "$ADB_PATH" kill-server
# "$ADB_PATH" devices


"$ADB_PATH" -s "$DEVICE_ID" shell "twrp wipe system"
echo "system wiped"
"$ADB_PATH" -s "$DEVICE_ID" shell "twrp wipe cache"
echo "cache wiped"
"$ADB_PATH" -s "$DEVICE_ID" shell "twrp wipe data"
echo "data wiped"

$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_PATH -s ${DEVICE_ID} shell twrp install /sdcard/${ARCHIVE_NAME}
if ! "$ADB_PATH" -s "$DEVICE_ID" push "$ARCHIVE_PATH" /sdcard ; 
then exit 2 ; fi

if [ $? != 0 ] ; then exit 3 ; fi
if ! "$ADB_PATH" -s "$DEVICE_ID" shell twrp install /sdcard/"$ARCHIVE_NAME" ; 
then exit 3 ; fi

sleep 1

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

sleep 1