Browse Source

added build archive exists check

pull/1/head
Ivo Oliveira Capanema 2 years ago
parent
commit
3d156e3161
  1. 13
      reinstall-magisk-on-lineageos

13
reinstall-magisk-on-lineageos

@ -42,6 +42,15 @@ get_build_url() {
head -1
}
check_exists_latest_lineageos_build() {
# The --location lets curl follow the redirection.
curl --location "$(get_build_url)?sha256" --output /tmp/lineageos.sha256
hash1=$( awk '{print $1}' lineageos.sha256 )
hash2=$( sha256sum lineageos.zip | awk '{print $1}' )
[[ "$hash1" =~ "$hash2" ]]
return
}
download_latest_lineageos_build() {
# The --location lets curl follow the redirection.
curl --location "$(get_build_url)" --output /tmp/lineageos.zip
@ -163,8 +172,12 @@ main() {
is_rooted_debugging_enabled
print_message "Checking on phone if Magisk is installed"
check_magisk_app
if check_exists_latest_lineageos_build; then
print_message "Build archive already exists, skipping download"
else
print_message "Downloading build archive from $(get_build_url)"
download_latest_lineageos_build
fi
print_message "Extracting 'boot.img' from build archive in /tmp/boot.img"
extract_boot_image
print_message "Copying from PC to phone the boot image in /sdcard/Download/boot.img"

Loading…
Cancel
Save