A127f U7 Auto Patch Instant
# 10. Record success (this line runs only for the TWRP‑case *after* the device # comes back online; for fastboot it runs immediately after flashing) log "Patch $REMOTE_PATCH_VERSION applied successfully – persisting state." cat > "$STATE_FILE" <<EOF
"patch_version": $REMOTE_PATCH_VERSION, "applied_at": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
# 3. Pull the manifest log "Downloading manifest from $MANIFEST_URL ..." if command -v curl >/dev/null 2>&1; then MANIFEST_JSON=$(curl -fsSL "$MANIFEST_URL") elif command -v wget >/dev/null 2>&1; then MANIFEST_JSON=$(wget -qO- "$MANIFEST_URL") else log "Neither curl nor wget is present – cannot continue." exit 1 fi a127f u7 auto patch
# Cleanup rm -rf "$TMP_DIR"
# 4. Parse manifest (requires jq) REMOTE_PATCH_VERSION=$(echo "$MANIFEST_JSON" | jq -r .patch_version) PATCH_URL=$(echo "$MANIFEST_JSON" | jq -r .patch_url) PATCH_SHA256=$(echo "$MANIFEST_JSON" | jq -r .patch_sha256) PATCH_TYPE=$(echo "$MANIFEST_JSON" | jq -r .patch_type) # "twrp_zip" or "fastboot" Apply the patch if [ "$PATCH_TYPE" = "twrp_zip"
# 5. Compare versions if [ "$REMOTE_PATCH_VERSION" -le "$SAVED_PATCH_VERSION" ]; then log "Device already at latest patch level – nothing to do." exit 0 fi
# 6. Create temp folder mkdir -p "$TMP_DIR" PATCH_FILE="$TMP_DIR/patch_$REMOTE_PATCH_VERSION.zip" EOF "patch_version": $REMOTE_PATCH_VERSION
# 9. Apply the patch if [ "$PATCH_TYPE" = "twrp_zip" ]; then # -------------------------------------------------------------- # TWRP approach – we reboot into recovery and let TWRP flash it. # -------------------------------------------------------------- log "Rebooting into TWRP to install ZIP …" # Store path in a known location that TWRP can read after reboot. cp "$PATCH_FILE" /cache/recovery/auto_patch.zip