Skip to content

Commit

Permalink
[WIP]pb: update installer
Browse files Browse the repository at this point in the history
 * inline with osmOsis installer

Signed-off-by: Mohd Faraz <[email protected]>
  • Loading branch information
AndroiableDroid authored and hraj9258 committed Jan 13, 2024
1 parent 79429b1 commit c52db0d
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 359 deletions.
32 changes: 16 additions & 16 deletions build/tasks/pbrp.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
WORK_PATH := $(OUT_DIR)/target/product/$(TARGET_DEVICE)/zip
TARGET_DIR := $(WORK_PATH)/../
BUILD_TOP := $(OUT_DIR)/../
VERSION := $(shell cat $(BUILD_TOP)/bootable/recovery/variables.h | egrep "define\s+PB_MAIN_VERSION" | tr -d '"' | tr -s ' ' | awk '{ print $$3 }')
PB_VENDOR := vendor/utils
Expand All @@ -17,36 +18,35 @@ else
endif

ZIP_NAME := PBRP-$(TARGET_DEVICE)-$(VERSION)-$(shell date +%Y%m%d-%H%M)-$(PB_BUILD_TYPE).zip
RECOVERYPATH := $(OUT_DIR)/target/product/$(TARGET_DEVICE)/recovery.img
KEYCHECK := $(OUT_DIR)/recovery/root/sbin/keycheck
KEYCHECK := $(TARGET_DIR)/recovery/root/sbin/keycheck
AB := false
ifeq ($(AB_OTA_UPDATER), true)
AB := true
endif
ifeq ($(BOARD_USES_RECOVERY_AS_BOOT), true)
RECOVERY_AS_BOOT := true
RECOVERYPATH := $(OUT_DIR)/target/product/$(TARGET_DEVICE)/ramdisk-recovery.cpio
pbrpimage=$(INSTALLED_BOOTIMAGE_TARGET) $(RECOVERY_RESOURCE_ZIP)
else
RECOVERYPATH := $(OUT_DIR)/target/product/$(TARGET_DEVICE)/recovery.img
RECOVERY_AS_BOOT := false
pbrpimage=$(INSTALLED_RECOVERYIMAGE_TARGET) $(RECOVERY_RESOURCE_ZIP)
endif

.PHONY: pbrp
pbrp: $(pbrpimage)
$(hide) rm -f $(WORK_PATH)/../*.zip
$(hide) if [ -d $(WORK_PATH) ]; then rm -rf $(WORK_PATH); fi
$(hide) mkdir $(WORK_PATH)
$(hide) rsync -avp $(PB_VENDOR)/PBRP $(WORK_PATH)/
$(hide) rm -f $(TARGET_DIR)/*.zip
$(hide) rm -rf $(WORK_PATH) && mkdir $(WORK_PATH);
$(hide) rsync -avp $(PB_VENDOR)/PBRP $(WORK_PATH)/;
$(hide) mkdir -p $(WORK_PATH)/META-INF/com/google/android
$(hide) rsync -avp $(PB_VENDOR)/updater/update-* $(WORK_PATH)/META-INF/com/google/android/
$(hide) sed -i "s:{version}:v$(VERSION):g" $(WORK_PATH)/META-INF/com/google/android/update-binary
echo "dsfsdfsdf"
$(hide) if [ "$(RECOVERY_AS_BOOT)" == "true" ]; then sed -i "s:IS_AB=false:IS_AB=true:" $(WORK_PATH)/META-INF/com/google/android/update-binary; fi
echo "dsfsdfsdf2255"
$(hide) rsync -avp $(PB_VENDOR)/updater/awk $(WORK_PATH)/META-INF/
$(hide) rsync -avp $(PB_VENDOR)/updater/magiskboot $(WORK_PATH)/
$(hide) rsync -avp $(BUILD_TOP)/external/magisk-prebuilt/prebuilt/magiskboot_arm $(WORK_PATH)/magiskboot;
$(hide) chmod +x $(WORK_PATH)/magiskboot;
$(hide) if [ -f $(KEYCHECK) ]; then cp $(KEYCHECK) $(WORK_PATH)/META-INF/; fi
$(hide) if [ "$(AB)" == "true" ]; then sed -i "s|AB_DEVICE=false|AB_DEVICE=true|g" $(WORK_PATH)/META-INF/com/google/android/update-binary; fi
$(hide) if [ "$(RECOVERY_AS_BOOT)" == "true" ]; then sed -i "s|USES_RECOVERY_AS_BOOT=false|USES_RECOVERY_AS_BOOT=true|g" $(WORK_PATH)/META-INF/com/google/android/update-binary; fi
$(hide) mkdir $(WORK_PATH)/TWRP
$(hide) if [ -e $(WORK_PATH)/../boot.img ]; then cp $(WORK_PATH)/../boot.img $(WORK_PATH)/../recovery.img; fi
$(hide) cp $(WORK_PATH)/../recovery.img $(WORK_PATH)/TWRP/
$(hide) cd $(WORK_PATH) && zip -r $(ZIP_NAME) *
$(hide) cp $(RECOVERYPATH) $(WORK_PATH)/;
$(hide) cd $(WORK_PATH) && zip -r $(ZIP_NAME) *;
$(hide) cd $(BUILD_TOP) && mv $(WORK_PATH)/$(ZIP_NAME) $(WORK_PATH)/../
$(hide) cat $(BUILD_TOP)/vendor/utils/.pb.1
printf "Recovery Image: %s\n" "$(RECOVERYPATH)"
Expand Down
142 changes: 0 additions & 142 deletions pb_build.sh

This file was deleted.

Binary file removed updater/magiskboot
Binary file not shown.
Loading

0 comments on commit c52db0d

Please sign in to comment.