This commit is contained in:
LukeeGD 2020-04-01 11:17:19 +08:00
parent d558eb1997
commit 3536ae9478

View File

@ -34,8 +34,7 @@ function Log {
function Error { function Error {
echo "[Error] $1" | tee -a restore_log.txt echo "[Error] $1" | tee -a restore_log.txt
if [[ ! -z $2 ]]; then [[ ! -z $2 ]] && echo $2 | tee -a restore_log.txt
echo $2 | tee -a restore_log.txt
exit exit
} }
@ -141,10 +140,11 @@ function Action {
if [[ $Mode == 'Downgrade' ]]; then if [[ $Mode == 'Downgrade' ]]; then
Downgrade Downgrade
elif [[ $Mode == 'SaveOTABlobs' ]]; then elif [[ $Mode == 'SaveOTABlobs' ]]; then
SaveOTABlobs; exit SaveOTABlobs
elif [[ $Mode == 'kDFU' ]]; then elif [[ $Mode == 'kDFU' ]]; then
kDFU; exit kDFU
fi fi
exit
} }
function SaveOTABlobs { function SaveOTABlobs {
@ -154,7 +154,6 @@ function SaveOTABlobs {
SHSH=$(ls ${UniqueChipID}_${ProductType}_${DowngradeVer}-*.shsh2) SHSH=$(ls ${UniqueChipID}_${ProductType}_${DowngradeVer}-*.shsh2)
if [ ! -e "$SHSH" ]; then if [ ! -e "$SHSH" ]; then
Error "Saving $DowngradeVer blobs failed. Please run the script again" "It is also possible that $DowngradeVer for $ProductType is no longer signed" Error "Saving $DowngradeVer blobs failed. Please run the script again" "It is also possible that $DowngradeVer for $ProductType is no longer signed"
exit
fi fi
mkdir -p saved/shsh 2>/dev/null mkdir -p saved/shsh 2>/dev/null
cp "$SHSH" saved/shsh cp "$SHSH" saved/shsh
@ -309,7 +308,6 @@ function Downgrade {
Log "Stopping local server..." Log "Stopping local server..."
ps aux | awk '/python3/ {print "sudo kill -9 "$2" 2>/dev/null"}' | bash ps aux | awk '/python3/ {print "sudo kill -9 "$2" 2>/dev/null"}' | bash
Log "Downgrade script done!" Log "Downgrade script done!"
exit
} }
function InstallDependencies { function InstallDependencies {