diff options
Diffstat (limited to 'prebuilt')
-rw-r--r-- | prebuilt/99SuperSUDaemon | 2 | ||||
-rw-r--r-- | prebuilt/Android.mk | 564 | ||||
-rw-r--r-- | prebuilt/HTCDumlock.apk | bin | 0 -> 13210 bytes | |||
-rw-r--r-- | prebuilt/Superuser.apk | bin | 0 -> 28674 bytes | |||
-rwxr-xr-x | prebuilt/chattr | bin | 0 -> 9956 bytes | |||
-rw-r--r-- | prebuilt/chattr.pie | bin | 0 -> 9756 bytes | |||
-rw-r--r-- | prebuilt/dump_imagesys | bin | 0 -> 5504 bytes | |||
-rwxr-xr-x | prebuilt/fix_permissions.sh | 484 | ||||
-rw-r--r-- | prebuilt/flash_imagesys | bin | 0 -> 5504 bytes | |||
-rw-r--r-- | prebuilt/htcdumlock | bin | 0 -> 9668 bytes | |||
-rw-r--r-- | prebuilt/htcdumlocksys | bin | 0 -> 9716 bytes | |||
-rw-r--r-- | prebuilt/install-recovery.sh | 17 | ||||
-rwxr-xr-x | prebuilt/install-supersu.sh | 405 | ||||
-rw-r--r-- | prebuilt/libbmlutils.so | bin | 0 -> 5428 bytes | |||
-rw-r--r-- | prebuilt/libflashutils.so | bin | 0 -> 5360 bytes | |||
-rw-r--r-- | prebuilt/libmmcutils.so | bin | 0 -> 9616 bytes | |||
-rw-r--r-- | prebuilt/libmtdutils.so | bin | 0 -> 13716 bytes | |||
-rw-r--r-- | prebuilt/libsupol.so | bin | 0 -> 170232 bytes | |||
-rw-r--r-- | prebuilt/libsupol.soarm64 | bin | 0 -> 276888 bytes | |||
-rw-r--r-- | prebuilt/me.twrp.twrpapp.apk | bin | 0 -> 12382 bytes | |||
-rw-r--r-- | prebuilt/mke2fs.conf | 17 | ||||
-rwxr-xr-x | prebuilt/parted | bin | 0 -> 346680 bytes | |||
-rwxr-xr-x | prebuilt/permissive.sh | 8 | ||||
-rwxr-xr-x | prebuilt/relink.sh | 27 | ||||
-rwxr-xr-x | prebuilt/sgdisk_static | bin | 0 -> 489732 bytes | |||
-rw-r--r-- | prebuilt/suarm | bin | 0 -> 75364 bytes | |||
-rw-r--r-- | prebuilt/suarm64 | bin | 0 -> 100272 bytes | |||
-rw-r--r-- | prebuilt/supolicy | bin | 0 -> 29972 bytes | |||
-rw-r--r-- | prebuilt/supolicyarm64 | bin | 0 -> 30168 bytes | |||
-rw-r--r-- | prebuilt/teamwin | 1 | ||||
-rwxr-xr-x | prebuilt/twrp_fonts.py | 198 |
31 files changed, 1723 insertions, 0 deletions
diff --git a/prebuilt/99SuperSUDaemon b/prebuilt/99SuperSUDaemon new file mode 100644 index 000000000..de738c17b --- /dev/null +++ b/prebuilt/99SuperSUDaemon @@ -0,0 +1,2 @@ +#!/system/bin/sh +/system/xbin/daemonsu --auto-daemon & diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk new file mode 100644 index 000000000..7b950fcef --- /dev/null +++ b/prebuilt/Android.mk @@ -0,0 +1,564 @@ +LOCAL_PATH := $(call my-dir) + +RELINK := $(LOCAL_PATH)/relink.sh + +#dummy file to trigger required modules +include $(CLEAR_VARS) + +LOCAL_MODULE := teamwin +LOCAL_MODULE_TAGS := eng +LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES +LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin + +# Manage list +RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/dump_image +RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/flash_image +RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/erase_image +RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/bu +ifneq ($(TW_USE_TOOLBOX), true) + RELINK_SOURCE_FILES += $(TARGET_OUT_OPTIONAL_EXECUTABLES)/busybox +else + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/sh + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libcrypto.so + ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 23; echo $$?),0) + RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/toybox + ifneq ($(wildcard external/zip/Android.mk),) + RELINK_SOURCE_FILES += $(TARGET_OUT_OPTIONAL_EXECUTABLES)/zip + endif + ifneq ($(wildcard external/unzip/Android.mk),) + RELINK_SOURCE_FILES += $(TARGET_OUT_OPTIONAL_EXECUTABLES)/unzip + endif + endif +endif +RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/pigz +RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/fsck.fat +RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/fatlabel +RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/mkfs.fat +RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/e2fsck +RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/mke2fs +RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/tune2fs +RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/resize2fs +RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/simg2img +ifneq ($(TARGET_ARCH), x86_64) + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/linker +endif +ifeq ($(TARGET_ARCH), x86_64) + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/linker64 +endif +ifeq ($(TARGET_ARCH), arm64) + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/linker64 +endif +#RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/twrpmtp +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libc.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libcutils.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libcrecovery.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libusbhost.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libutils.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libdl.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2_com_err.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2_e2p.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2fs.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2_profile.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2_uuid.so +ifneq ($(wildcard external/e2fsprogs/lib/quota/Android.mk),) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2_quota.so +endif +ifneq ($(wildcard external/e2fsprogs/lib/ext2fs/Android.*),) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2fs.so +endif +ifneq ($(wildcard external/e2fsprogs/lib/blkid/Android.*),) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2_blkid.so +endif +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libpng.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/liblog.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libm.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libstdc++.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libz.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libminuitwrp.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libminadbd.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libminzip.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libmtdutils.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libtar.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libtwadbbu.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libtwrpdigest.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libutil-linux.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libblkid.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libmmcutils.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libbmlutils.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libflashutils.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libfusesideload.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libbootloader_message_twrp.so +ifeq ($(PLATFORM_SDK_VERSION), 22) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libc++.so +endif +ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0) + # These libraries are no longer present in M + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libstlport.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libgccdemangle.so +endif +ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 23; echo $$?),0) + + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libcrypto.so \ + $(if $(WITH_CRYPTO_UTILS),$(TARGET_OUT_SHARED_LIBRARIES)/libcrypto_utils.so) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libpackagelistparser.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/liblzma.so +endif +ifneq (,$(filter $(PLATFORM_SDK_VERSION), 21 22)) + # libraries from lollipop + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libbacktrace.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libunwind.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libunwind-ptrace.so + # Dynamically loaded by lollipop libc and may prevent unmounting system if it is not present in sbin + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libnetd_client.so +else + ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 23; echo $$?),0) + # Android M libraries + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libbacktrace.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libunwind.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libbase.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libc++.so + # Dynamically loaded by libc and may prevent unmounting system if it is not present in sbin + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libnetd_client.so + else + # Not available in lollipop + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libcorkscrew.so + endif +endif +ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 24; echo $$?),0) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libmincrypttwrp.so +endif +RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/toolbox +ifneq ($(TW_OEM_BUILD),true) + RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/twrp +else + TW_EXCLUDE_MTP := true +endif +ifneq ($(TW_EXCLUDE_MTP), true) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libtwrpmtp.so +endif +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext4_utils.so +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libaosprecovery.so +ifneq ($(TW_INCLUDE_JPEG),) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libjpeg.so +endif +RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libselinux.so +ifeq ($(BUILD_ID), GINGERBREAD) + TW_NO_EXFAT := true +endif +ifneq ($(TW_NO_EXFAT), true) + RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/mkexfatfs + RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/fsck.exfat + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libexfat_twrp.so +else + TW_NO_EXFAT_FUSE := true +endif +ifneq ($(TW_NO_EXFAT_FUSE), true) + RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/exfat-fuse +endif +ifeq ($(TW_INCLUDE_BLOBPACK), true) + RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/blobpack +endif +ifeq ($(TW_INCLUDE_INJECTTWRP), true) + RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/injecttwrp +endif +ifeq ($(TW_INCLUDE_DUMLOCK), true) + RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/htcdumlock +endif +ifeq ($(TW_INCLUDE_CRYPTO), true) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libcryptfslollipop.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libcrypto.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libhardware.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libgpt_twrp.so + ifeq ($(TARGET_HW_DISK_ENCRYPTION),true) + ifeq ($(TARGET_CRYPTFS_HW_PATH),) + RELINK_SOURCE_FILES += $(TARGET_OUT_VENDOR_SHARED_LIBRARIES)/libcryptfs_hw.so + else + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libcryptfs_hw.so + endif + endif + # FBE files + ifeq ($(TW_INCLUDE_CRYPTO_FBE), true) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libe4crypt.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libgatekeeper.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libsoftkeymaster.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libkeymaster_messages.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libkeystore_binder.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libbinder.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libprotobuf-cpp-lite.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libsoftkeymasterdevice.so + ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 25; echo $$?),0) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.hardware.gatekeeper@1.0.so + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/hwservicemanager + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/avbctl + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/hwservicemanager + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/keystore + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/keystore_cli + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/servicemanager + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.system.wifi.keystore@1.0.so + ifneq ($(wildcard system/keymaster/keymaster_stl.cpp),) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libkeymaster_portable.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libkeymaster_staging.so + endif + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libwifikeystorehal.so + ifneq ($(wildcard hardware/interfaces/weaver/Android.bp),) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.hardware.weaver@1.0.so + endif + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libhardware_legacy.so + else + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libkeymaster1.so + endif + endif +endif +ifeq ($(AB_OTA_UPDATER), true) + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/bootctl + ifneq ($(TW_INCLUDE_CRYPTO), true) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libhardware.so + endif +endif +ifeq ($(TARGET_USERIMAGES_USE_EXT4), true) + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/make_ext4fs +endif +ifneq ($(wildcard system/core/libsparse/Android.*),) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libsparse.so +endif +ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS), true) + RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/openaes + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libopenaes.so +endif +ifeq ($(TARGET_USERIMAGES_USE_F2FS), true) + ifeq ($(shell test $(CM_PLATFORM_SDK_VERSION) -ge 4; echo $$?),0) + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/mkfs.f2fs + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libf2fs.so + else ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0) + RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/mkfs.f2fs + else ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 24; echo $$?),0) + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/mkfs.f2fs + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libf2fs.so + else ifeq ($(shell test $(PLATFORM_SDK_VERSION) -eq 23; echo $$?),0) + RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/mkfs.f2fs + else ifneq (,$(filter $(PLATFORM_SDK_VERSION), 21 22)) + RELINK_SOURCE_FILES += $(TARGET_ROOT_OUT_SBIN)/mkfs.f2fs + else + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/mkfs.f2fs + endif + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/fsck.f2fs +endif +ifneq ($(wildcard system/core/reboot/Android.*),) + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/reboot +endif +ifneq ($(TW_DISABLE_TTF), true) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libft2.so +endif +ifneq ($(TW_RECOVERY_ADDITIONAL_RELINK_FILES),) + RELINK_SOURCE_FILES += $(TW_RECOVERY_ADDITIONAL_RELINK_FILES) +endif +ifneq ($(wildcard external/pcre/Android.mk),) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libpcre.so +endif +ifeq ($(TW_INCLUDE_NTFS_3G),true) +ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 22; echo $$?),0) + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/mount.ntfs + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/fsck.ntfs + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/mkfs.ntfs + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libntfs-3g.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libfuse.so +else + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/ntfs-3g + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/ntfsfix + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/mkntfs +endif +endif +ifeq ($(BOARD_HAS_NO_REAL_SDCARD),) + ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 22; echo $$?),0) + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/sgdisk + endif +endif +ifeq ($(TWRP_INCLUDE_LOGCAT), true) + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/logcat + ifeq ($(TARGET_USES_LOGD), true) + RELINK_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/logd + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libsysutils.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libnl.so + endif + ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 24; echo $$?),0) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libpcrecpp.so + endif + ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 26; echo $$?),0) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/liblogcat.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libcap.so + endif +endif +ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 25; echo $$?),0) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libpcre2.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libvndksupport.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libhwbinder.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libhidlbase.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libhidltransport.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.hardware.keymaster@3.0.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libziparchive.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2_blkid.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libext2_quota.so + + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libhidl-gen-utils.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libvintf.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libtinyxml2.so + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.hidl.token@1.0.so + ifneq ($(wildcard system/core/libkeyutils/Android.bp),) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libkeyutils.so + endif + ifeq ($(wildcard system/libhidl/transport/HidlTransportUtils.cpp),) + RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/android.hidl.base@1.0.so + endif +endif + +TWRP_AUTOGEN := $(intermediates)/teamwin +GEN := $(intermediates)/teamwin +$(GEN): $(RELINK) +$(GEN): $(RELINK_SOURCE_FILES) $(call intermediates-dir-for,EXECUTABLES,init)/init + $(RELINK) $(TARGET_RECOVERY_ROOT_OUT)/sbin $(RELINK_SOURCE_FILES) + +LOCAL_GENERATED_SOURCES := $(GEN) +LOCAL_SRC_FILES := teamwin $(GEN) +include $(BUILD_PREBUILT) + +#permissive.sh +include $(CLEAR_VARS) +LOCAL_MODULE := permissive.sh +LOCAL_MODULE_TAGS := eng +LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES +LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin +LOCAL_SRC_FILES := $(LOCAL_MODULE) +include $(BUILD_PREBUILT) + +#mke2fs.conf +include $(CLEAR_VARS) +LOCAL_MODULE := mke2fs.conf +LOCAL_MODULE_TAGS := eng +LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES +LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/etc +LOCAL_SRC_FILES := $(LOCAL_MODULE) +include $(BUILD_PREBUILT) + +ifeq ($(BOARD_HAS_NO_REAL_SDCARD),) + ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23; echo $$?),0) + #prebuilt, static sgdisk + include $(CLEAR_VARS) + LOCAL_MODULE := sgdisk_static + LOCAL_MODULE_STEM := sgdisk + LOCAL_MODULE_TAGS := eng + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin + LOCAL_SRC_FILES := $(LOCAL_MODULE) + include $(BUILD_PREBUILT) + endif + #parted + #include $(CLEAR_VARS) + #LOCAL_MODULE := parted + #LOCAL_MODULE_TAGS := eng + #LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES + #LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin + #LOCAL_SRC_FILES := $(LOCAL_MODULE) + #include $(BUILD_PREBUILT) +endif + +# copy license file for OpenAES +ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS), true) + include $(CLEAR_VARS) + LOCAL_MODULE := openaes_license + LOCAL_MODULE_TAGS := eng + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/license/openaes + LOCAL_SRC_FILES := ../openaes/LICENSE + include $(BUILD_PREBUILT) +endif + +ifeq ($(TW_INCLUDE_DUMLOCK), true) + #htcdumlock for /system for dumlock + include $(CLEAR_VARS) + LOCAL_MODULE := htcdumlocksys + LOCAL_MODULE_TAGS := eng + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWHTCD_PATH) + LOCAL_SRC_FILES := $(LOCAL_MODULE) + include $(BUILD_PREBUILT) + + #flash_image for /system for dumlock + include $(CLEAR_VARS) + LOCAL_MODULE := flash_imagesys + LOCAL_MODULE_TAGS := eng + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWHTCD_PATH) + LOCAL_SRC_FILES := $(LOCAL_MODULE) + include $(BUILD_PREBUILT) + + #dump_image for /system for dumlock + include $(CLEAR_VARS) + LOCAL_MODULE := dump_imagesys + LOCAL_MODULE_TAGS := eng + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWHTCD_PATH) + LOCAL_SRC_FILES := $(LOCAL_MODULE) + include $(BUILD_PREBUILT) + + #libbmlutils for /system for dumlock + include $(CLEAR_VARS) + LOCAL_MODULE := libbmlutils.so + LOCAL_MODULE_TAGS := eng + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWHTCD_PATH) + LOCAL_SRC_FILES := $(LOCAL_MODULE) + include $(BUILD_PREBUILT) + + #libflashutils for /system for dumlock + include $(CLEAR_VARS) + LOCAL_MODULE := libflashutils.so + LOCAL_MODULE_TAGS := eng + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWHTCD_PATH) + LOCAL_SRC_FILES := $(LOCAL_MODULE) + include $(BUILD_PREBUILT) + + #libmmcutils for /system for dumlock + include $(CLEAR_VARS) + LOCAL_MODULE := libmmcutils.so + LOCAL_MODULE_TAGS := eng + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWHTCD_PATH) + LOCAL_SRC_FILES := $(LOCAL_MODULE) + include $(BUILD_PREBUILT) + + #libmtdutils for /system for dumlock + include $(CLEAR_VARS) + LOCAL_MODULE := libmtdutils.so + LOCAL_MODULE_TAGS := eng + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWHTCD_PATH) + LOCAL_SRC_FILES := $(LOCAL_MODULE) + include $(BUILD_PREBUILT) + + #HTCDumlock.apk + include $(CLEAR_VARS) + LOCAL_MODULE := HTCDumlock.apk + LOCAL_MODULE_TAGS := eng + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)$(TWHTCD_PATH) + LOCAL_SRC_FILES := $(LOCAL_MODULE) + include $(BUILD_PREBUILT) +endif + +ifneq ($(TW_EXCLUDE_SUPERSU), true) + ifeq ($(TARGET_ARCH), arm) + #chattr.pie + include $(CLEAR_VARS) + LOCAL_MODULE := chattr.pie + LOCAL_MODULE_TAGS := eng + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/supersu + LOCAL_SRC_FILES := $(LOCAL_MODULE) + include $(BUILD_PREBUILT) + + #libsupol.so + include $(CLEAR_VARS) + LOCAL_MODULE := libsupol.so + LOCAL_MODULE_TAGS := eng + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/supersu + LOCAL_SRC_FILES := $(LOCAL_MODULE) + include $(BUILD_PREBUILT) + + #su binary + include $(CLEAR_VARS) + LOCAL_MODULE := suarm + LOCAL_MODULE_STEM := su + LOCAL_MODULE_TAGS := eng + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/supersu + LOCAL_SRC_FILES := $(LOCAL_MODULE) + include $(BUILD_PREBUILT) + + #supolicy + include $(CLEAR_VARS) + LOCAL_MODULE := supolicy + LOCAL_MODULE_TAGS := eng + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/supersu + LOCAL_SRC_FILES := $(LOCAL_MODULE) + include $(BUILD_PREBUILT) + endif + ifeq ($(TARGET_ARCH), arm64) + #libsupol.so + include $(CLEAR_VARS) + LOCAL_MODULE := libsupol.soarm64 + LOCAL_MODULE_STEM := libsupol.so + LOCAL_MODULE_TAGS := eng + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/supersu + LOCAL_SRC_FILES := $(LOCAL_MODULE) + include $(BUILD_PREBUILT) + + #su binary + include $(CLEAR_VARS) + LOCAL_MODULE := suarm64 + LOCAL_MODULE_STEM := su + LOCAL_MODULE_TAGS := eng + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/supersu + LOCAL_SRC_FILES := $(LOCAL_MODULE) + include $(BUILD_PREBUILT) + + #supolicy + include $(CLEAR_VARS) + LOCAL_MODULE := supolicyarm64 + LOCAL_MODULE_STEM := supolicy + LOCAL_MODULE_TAGS := eng + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/supersu + LOCAL_SRC_FILES := $(LOCAL_MODULE) + include $(BUILD_PREBUILT) + endif + + #install-recovery.sh + include $(CLEAR_VARS) + LOCAL_MODULE := install-recovery.sh + LOCAL_MODULE_TAGS := eng + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/supersu + LOCAL_SRC_FILES := $(LOCAL_MODULE) + include $(BUILD_PREBUILT) + + #install-supersu.sh + include $(CLEAR_VARS) + LOCAL_MODULE := install-supersu.sh + LOCAL_MODULE_TAGS := eng + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/supersu + LOCAL_SRC_FILES := $(LOCAL_MODULE) + include $(BUILD_PREBUILT) + + #99SuperSUDaemon + include $(CLEAR_VARS) + LOCAL_MODULE := 99SuperSUDaemon + LOCAL_MODULE_TAGS := eng + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/supersu + LOCAL_SRC_FILES := $(LOCAL_MODULE) + include $(BUILD_PREBUILT) + + #SuperSU special installer APK + include $(CLEAR_VARS) + LOCAL_MODULE := Superuser.apk + LOCAL_MODULE_TAGS := eng + LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES + LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/supersu + LOCAL_SRC_FILES := $(LOCAL_MODULE) + include $(BUILD_PREBUILT) +endif + +#TWRP App "placeholder" +include $(CLEAR_VARS) +LOCAL_MODULE := me.twrp.twrpapp.apk +LOCAL_MODULE_TAGS := eng +LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES +LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin +LOCAL_SRC_FILES := $(LOCAL_MODULE) +include $(BUILD_PREBUILT) diff --git a/prebuilt/HTCDumlock.apk b/prebuilt/HTCDumlock.apk Binary files differnew file mode 100644 index 000000000..829819731 --- /dev/null +++ b/prebuilt/HTCDumlock.apk diff --git a/prebuilt/Superuser.apk b/prebuilt/Superuser.apk Binary files differnew file mode 100644 index 000000000..99eb7d2a1 --- /dev/null +++ b/prebuilt/Superuser.apk diff --git a/prebuilt/chattr b/prebuilt/chattr Binary files differnew file mode 100755 index 000000000..12ccf8610 --- /dev/null +++ b/prebuilt/chattr diff --git a/prebuilt/chattr.pie b/prebuilt/chattr.pie Binary files differnew file mode 100644 index 000000000..47397283b --- /dev/null +++ b/prebuilt/chattr.pie diff --git a/prebuilt/dump_imagesys b/prebuilt/dump_imagesys Binary files differnew file mode 100644 index 000000000..e1bdb6293 --- /dev/null +++ b/prebuilt/dump_imagesys diff --git a/prebuilt/fix_permissions.sh b/prebuilt/fix_permissions.sh new file mode 100755 index 000000000..3723a126c --- /dev/null +++ b/prebuilt/fix_permissions.sh @@ -0,0 +1,484 @@ +#!/sbin/sh +# +# Warning: if you want to run this script in cm-recovery change the above to #!/sbin/sh +# +# fix_permissions - fixes permissions on Android data directories after upgrade +# shade@chemlab.org +# +# original concept: http://blog.elsdoerfer.name/2009/05/25/android-fix-package-uid-mismatches/ +# implementation by: Cyanogen +# improved by: ankn, smeat, thenefield, farmatito, rikupw, Kastro +# +# v1.1-v1.31r3 - many improvements and concepts from XDA developers. +# v1.34 through v2.00 - A lot of frustration [by Kastro] +# v2.01 - Completely rewrote the script for SPEED, thanks for the input farmatito +# /data/data depth recursion is tweaked; +# fixed single mode; +# functions created for modularity; +# logging can be disabled via CLI for more speed; +# runtime computation added to end (Runtime: mins secs); +# progress (current # of total) added to screen; +# fixed CLI argument parsing, now you can have more than one option!; +# debug cli option; +# verbosity can be disabled via CLI option for less noise;; +# [by Kastro, (XDA: k4str0), twitter;mattcarver] +# v2.02 - ignore com.htc.resources.apk if it exists and minor code cleanups, +# fix help text, implement simulated run (-s) [farmatito] +# v2.03 - fixed chown group ownership output [Kastro] +# v2.04 - replaced /system/sd with $SD_EXT_DIRECTORY [Firerat] +VERSION="2.04" + +# Defaults +DEBUG=0 # Debug off by default +LOGGING=1 # Logging on by default +VERBOSE=1 # Verbose on by default + +# Messages +UID_MSG="Changing user ownership for:" +GID_MSG="Changing group ownership for:" +PERM_MSG="Changing permissions for:" + +# Programs needed +ECHO="busybox echo" +GREP="busybox grep" +EGREP="busybox egrep" +CAT="busybox cat" +CHOWN="busybox chown" +CHMOD="busybox chmod" +MOUNT="busybox mount" +UMOUNT="busybox umount" +CUT="busybox cut" +FIND="busybox find" +LS="busybox ls" +TR="busybox tr" +TEE="busybox tee" +TEST="busybox test" +SED="busybox sed" +RM="busybox rm" +WC="busybox wc" +EXPR="busybox expr" +DATE="busybox date" + +# Initialise vars +CODEPATH="" +UID="" +GID="" +PACKAGE="" +REMOVE=0 +NOSYSTEM=0 +ONLY_ONE="" +SIMULATE=0 +SYSREMOUNT=0 +SYSMOUNT=0 +DATAMOUNT=0 +SYSSDMOUNT=0 +FP_STARTTIME=$( $DATE +"%m-%d-%Y %H:%M:%S" ) +FP_STARTEPOCH=$( $DATE +%s ) +if $TEST "$SD_EXT_DIRECTORY" = ""; then + #check for mount point, /system/sd included in tests for backward compatibility + for MP in /sd-ext /system/sd;do + if $TEST -d $MP; then + SD_EXT_DIRECTORY=$MP + break + fi + done +fi +fp_usage() +{ + $ECHO "Usage $0 [OPTIONS] [APK_PATH]" + $ECHO " -d turn on debug" + $ECHO " -f fix only package APK_PATH" + $ECHO " -l disable logging for this run (faster)" + $ECHO " -r remove stale data directories" + $ECHO " of uninstalled packages while fixing permissions" + $ECHO " -s simulate only" + $ECHO " -u check only non-system directories" + $ECHO " -v disable verbosity for this run (less output)" + $ECHO " -V print version" + $ECHO " -h this help" +} + +fp_parseargs() +{ + # Parse options + while $TEST $# -ne 0; do + case "$1" in + -d) + DEBUG=1 + ;; + -f) + if $TEST $# -lt 2; then + $ECHO "$0: missing argument for option $1" + exit 1 + else + if $TEST $( $ECHO $2 | $CUT -c1 ) != "-"; then + ONLY_ONE=$2 + shift; + else + $ECHO "$0: missing argument for option $1" + exit 1 + fi + fi + ;; + -r) + REMOVE=1 + ;; + -s) + SIMULATE=1 + ;; + -l) + if $TEST $LOGGING -eq 0; then + LOGGING=1 + else + LOGGING=0 + fi + ;; + -v) + if $TEST $VERBOSE -eq 0; then + VERBOSE=1 + else + VERBOSE=0 + fi + ;; + -u) + NOSYSTEM=1 + ;; + -V) + $ECHO "$0 $VERSION" + exit 0 + ;; + -h) + fp_usage + exit 0 + ;; + -*) + $ECHO "$0: unknown option $1" + $ECHO + fp_usage + exit 1 + ;; + esac + shift; + done +} + +fp_print() +{ + MSG=$@ + if $TEST $LOGGING -eq 1; then + $ECHO $MSG | $TEE -a $LOG_FILE + else + $ECHO $MSG + fi +} + +fp_start() +{ + if $TEST $SIMULATE -eq 0 ; then + if $TEST $( $GREP -c " /system " "/proc/mounts" ) -ne 0; then + DEVICE=$( $GREP " /system " "/proc/mounts" | $CUT -d ' ' -f1 ) + if $TEST $DEBUG -eq 1; then + fp_print "/system mounted on $DEVICE" + fi + if $TEST $( $GREP " /system " "/proc/mounts" | $GREP -c " ro " ) -ne 0; then + $MOUNT -o remount,rw $DEVICE /system + SYSREMOUNT=1 + fi + else + $MOUNT /system > /dev/null 2>&1 + SYSMOUNT=1 + fi + + if $TEST $( $GREP -c " /data " "/proc/mounts" ) -eq 0; then + $MOUNT /data > /dev/null 2>&1 + DATAMOUNT=1 + fi + + if $TEST -e /dev/block/mmcblk0p2 && $TEST $( $GREP -c " $SD_EXT_DIRECTORY " "/proc/mounts" ) -eq 0; then + $MOUNT $SD_EXT_DIRECTORY > /dev/null 2>&1 + SYSSDMOUNT=1 + fi + fi + if $TEST $( $MOUNT | $GREP -c /sdcard ) -eq 0; then + LOG_FILE="/data/fix_permissions.log" + else + LOG_FILE="/sdcard/fix_permissions.log" + fi + if $TEST ! -e "$LOG_FILE"; then + > $LOG_FILE + fi + + fp_print "$0 $VERSION started at $FP_STARTTIME" +} + +fp_chown_uid() +{ + FP_OLDUID=$1 + FP_UID=$2 + FP_FILE=$3 + + #if user ownership doesn't equal then change them + if $TEST "$FP_OLDUID" != "$FP_UID"; then + if $TEST $VERBOSE -ne 0; then + fp_print "$UID_MSG $FP_FILE from '$FP_OLDUID' to '$FP_UID'" + fi + if $TEST $SIMULATE -eq 0; then + $CHOWN $FP_UID "$FP_FILE" + fi + fi +} + +fp_chown_gid() +{ + FP_OLDGID=$1 + FP_GID=$2 + FP_FILE=$3 + + #if group ownership doesn't equal then change them + if $TEST "$FP_OLDGID" != "$FP_GID"; then + if $TEST $VERBOSE -ne 0; then + fp_print "$GID_MSG $FP_FILE from '$FP_OLDGID' to '$FP_GID'" + fi + if $TEST $SIMULATE -eq 0; then + $CHOWN :$FP_GID "$FP_FILE" + fi + fi +} + +fp_chmod() +{ + FP_OLDPER=$1 + FP_OLDPER=$( $ECHO $FP_OLDPER | cut -c2-10 ) + FP_PERSTR=$2 + FP_PERNUM=$3 + FP_FILE=$4 + + #if the permissions are not equal + if $TEST "$FP_OLDPER" != "$FP_PERSTR"; then + if $TEST $VERBOSE -ne 0; then + fp_print "$PERM_MSG $FP_FILE from '$FP_OLDPER' to '$FP_PERSTR' ($FP_PERNUM)" + fi + #change the permissions + if $TEST $SIMULATE -eq 0; then + $CHMOD $FP_PERNUM "$FP_FILE" + fi + fi +} + +fp_all() +{ + FP_NUMS=$( $CAT /data/system/packages.xml | $EGREP "^<package.*serId" | $GREP -v framework-res.apk | $GREP -v com.htc.resources.apk | $WC -l ) + I=0 + $CAT /data/system/packages.xml | $EGREP "^<package.*serId" | $GREP -v framework-res.apk | $GREP -v com.htc.resources.apk | while read all_line; do + I=$( $EXPR $I + 1 ) + fp_package "$all_line" $I $FP_NUMS + done +} + +fp_single() +{ + FP_SFOUND=$( $CAT /data/system/packages.xml | $EGREP "^<package.*serId" | $GREP -v framework-res.apk | $GREP -v com.htc.resources.apk | $GREP -i $ONLY_ONE | wc -l ) + if $TEST $FP_SFOUND -gt 1; then + fp_print "Cannot perform single operation on $FP_SFOUND matched package(s)." + elif $TEST $FP_SFOUND = "" -o $FP_SFOUND -eq 0; then + fp_print "Could not find the package you specified in the packages.xml file." + else + FP_SPKG=$( $CAT /data/system/packages.xml | $EGREP "^<package.*serId" | $GREP -v framework-res.apk | $GREP -v com.htc.resources.apk | $GREP -i $ONLY_ONE ) + fp_package "${FP_SPKG}" 1 1 + fi +} + +fp_package() +{ + pkgline=$1 + curnum=$2 + endnum=$3 + CODEPATH=$( $ECHO $pkgline | $SED 's%.* codePath="\(.*\)".*%\1%' | $CUT -d '"' -f1 ) + PACKAGE=$( $ECHO $pkgline | $SED 's%.* name="\(.*\)".*%\1%' | $CUT -d '"' -f1 ) + UID=$( $ECHO $pkgline | $SED 's%.*serId="\(.*\)".*%\1%' | $CUT -d '"' -f1 ) + GID=$UID + APPDIR=$( $ECHO $CODEPATH | $SED 's%^\(.*\)/.*%\1%' ) + APK=$( $ECHO $CODEPATH | $SED 's%^.*/\(.*\..*\)$%\1%' ) + + #debug + if $TEST $DEBUG -eq 1; then + fp_print "CODEPATH: $CODEPATH APPDIR: $APPDIR APK:$APK UID/GID:$UID:$GID" + fi + + #check for existence of apk + if $TEST -e $CODEPATH; then + fp_print "Processing ($curnum of $endnum): $PACKAGE..." + + #lets get existing permissions of CODEPATH + OLD_UGD=$( $LS -ln "$CODEPATH" ) + OLD_PER=$( $ECHO $OLD_UGD | $CUT -d ' ' -f1 ) + OLD_UID=$( $ECHO $OLD_UGD | $CUT -d ' ' -f3 ) + OLD_GID=$( $ECHO $OLD_UGD | $CUT -d ' ' -f4 ) + + #apk source dirs + if $TEST "$APPDIR" = "/system/app"; then + #skip system apps if set + if $TEST "$NOSYSTEM" = "1"; then + fp_print "***SKIPPING SYSTEM APP ($PACKAGE)!" + return + fi + fp_chown_uid $OLD_UID 0 "$CODEPATH" + fp_chown_gid $OLD_GID 0 "$CODEPATH" + fp_chmod $OLD_PER "rw-r--r--" 644 "$CODEPATH" + elif $TEST "$APPDIR" = "/data/app" || $TEST "$APPDIR" = "/sd-ext/app"; then + fp_chown_uid $OLD_UID 1000 "$CODEPATH" + fp_chown_gid $OLD_GID 1000 "$CODEPATH" + fp_chmod $OLD_PER "rw-r--r--" 644 "$CODEPATH" + elif $TEST "$APPDIR" = "/data/app-private" || $TEST "$APPDIR" = "/sd-ext/app-private"; then + fp_chown_uid $OLD_UID 1000 "$CODEPATH" + fp_chown_gid $OLD_GID $GID "$CODEPATH" + fp_chmod $OLD_PER "rw-r-----" 640 "$CODEPATH" + fi + else + fp_print "$CODEPATH does not exist ($curnum of $endnum). Reinstall..." + if $TEST $REMOVE -eq 1; then + if $TEST -d /data/data/$PACKAGE ; then + fp_print "Removing stale dir /data/data/$PACKAGE" + if $TEST $SIMULATE -eq 0 ; then + $RM -R /data/data/$PACKAGE + fi + fi + fi + fi + + #the data/data for the package + if $TEST -d "/data/data/$PACKAGE"; then + #find all directories in /data/data/$PACKAGE + $FIND /data/data/$PACKAGE -type d -exec $LS -ldn {} \; | while read dataline; do + #get existing permissions of that directory + OLD_PER=$( $ECHO $dataline | $CUT -d ' ' -f1 ) + OLD_UID=$( $ECHO $dataline | $CUT -d ' ' -f3 ) + OLD_GID=$( $ECHO $dataline | $CUT -d ' ' -f4 ) + FILEDIR=$( $ECHO $dataline | $CUT -d ' ' -f9 ) + FOURDIR=$( $ECHO $FILEDIR | $CUT -d '/' -f5 ) + + #set defaults for iteration + ISLIB=0 + REVPERM=755 + REVPSTR="rwxr-xr-x" + REVUID=$UID + REVGID=$GID + + if $TEST "$FOURDIR" = ""; then + #package directory, perms:755 owner:$UID:$GID + fp_chmod $OLD_PER "rwxr-xr-x" 755 "$FILEDIR" + elif $TEST "$FOURDIR" = "lib"; then + #lib directory, perms:755 owner:1000:1000 + #lib files, perms:755 owner:1000:1000 + ISLIB=1 + REVPERM=755 + REVPSTR="rwxr-xr-x" + REVUID=1000 + REVGID=1000 + fp_chmod $OLD_PER "rwxr-xr-x" 755 "$FILEDIR" + elif $TEST "$FOURDIR" = "shared_prefs"; then + #shared_prefs directories, perms:771 owner:$UID:$GID + #shared_prefs files, perms:660 owner:$UID:$GID + REVPERM=660 + REVPSTR="rw-rw----" + fp_chmod $OLD_PER "rwxrwx--x" 771 "$FILEDIR" + elif $TEST "$FOURDIR" = "databases"; then + #databases directories, perms:771 owner:$UID:$GID + #databases files, perms:660 owner:$UID:$GID + REVPERM=660 + REVPSTR="rw-rw----" + fp_chmod $OLD_PER "rwxrwx--x" 771 "$FILEDIR" + elif $TEST "$FOURDIR" = "cache"; then + #cache directories, perms:771 owner:$UID:$GID + #cache files, perms:600 owner:$UID:GID + REVPERM=600 + REVPSTR="rw-------" + fp_chmod $OLD_PER "rwxrwx--x" 771 "$FILEDIR" + else + #other directories, perms:771 owner:$UID:$GID + REVPERM=771 + REVPSTR="rwxrwx--x" + fp_chmod $OLD_PER "rwxrwx--x" 771 "$FILEDIR" + fi + + #change ownership of directories matched + if $TEST "$ISLIB" = "1"; then + fp_chown_uid $OLD_UID 1000 "$FILEDIR" + fp_chown_gid $OLD_GID 1000 "$FILEDIR" + else + fp_chown_uid $OLD_UID $UID "$FILEDIR" + fp_chown_gid $OLD_GID $GID "$FILEDIR" + fi + + #if any files exist in directory with improper permissions reset them + $FIND $FILEDIR -type f -maxdepth 1 ! -perm $REVPERM -exec $LS -ln {} \; | while read subline; do + OLD_PER=$( $ECHO $subline | $CUT -d ' ' -f1 ) + SUBFILE=$( $ECHO $subline | $CUT -d ' ' -f9 ) + fp_chmod $OLD_PER $REVPSTR $REVPERM "$SUBFILE" + done + + #if any files exist in directory with improper user reset them + $FIND $FILEDIR -type f -maxdepth 1 ! -user $REVUID -exec $LS -ln {} \; | while read subline; do + OLD_UID=$( $ECHO $subline | $CUT -d ' ' -f3 ) + SUBFILE=$( $ECHO $subline | $CUT -d ' ' -f9 ) + fp_chown_uid $OLD_UID $REVUID "$SUBFILE" + done + + #if any files exist in directory with improper group reset them + $FIND $FILEDIR -type f -maxdepth 1 ! -group $REVGID -exec $LS -ln {} \; | while read subline; do + OLD_GID=$( $ECHO $subline | $CUT -d ' ' -f4 ) + SUBFILE=$( $ECHO $subline | $CUT -d ' ' -f9 ) + fp_chown_gid $OLD_GID $REVGID "$SUBFILE" + done + done + fi +} + +date_diff() +{ + if $TEST $# -ne 2; then + FP_DDM="E" + FP_DDS="E" + return + fi + FP_DDD=$( $EXPR $2 - $1 ) + FP_DDM=$( $EXPR $FP_DDD / 60 ) + FP_DDS=$( $EXPR $FP_DDD % 60 ) +} + +fp_end() +{ + if $TEST $SYSREMOUNT -eq 1; then + $MOUNT -o remount,ro $DEVICE /system > /dev/null 2>&1 + fi + + if $TEST $SYSSDMOUNT -eq 1; then + $UMOUNT $SD_EXT_DIRECTORY > /dev/null 2>&1 + fi + + if $TEST $SYSMOUNT -eq 1; then + $UMOUNT /system > /dev/null 2>&1 + fi + + if $TEST $DATAMOUNT -eq 1; then + $UMOUNT /data > /dev/null 2>&1 + fi + + FP_ENDTIME=$( $DATE +"%m-%d-%Y %H:%M:%S" ) + FP_ENDEPOCH=$( $DATE +%s ) + + date_diff $FP_STARTEPOCH $FP_ENDEPOCH + + fp_print "$0 $VERSION ended at $FP_ENDTIME (Runtime:${FP_DDM}m${FP_DDS}s)" +} + +#MAIN SCRIPT + +fp_parseargs $@ +fp_start +if $TEST "$ONLY_ONE" != "" -a "$ONLY_ONE" != "0" ; then + fp_single "$ONLY_ONE" +else + fp_all +fi +fp_end diff --git a/prebuilt/flash_imagesys b/prebuilt/flash_imagesys Binary files differnew file mode 100644 index 000000000..a08d91d85 --- /dev/null +++ b/prebuilt/flash_imagesys diff --git a/prebuilt/htcdumlock b/prebuilt/htcdumlock Binary files differnew file mode 100644 index 000000000..18068e515 --- /dev/null +++ b/prebuilt/htcdumlock diff --git a/prebuilt/htcdumlocksys b/prebuilt/htcdumlocksys Binary files differnew file mode 100644 index 000000000..c63725ed6 --- /dev/null +++ b/prebuilt/htcdumlocksys diff --git a/prebuilt/install-recovery.sh b/prebuilt/install-recovery.sh new file mode 100644 index 000000000..f62cf0b96 --- /dev/null +++ b/prebuilt/install-recovery.sh @@ -0,0 +1,17 @@ +#!/system/bin/sh + +# If you're implementing this in a custom kernel/firmware, +# I suggest you use a different script name, and add a service +# to launch it from init.rc + +# Launches SuperSU in daemon mode only on Android 4.3+. +# Nothing will happen on 4.2.x or older, unless SELinux+Enforcing. +# If you want to force loading the daemon, use "--daemon" instead + +/system/xbin/daemonsu --auto-daemon & + +# Some apps like to run stuff from this script as well, that will +# obviously break root - in your code, just search this file +# for "install-recovery-2.sh", and if present, write there instead. + +/system/etc/install-recovery-2.sh diff --git a/prebuilt/install-supersu.sh b/prebuilt/install-supersu.sh new file mode 100755 index 000000000..2bca4c3c2 --- /dev/null +++ b/prebuilt/install-supersu.sh @@ -0,0 +1,405 @@ +#!/sbin/sh +# +# SuperSU installer ZIP +# Copyright (c) 2012-2014 - Chainfire +# +# To install SuperSU properly, aside from cleaning old versions and +# other superuser-type apps from the system, the following files need to +# be installed: +# +# API source target chmod chcon required +# +# 7-19 common/Superuser.apk /system/app/Superuser.apk 0644 u:object_r:system_file:s0 gui +# 20+ common/Superuser.apk /system/app/SuperSU/SuperSU.apk 0644 u:object_r:system_file:s0 gui +# +# 17+ common/install-recovery.sh /system/etc/install-recovery.sh 0755 *1 required +# 17+ /system/bin/install-recovery.sh (symlink to /system/etc/...) required +# *1: same as /system/bin/toolbox: u:object_r:system_file:s0 if API < 20, u:object_r:toolbox_exec:s0 if API >= 20 +# +# 7+ ARCH/su /system/xbin/su *2 u:object_r:system_file:s0 required +# 7+ /system/bin/.ext/.su *2 u:object_r:system_file:s0 gui +# 17+ /system/xbin/daemonsu 0755 u:object_r:system_file:s0 required +# 17+ /system/xbin/sugote 0755 u:object_r:zygote_exec:s0 required +# *2: 06755 if API < 18, 0755 if API >= 18 +# +# 19+ ARCH/supolicy /system/xbin/supolicy 0755 u:object_r:system_file:s0 required +# 19+ ARCH/libsupol.so /system/lib(64)/libsupol.so 0644 u:object_r:system_file:s0 required +# +# 17+ /system/bin/sh or mksh *3 /system/xbin/sugote-mksh 0755 u:object_r:system_file:s0 required +# *3: which one (or both) are available depends on API +# +# 21+ /system/bin/app_process32 *4 /system/bin/app_process32_original 0755 u:object_r:zygote_exec:s0 required +# 21+ /system/bin/app_process64 *4 /system/bin/app_process64_original 0755 u:object_r:zygote_exec:s0 required +# 21+ /system/bin/app_processXX *4 /system/bin/app_process_init 0755 u:object_r:system_file:s0 required +# 21+ /system/bin/app_process (symlink to /system/xbin/daemonsu) required +# 21+ *4 /system/bin/app_process32 (symlink to /system/xbin/daemonsu) required +# 21+ *4 /system/bin/app_process64 (symlink to /system/xbin/daemonsu) required +# *4: Only do this for the relevant bits. On a 64 bits system, leave the 32 bits files alone, or dynamic linker errors +# will prevent the system from fully working in subtle ways. The bits of the su binary must also match! +# +# 17+ common/99SuperSUDaemon *5 /system/etc/init.d/99SuperSUDaemon 0755 u:object_r:system_file:s0 optional +# *5: only place this file if /system/etc/init.d is present +# +# 17+ 'echo 1 >' or 'touch' *6 /system/etc/.installed_su_daemon 0644 u:object_r:system_file:s0 optional +# *6: the file just needs to exist or some recoveries will nag you. Even with it there, it may still happen. +# +# It may seem some files are installed multiple times needlessly, but +# it only seems that way. Installing files differently or symlinking +# instead of copying (unless specified) will lead to issues eventually. +# +# The following su binary versions are included in the full package. Each +# should be installed only if the system has the same or newer API level +# as listed. The script may fall back to a different binary on older API +# levels. supolicy are all ndk/pie/19+ for 32 bit, ndk/pie/20+ for 64 bit. +# +# binary ARCH/path build type API +# +# arm-v5te arm aosp static 7+ +# x86 x86 aosp static 7+ +# +# arm-v7a armv7 ndk pie 17+ +# mips mips ndk pie 17+ +# +# arm64-v8a arm64 ndk pie 20+ +# mips64 mips64 ndk pie 20+ +# x86_64 x64 ndk pie 20+ +# +# Note that if SELinux is set to enforcing, the daemonsu binary expects +# to be run at startup (usually from install-recovery.sh, 99SuperSUDaemon, +# or app_process) from u:r:init:s0 or u:r:kernel:s0 contexts. Depending +# on the current policies, it can also deal with u:r:init_shell:s0 and +# u:r:toolbox:s0 contexts. Any other context will lead to issues eventually. +# +# After installation, run '/system/xbin/su --install', which may need to +# perform some additional installation steps. Ideally, at one point, +# a lot of this script will be moved there. +# +# The included chattr(.pie) binaries are used to remove ext2's immutable +# flag on some files. This flag is no longer set by SuperSU's OTA +# survival since API level 18, so there is no need for the 64 bit versions. +# Note that chattr does not need to be installed to the system, it's just +# used by this script, and not supported by the busybox used in older +# recoveries. +# +# Non-static binaries are supported to be PIE (Position Independent +# Executable) from API level 16, and required from API level 20 (which will +# refuse to execute non-static non-PIE). +# +# The script performs serveral actions in various ways, sometimes +# multiple times, due to different recoveries and firmwares behaving +# differently, and it thus being required for the correct result. + +OUTFD=$2 +ZIP=$3 + +SYSTEMLIB=/system/lib + +ui_print() { + echo -n -e "echo $1\n" > /proc/self/fd/$OUTFD + echo -n -e "echo\n" > /proc/self/fd/$OUTFD +} + +ch_con() { + LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox chcon -h u:object_r:system_file:s0 $1 + LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toolbox chcon -h u:object_r:system_file:s0 $1 + chcon -h u:object_r:system_file:s0 $1 + LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox chcon u:object_r:system_file:s0 $1 + LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toolbox chcon u:object_r:system_file:s0 $1 + chcon u:object_r:system_file:s0 $1 +} + +ch_con_ext() { + LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox chcon $2 $1 + LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toolbox chcon $2 $1 + chcon $2 $1 +} + +ln_con() { + LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox ln -s $1 $2 + LD_LIBRARY_PATH=$SYSTEMLIB /system/bin/toolbox ln -s $1 $2 + ln -s $1 $2 + ch_con $2 +} + +set_perm() { + chown $1.$2 $4 + chown $1:$2 $4 + chmod $3 $4 + ch_con $4 + ch_con_ext $4 $5 +} + +cp_perm() { + rm $5 + cat $4 > $5 + set_perm $1 $2 $3 $5 $6 +} + +echo "*********************" +echo "SuperSU installer ZIP" +echo "*********************" + +echo "- Mounting /system, /data and rootfs" +mount /system +mount /data +mount -o rw,remount /system +mount -o rw,remount /system /system +mount -o rw,remount / +mount -o rw,remount / / + +cat /system/bin/toolbox > /system/toolbox +chmod 0755 /system/toolbox +ch_con /system/toolbox + +API=$(cat /system/build.prop | grep "ro.build.version.sdk=" | dd bs=1 skip=21 count=2) +ABI=$(cat /system/build.prop /default.prop | grep -m 1 "ro.product.cpu.abi=" | dd bs=1 skip=19 count=3) +ABILONG=$(cat /system/build.prop /default.prop | grep -m 1 "ro.product.cpu.abi=" | dd bs=1 skip=19) +ABI2=$(cat /system/build.prop /default.prop | grep -m 1 "ro.product.cpu.abi2=" | dd bs=1 skip=20 count=3) +SUMOD=06755 +SUGOTE=false +SUPOLICY=false +INSTALL_RECOVERY_CONTEXT=u:object_r:system_file:s0 +MKSH=/system/bin/mksh +PIE= +ARCH=arm +APKFOLDER=false +APKNAME=/system/app/Superuser.apk +APPPROCESS=false +APPPROCESS64=false +if [ "$ABI" = "x86" ]; then ARCH=x86; fi; +if [ "$ABI2" = "x86" ]; then ARCH=x86; fi; +if [ "$API" -eq "$API" ]; then + if [ "$API" -ge "17" ]; then + SUGOTE=true + PIE=.pie + if [ "$ABILONG" = "armeabi-v7a" ]; then ARCH=armv7; fi; + if [ "$ABI" = "mip" ]; then ARCH=mips; fi; + if [ "$ABILONG" = "mips" ]; then ARCH=mips; fi; + fi + if [ "$API" -ge "18" ]; then + SUMOD=0755 + fi + if [ "$API" -ge "20" ]; then + if [ "$ABILONG" = "arm64-v8a" ]; then ARCH=arm64; SYSTEMLIB=/system/lib64; APPPROCESS64=true; fi; + if [ "$ABILONG" = "mips64" ]; then ARCH=mips64; SYSTEMLIB=/system/lib64; APPPROCESS64=true; fi; + if [ "$ABILONG" = "x86_64" ]; then ARCH=x64; SYSTEMLIB=/system/lib64; APPPROCESS64=true; fi; + APKFOLDER=true + APKNAME=/system/app/SuperSU/SuperSU.apk + fi + if [ "$API" -ge "19" ]; then + SUPOLICY=true + if [ "$(LD_LIBRARY_PATH=$SYSTEMLIB /system/toolbox ls -lZ /system/bin/toolbox | grep toolbox_exec > /dev/null; echo $?)" -eq "0" ]; then + INSTALL_RECOVERY_CONTEXT=u:object_r:toolbox_exec:s0 + fi + fi + if [ "$API" -ge "21" ]; then + APPPROCESS=true + fi +fi +if [ ! -f $MKSH ]; then + MKSH=/system/bin/sh +fi + +#echo "DBG [$API] [$ABI] [$ABI2] [$ABILONG] [$ARCH] [$MKSH]" + +# Don't extract in TWRP +#echo "- Extracting files" +#cd /tmp +#mkdir supersu +#cd supersu +#unzip -o "$ZIP" + +BIN=/supersu +COM=/supersu + +echo "- Disabling OTA survival" +chmod 0755 /supersu/chattr$PIE +LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/bin/su +LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/xbin/su +LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/bin/.ext/.su +LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/xbin/daemonsu +LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/xbin/sugote +LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/xbin/sugote_mksh +LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/xbin/supolicy +LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/lib/libsupol.so +LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/lib64/libsupol.so +LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/etc/install-recovery.sh +LD_LIBRARY_PATH=$SYSTEMLIB $BIN/chattr$PIE -i /system/bin/install-recovery.sh + +echo "- Removing old files" + +if [ -f "/system/bin/install-recovery.sh" ]; then + if [ ! -f "/system/bin/install-recovery_original.sh" ]; then + mv /system/bin/install-recovery.sh /system/bin/install-recovery_original.sh + ch_con /system/bin/install-recovery_original.sh + fi +fi +if [ -f "/system/etc/install-recovery.sh" ]; then + if [ ! -f "/system/etc/install-recovery_original.sh" ]; then + mv /system/etc/install-recovery.sh /system/etc/install-recovery_original.sh + ch_con /system/etc/install-recovery_original.sh + fi +fi + +rm -f /system/bin/su +rm -f /system/xbin/su +rm -f /system/xbin/daemonsu +rm -f /system/xbin/sugote +rm -f /system/xbin/sugote-mksh +rm -f /system/xbin/supolicy +rm -f /system/lib/libsupol.so +rm -f /system/lib64/libsupol.so +rm -f /system/bin/.ext/.su +rm -f /system/bin/install-recovery.sh +rm -f /system/etc/install-recovery.sh +rm -f /system/etc/init.d/99SuperSUDaemon +rm -f /system/etc/.installed_su_daemon + +rm -f /system/app/Superuser.apk +rm -f /system/app/Superuser.odex +rm -rf /system/app/Superuser +rm -f /system/app/SuperUser.apk +rm -f /system/app/SuperUser.odex +rm -rf /system/app/SuperUser +rm -f /system/app/superuser.apk +rm -f /system/app/superuser.odex +rm -rf /system/app/superuser +rm -f /system/app/Supersu.apk +rm -f /system/app/Supersu.odex +rm -rf /system/app/Supersu +rm -f /system/app/SuperSU.apk +rm -f /system/app/SuperSU.odex +rm -rf /system/app/SuperSU +rm -f /system/app/supersu.apk +rm -f /system/app/supersu.odex +rm -rf /system/app/supersu +rm -f /system/app/VenomSuperUser.apk +rm -f /system/app/VenomSuperUser.odex +rm -rf /system/app/VenomSuperUser +rm -f /data/dalvik-cache/*com.noshufou.android.su* +rm -f /data/dalvik-cache/*/*com.noshufou.android.su* +rm -f /data/dalvik-cache/*com.koushikdutta.superuser* +rm -f /data/dalvik-cache/*/*com.koushikdutta.superuser* +rm -f /data/dalvik-cache/*com.mgyun.shua.su* +rm -f /data/dalvik-cache/*/*com.mgyun.shua.su* +rm -f /data/dalvik-cache/*com.m0narx.su* +rm -f /data/dalvik-cache/*/*com.m0narx.su* +rm -f /data/dalvik-cache/*Superuser.apk* +rm -f /data/dalvik-cache/*/*Superuser.apk* +rm -f /data/dalvik-cache/*SuperUser.apk* +rm -f /data/dalvik-cache/*/*SuperUser.apk* +rm -f /data/dalvik-cache/*superuser.apk* +rm -f /data/dalvik-cache/*/*superuser.apk* +rm -f /data/dalvik-cache/*VenomSuperUser.apk* +rm -f /data/dalvik-cache/*/*VenomSuperUser.apk* +rm -f /data/dalvik-cache/*eu.chainfire.supersu* +rm -f /data/dalvik-cache/*/*eu.chainfire.supersu* +rm -f /data/dalvik-cache/*Supersu.apk* +rm -f /data/dalvik-cache/*/*Supersu.apk* +rm -f /data/dalvik-cache/*SuperSU.apk* +rm -f /data/dalvik-cache/*/*SuperSU.apk* +rm -f /data/dalvik-cache/*supersu.apk* +rm -f /data/dalvik-cache/*/*supersu.apk* +rm -f /data/dalvik-cache/*.oat +rm -f /data/app/com.noshufou.android.su* +rm -f /data/app/com.koushikdutta.superuser* +rm -f /data/app/com.mgyun.shua.su* +rm -f /data/app/com.m0narx.su* +rm -f /data/app/eu.chainfire.supersu-* +rm -f /data/app/eu.chainfire.supersu.apk + +echo "- Creating space" +if ($APKFOLDER); then + cp /system/app/Maps/Maps.apk /Maps.apk + cp /system/app/GMS_Maps/GMS_Maps.apk /GMS_Maps.apk + cp /system/app/YouTube/YouTube.apk /YouTube.apk + rm /system/app/Maps/Maps.apk + rm /system/app/GMS_Maps/GMS_Maps.apk + rm /system/app/YouTube/YouTube.apk +else + cp /system/app/Maps.apk /Maps.apk + cp /system/app/GMS_Maps.apk /GMS_Maps.apk + cp /system/app/YouTube.apk /YouTube.apk + rm /system/app/Maps.apk + rm /system/app/GMS_Maps.apk + rm /system/app/YouTube.apk +fi + +echo "- Placing files" + +mkdir /system/bin/.ext +set_perm 0 0 0777 /system/bin/.ext +cp_perm 0 0 $SUMOD $BIN/su /system/bin/.ext/.su +cp_perm 0 0 $SUMOD $BIN/su /system/xbin/su +cp_perm 0 0 0755 $BIN/su /system/xbin/daemonsu +if ($SUGOTE); then + cp_perm 0 0 0755 $BIN/su /system/xbin/sugote u:object_r:zygote_exec:s0 + cp_perm 0 0 0755 $MKSH /system/xbin/sugote-mksh +fi +if ($SUPOLICY); then + cp_perm 0 0 0755 $BIN/supolicy /system/xbin/supolicy + cp_perm 0 0 0644 $BIN/libsupol.so $SYSTEMLIB/libsupol.so +fi +if ($APKFOLDER); then + mkdir /system/app/SuperSU + set_perm 0 0 0755 /system/app/SuperSU +fi +cp_perm 0 0 0644 $COM/Superuser.apk $APKNAME +cp_perm 0 0 0755 $COM/install-recovery.sh /system/etc/install-recovery.sh +ln_con /system/etc/install-recovery.sh /system/bin/install-recovery.sh +if ($APPPROCESS); then + rm /system/bin/app_process + ln_con /system/xbin/daemonsu /system/bin/app_process + if ($APPPROCESS64); then + if [ ! -f "/system/bin/app_process64_original" ]; then + mv /system/bin/app_process64 /system/bin/app_process64_original + else + rm /system/bin/app_process64 + fi + ln_con /system/xbin/daemonsu /system/bin/app_process64 + if [ ! -f "/system/bin/app_process_init" ]; then + cp_perm 0 2000 0755 /system/bin/app_process64_original /system/bin/app_process_init + fi + else + if [ ! -f "/system/bin/app_process32_original" ]; then + mv /system/bin/app_process32 /system/bin/app_process32_original + else + rm /system/bin/app_process32 + fi + ln_con /system/xbin/daemonsu /system/bin/app_process32 + if [ ! -f "/system/bin/app_process_init" ]; then + cp_perm 0 2000 0755 /system/bin/app_process32_original /system/bin/app_process_init + fi + fi +fi +cp_perm 0 0 0744 $COM/99SuperSUDaemon /system/etc/init.d/99SuperSUDaemon +echo 1 > /system/etc/.installed_su_daemon +set_perm 0 0 0644 /system/etc/.installed_su_daemon + +echo "- Restoring files" +if ($APKFOLDER); then + cp_perm 0 0 0644 /Maps.apk /system/app/Maps/Maps.apk + cp_perm 0 0 0644 /GMS_Maps.apk /system/app/GMS_Maps/GMS_Maps.apk + cp_perm 0 0 0644 /YouTube.apk /system/app/YouTube/YouTube.apk + rm /Maps.apk + rm /GMS_Maps.apk + rm /YouTube.apk +else + cp_perm 0 0 0644 /Maps.apk /system/app/Maps.apk + cp_perm 0 0 0644 /GMS_Maps.apk /system/app/GMS_Maps.apk + cp_perm 0 0 0644 /YouTube.apk /system/app/YouTube.apk + rm /Maps.apk + rm /GMS_Maps.apk + rm /YouTube.apk +fi + +echo "- Post-installation script" +rm /system/toolbox +LD_LIBRARY_PATH=$SYSTEMLIB /system/xbin/su --install + +echo "- Unmounting /system and /data" +umount /system +umount /data + +echo "- Done !" +exit 0 diff --git a/prebuilt/libbmlutils.so b/prebuilt/libbmlutils.so Binary files differnew file mode 100644 index 000000000..48a3e3bb8 --- /dev/null +++ b/prebuilt/libbmlutils.so diff --git a/prebuilt/libflashutils.so b/prebuilt/libflashutils.so Binary files differnew file mode 100644 index 000000000..91fcde0b5 --- /dev/null +++ b/prebuilt/libflashutils.so diff --git a/prebuilt/libmmcutils.so b/prebuilt/libmmcutils.so Binary files differnew file mode 100644 index 000000000..5124876d1 --- /dev/null +++ b/prebuilt/libmmcutils.so diff --git a/prebuilt/libmtdutils.so b/prebuilt/libmtdutils.so Binary files differnew file mode 100644 index 000000000..1cbc61e61 --- /dev/null +++ b/prebuilt/libmtdutils.so diff --git a/prebuilt/libsupol.so b/prebuilt/libsupol.so Binary files differnew file mode 100644 index 000000000..8a81a155e --- /dev/null +++ b/prebuilt/libsupol.so diff --git a/prebuilt/libsupol.soarm64 b/prebuilt/libsupol.soarm64 Binary files differnew file mode 100644 index 000000000..50308069b --- /dev/null +++ b/prebuilt/libsupol.soarm64 diff --git a/prebuilt/me.twrp.twrpapp.apk b/prebuilt/me.twrp.twrpapp.apk Binary files differnew file mode 100644 index 000000000..cb19986fa --- /dev/null +++ b/prebuilt/me.twrp.twrpapp.apk diff --git a/prebuilt/mke2fs.conf b/prebuilt/mke2fs.conf new file mode 100644 index 000000000..e231d7c83 --- /dev/null +++ b/prebuilt/mke2fs.conf @@ -0,0 +1,17 @@ +[defaults] + base_features = sparse_super,filetype,resize_inode,dir_index,ext_attr + blocksize = 4096 + inode_size = 256 + inode_ratio = 16384 + +[fs_types] + ext2 = { + + } + ext3 = { + features = has_journal + } + ext4 = { + features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize + inode_size = 256 + } diff --git a/prebuilt/parted b/prebuilt/parted Binary files differnew file mode 100755 index 000000000..bb3d432a2 --- /dev/null +++ b/prebuilt/parted diff --git a/prebuilt/permissive.sh b/prebuilt/permissive.sh new file mode 100755 index 000000000..f1046f94e --- /dev/null +++ b/prebuilt/permissive.sh @@ -0,0 +1,8 @@ +#!/sbin/sh + +# We use this shell script because the script will follow symlinks and +# different trees will use different binaries to supply the setenforce +# tool. Before M we use toolbox, M and beyond will use toybox. The init +# binary and init.rc will not follow symlinks. + +setenforce 0 diff --git a/prebuilt/relink.sh b/prebuilt/relink.sh new file mode 100755 index 000000000..2dd56147e --- /dev/null +++ b/prebuilt/relink.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +process_file() +{ + dst=$1/$(basename $2) + src=$2 + if [ $dst == $src ]; then + cp -f -p $src $src.tmp + src=$2.tmp + else + cp -f -p $src $dst + fi + + sed "s|/system/bin/linker64\x0|/sbin/linker64\x0\x0\x0\x0\x0\x0\x0|g" $src | sed "s|/system/bin/linker\x0|/sbin/linker\x0\x0\x0\x0\x0\x0\x0|g" | sed "s|/system/bin/sh\x0|/sbin/sh\x0\x0\x0\x0\x0\x0\x0|g" | sed "s|/system/lib64\x0|/sbin\x0\x0\x0\x0\x0\x0\x0\x0\x0|g" | sed "s|/system/lib\x0|/sbin\x0\x0\x0\x0\x0\x0\x0|g" > $dst + + if [ $1 == $(dirname $2) ]; then + rm -f $src + fi +} + + +dest=$1 +shift 1 +for ARG in $* +do + process_file $dest $ARG +done diff --git a/prebuilt/sgdisk_static b/prebuilt/sgdisk_static Binary files differnew file mode 100755 index 000000000..eb8a129ce --- /dev/null +++ b/prebuilt/sgdisk_static diff --git a/prebuilt/suarm b/prebuilt/suarm Binary files differnew file mode 100644 index 000000000..38679b4ac --- /dev/null +++ b/prebuilt/suarm diff --git a/prebuilt/suarm64 b/prebuilt/suarm64 Binary files differnew file mode 100644 index 000000000..a2b4dc8bf --- /dev/null +++ b/prebuilt/suarm64 diff --git a/prebuilt/supolicy b/prebuilt/supolicy Binary files differnew file mode 100644 index 000000000..55db212a2 --- /dev/null +++ b/prebuilt/supolicy diff --git a/prebuilt/supolicyarm64 b/prebuilt/supolicyarm64 Binary files differnew file mode 100644 index 000000000..ea8ac203d --- /dev/null +++ b/prebuilt/supolicyarm64 diff --git a/prebuilt/teamwin b/prebuilt/teamwin new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/prebuilt/teamwin @@ -0,0 +1 @@ + diff --git a/prebuilt/twrp_fonts.py b/prebuilt/twrp_fonts.py new file mode 100755 index 000000000..439240978 --- /dev/null +++ b/prebuilt/twrp_fonts.py @@ -0,0 +1,198 @@ +#!/usr/bin/env python +# -*- coding: utf8 -*- +import codecs,os,gzip,ctypes,ctypes.util,sys +from struct import * +from PIL import Image, ImageDraw, ImageFont + +# ====== Python script to convert TrueTypeFonts to TWRP's .dat format ====== +# This script was originally made by https://github.com/suky for his chinese version of TWRP +# and then translated to English by feilplane at #twrp of irc.freenode.net. +# However, it was not compatible with vanilla TWRP, so https://github.com/Tasssadar rewrote +# most of it and it now has very little in common with the original script. + +class Reference(): + def __init__(self, val): + self.__value = val + + def get(self): + return self.__value + + def set(self, val): + self.__value = val + +quiet = Reference(False) + +def log(text): + if not quiet.get(): + sys.stdout.write(text) + +def write_data(f, width, height, offsets, data): + f.write(pack("<I", width)) + f.write(pack("<I", height)) + for off in offsets: + f.write(pack("<I", off)) + f.write(data) + +if __name__ == "__main__": + fontsize = Reference(20) + out_fname = Reference("font.dat") + voffset = Reference(None) + padding = Reference(0) + font_fname = Reference(None) + preview = Reference(None) + + arg_parser = [ + ["-s", "--size=", fontsize, int], + ["-o", "--output=", out_fname, str], + ["-p", "--preview=", preview, str], + [None, "--padding=", padding, int], + ["-q", "--quiet", quiet, None], + [None, "--voffset=", voffset, int] + ] + + argv = sys.argv + argc = len(argv) + i = 1 + while i < argc: + arg = argv[i] + arg_next = argv[i+1] if i+1 < argc else None + + if arg == "--help" or arg == "-h": + print ("This script converts TrueTypeFonts to .dat file for TWRP recovery.\n\n" + "Usage: %s [SWITCHES] [TRUETYPE FILE]\n\n" + " -h, --help - print help\n" + " -o, --output=[FILE] - output file or '-' for stdout (default: font.dat)\n" + " -p, --preview=[FILE] - generate font preview to png file\n" + " --padding=[PIXELS] - horizontal padding around each character (default: 0)\n" + " -q, --quiet - Do not print any output\n" + " -s, --size=[SIZE IN PIXELS] - specify font size in points (default: 20)\n" + " --voffset=[PIXELS] - vertical offset (default: font size*0.25)\n\n" + "Example:\n" + " %s -s 40 -o ComicSans_40.dat -p preview.png ComicSans.ttf\n") % ( + sys.argv[0], sys.argv[0] + ) + exit(0) + + found = False + for p in arg_parser: + if p[0] and arg == p[0] and (arg_next or not p[3]): + if p[3]: + p[2].set(p[3](arg_next)) + else: + p[2].set(True) + i += 1 + found = True + break + elif p[1] and arg.startswith(p[1]): + if p[3]: + p[2].set(p[3](arg[len(p[1]):])) + else: + p[2].set(True) + found = True + break + + if not found: + font_fname.set(arg) + + i += 1 + + if not voffset.get(): + voffset.set(int(fontsize.get()*0.25)) + + if out_fname.get() == "-": + quiet.set(True) + + log("Loading font %s...\n" % font_fname.get()) + font = ImageFont.truetype(font_fname.get(), fontsize.get(), 0, "utf-32be") + cwidth = 0 + cheight = font.getsize('A')[1] + offsets = [] + renders = [] + data = bytes() + + # temp Image and ImageDraw to get access to textsize + res = Image.new('L', (1, 1), 0) + res_draw = ImageDraw.Draw(res) + + # Measure each character and render it to separate Image + log("Rendering characters...\n") + for i in range(32, 128): + w, h = res_draw.textsize(chr(i), font) + w += padding.get()*2 + offsets.append(cwidth) + cwidth += w + if h > cheight: + cheight = h + ichr = Image.new('L', (w, cheight*2)) + ichr_draw = ImageDraw.Draw(ichr) + ichr_draw.text((padding.get(), 0), chr(i), 255, font) + renders.append(ichr) + + # Twice the height to account for under-the-baseline characters + cheight *= 2 + + # Create the result bitmap + log("Creating result bitmap...\n") + res = Image.new('L', (cwidth, cheight), 0) + res_draw = ImageDraw.Draw(res) + + # Paste all characters into result bitmap + for i in range(len(renders)): + res.paste(renders[i], (offsets[i], 0)) + # uncomment to draw lines separating each character (for debug) + #res_draw.rectangle([offsets[i], 0, offsets[i], cheight], outline="blue") + + # crop the blank areas on top and bottom + (_, start_y, _, end_y) = res.getbbox() + res = res.crop((0, start_y, cwidth, end_y)) + cheight = (end_y - start_y) + voffset.get() + new_res = Image.new('L', (cwidth, cheight)) + new_res.paste(res, (0, voffset.get())) + res = new_res + + # save the preview + if preview.get(): + log("Saving preview to %s...\n" % preview.get()) + res.save(preview.get()) + + # Pack the data. + # The "data" is a B/W bitmap with all 96 characters next to each other + # on one line. It is as wide as all the characters combined and as + # high as the tallest character, plus padding. + # Each byte contains info about eight pixels, starting from + # highest to lowest bit: + # bits: | 7 6 5 4 3 2 1 0 | 15 14 13 12 11 10 9 8 | ... + # pixels: | 0 1 2 3 4 5 6 7 | 8 9 10 11 12 13 14 15 | ... + log("Packing data...\n") + bit = 0 + bit_itr = 0 + for c in res.tostring(): + # FIXME: How to handle antialiasing? + # if c != '\x00': + # In Python3, c is int, in Python2, c is string. Because of reasons. + try: + fill = (ord(c) >= 127) + except TypeError: + fill = (c >= 127) + if fill: + bit |= (1 << (7-bit_itr)) + bit_itr += 1 + if bit_itr >= 8: + data += pack("<B", bit) + bit_itr = 0 + bit = 0 + + # Write them to the file. + # Format: + # 000: width + # 004: height + # 008: offsets of each characters (96*uint32) + # 392: data as described above + log("Writing to %s...\n" % out_fname.get()) + if out_fname.get() == "-": + write_data(sys.stdout, cwidth, cheight, offsets, data) + else: + with open(out_fname.get(), 'wb') as f: + write_data(f, cwidth, cheight, offsets, data) + + exit(0) |