added: create work folder; remove every file/folder (computer & phone)
This commit is contained in:
parent
a5f44354f4
commit
186279bc6f
1 changed files with 32 additions and 19 deletions
|
@ -1,28 +1,31 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
HOST_DIR="$HOME/magisk"
|
HOST_DIR="$HOME/magisk"
|
||||||
DEVICE_DIR="/sdcard/Android/data/org.lineageos.updater/files/LineageOS\ updates/"
|
#DEVICE_DIR="/sdcard/Android/data/org.lineageos.updater/files/LineageOS\ updates/"
|
||||||
DEVICE_DIR_noescape=/sdcard/Android/data/org.lineageos.updater/files/LineageOS\ updates/
|
DEVICE_DIR="/sdcard/Download"
|
||||||
|
LINEAGE="lineage-*-signed.zip"
|
||||||
|
|
||||||
# Check for lineage update/zip file
|
if [ ! -d $HOST_DIR ]; then
|
||||||
for file in $(adb shell ls $DEVICE_DIR)
|
mkdir -p $HOST_DIR;
|
||||||
|
fi
|
||||||
|
|
||||||
|
for file in $(adb shell ls $DEVICE_DIR/$LINEAGE)
|
||||||
do
|
do
|
||||||
file=$(echo -e $file | tr -d "\r\n"); # EOL fix
|
file=$(echo -e $file | xargs -n 1 basename);
|
||||||
echo $file
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Get latest lineageos zip file and extract boot.img
|
# Get latest lineageos zip file
|
||||||
if [[ `adb shell ls $DEVICE_DIR$file 2> /dev/null` ]]; then
|
if adb shell ls $DEVICE_DIR/$LINEAGE ; then
|
||||||
adb pull "$DEVICE_DIR_noescape/$file" $HOST_DIR/;
|
adb pull $DEVICE_DIR/$file $HOST_DIR/;
|
||||||
else
|
else
|
||||||
echo "Zip file does not exist."
|
echo "Zip file does not exist.
|
||||||
read -p "Did you export the rom/zip file? If not got to Settings-System-Updater and run the script again."
|
Did you export the rom/zip file? If not got to Settings-System-Updater and run the script again."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get and push boot.img
|
# Get and push boot.img
|
||||||
cd $HOST_DIR
|
cd $HOST_DIR
|
||||||
unzip lineage-18.1-*-nightly-*-signed.zip boot.img
|
unzip $file boot.img
|
||||||
adb push boot.img /sdcard/Download/
|
adb push boot.img /sdcard/Download/
|
||||||
|
|
||||||
# Magisk boot.img patch and flash
|
# Magisk boot.img patch and flash
|
||||||
|
@ -33,24 +36,34 @@ fastboot flash boot magisk_patched-*.img
|
||||||
fastboot reboot
|
fastboot reboot
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
echo -n "Do you want to delete lineage-18.1-*-nightly-*-signed.zip, boot.img and magisk_patched file on your computer? (y/n)?"
|
echo -n "Do you want to delete $file, boot.img and magisk_patched file on your computer? (y/n)"
|
||||||
read answer
|
read answer
|
||||||
if [ "$answer" != "${answer#[Yy]}" ] ;then
|
if [ "$answer" != "${answer#[Yy]}" ] ;then
|
||||||
rm lineage-18.1-*-nightly-*-signed.zip
|
rm $file
|
||||||
rm boot.img
|
rm boot.img
|
||||||
rm magisk_patched-*.img
|
rm magisk_patched-*.img
|
||||||
else
|
else
|
||||||
echo "Ok. Keep it."
|
echo "Ok, keep it. But remember to delete it before you run the script again. It may cause problems if the wrong patch is being flashed. E.g. bootloop. Just moved in a backup folder."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "Do you want to delete LineageOS zip file on your phone. (y/n)? Check your device is fully loaded."
|
echo -n "Do you want to delete $file, boot.img and magisk_patched file on your phone? (y/n) - Check your device is fully loaded."
|
||||||
read answer
|
read answer
|
||||||
|
|
||||||
if [ "$answer" != "${answer#[Yy]}" ] ;then
|
if [ "$answer" != "${answer#[Yy]}" ] ;then
|
||||||
adb shell rm "/sdcard/Android/data/org.lineageos.updater/files/LineageOS\ updates/$file"
|
adb shell rm $DEVICE_DIR/$file
|
||||||
echo "Delete magisk patched file manually in download folder."
|
adb shell rm $DEVICE_DIR/boot.img
|
||||||
|
adb shell rm $DEVICE_DIR/magisk_patched-*.img
|
||||||
else
|
else
|
||||||
echo "Ok. Keep it."
|
echo "Ok, keep it. But remember to delete it before you run the script again. It may cause problems if the wrong patch is being flashed. E.g. bootloop. Just moved in a backup folder."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n "Do you want to delete $HOST_DIR? (y/n)?"
|
||||||
|
read answer
|
||||||
|
|
||||||
|
if [ "$answer" != "${answer#[Yy]}" ] ;then
|
||||||
|
rm -r $HOST_DIR
|
||||||
|
else
|
||||||
|
echo "Kept $HOST_DIR."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "That's it"
|
echo "That's it"
|
||||||
|
|
Loading…
Reference in a new issue