diff --git a/CONFIG.md b/CONFIG.md index edd117e..3256feb 100755 --- a/CONFIG.md +++ b/CONFIG.md @@ -41,4 +41,5 @@ apkmonk-dlurl = "https://www.apkmonk.com/app/com.app.app/" module-prop-name = "some-app-magisk" # magisk module prop name. apkmirror-dpi = "360-480dpi" # used to select apk variant from apkmirror. default: nodpi arch = "arm64-v8a" # 'arm64-v8a', 'arm-v7a', 'all', 'both'. 'both' downloads both arm64-v8a and arm-v7a. default: all +riplib = true # enables ripping x86 and x86_64 libs from apks with j-hc revanced cli. default: true ``` diff --git a/build.sh b/build.sh index 4850687..36f679f 100755 --- a/build.sh +++ b/build.sh @@ -100,6 +100,7 @@ for table_name in $(toml_get_table_names); do app_args[riplib]=false fi fi + if [ "${app_args[riplib]}" = "true" ] && [ "$(toml_get "$t" riplib)" = "false" ]; then app_args[riplib]=false; fi app_args[rv_brand]=$(toml_get "$t" rv-brand) || app_args[rv_brand]="$DEF_RV_BRAND" app_args[excluded_patches]=$(toml_get "$t" excluded-patches) || app_args[excluded_patches]="" diff --git a/scripts/customize.sh b/scripts/customize.sh index 48e1711..a024f52 100755 --- a/scripts/customize.sh +++ b/scripts/customize.sh @@ -9,16 +9,19 @@ elif [ $ARCH = "arm64" ]; then #arm64 ARCH_LIB=arm64-v8a alias cmpr='$MODPATH/bin/arm64/cmpr' +elif [ $ARCH = "x86" ]; then + ARCH_LIB=x86 + alias cmpr='$MODPATH/bin/x86/cmpr' else abort "ERROR: unsupported arch: ${ARCH}" fi set_perm_recursive $MODPATH/bin 0 0 0755 0777 -nsenter -t1 -m -- grep __PKGNAME /proc/mounts | while read -r line; do +su -M -c "grep __PKGNAME /proc/mounts" | while read -r line; do ui_print "* Un-mount" mp=${line#* } mp=${mp%% *} - nsenter -t1 -m -- umount -l "${mp%%\\*}" + su -M -c "umount -l ${mp%%\\*}" done am force-stop __PKGNAME @@ -97,7 +100,7 @@ mkdir -p $NVBASE/rvhc RVPATH=$NVBASE/rvhc/${MODPATH##*/}.apk mv -f $MODPATH/base.apk $RVPATH -if ! op=$(nsenter -t1 -m -- mount -o bind $RVPATH $BASEPATH/base.apk 2>&1); then +if ! op=$(su -M -c "mount -o bind $RVPATH $BASEPATH/base.apk" 2>&1); then ui_print "ERROR: Mount failed!" ui_print "$op" fi diff --git a/utils.sh b/utils.sh index 282f8c9..b5c7808 100755 --- a/utils.sh +++ b/utils.sh @@ -97,9 +97,10 @@ get_prebuilts() { dl_if_dne ${TEMP_DIR}/aapt2 https://github.com/rendiix/termux-aapt/raw/d7d4b4a344cc52b94bcdab3500be244151261d8e/prebuilt-binary/${arch}/aapt2 chmod +x "${TEMP_DIR}/aapt2" fi - mkdir -p ${MODULE_TEMPLATE_DIR}/bin/arm64 ${MODULE_TEMPLATE_DIR}/bin/arm + mkdir -p ${MODULE_TEMPLATE_DIR}/bin/arm64 ${MODULE_TEMPLATE_DIR}/bin/arm ${MODULE_TEMPLATE_DIR}/bin/x86 dl_if_dne "${MODULE_TEMPLATE_DIR}/bin/arm64/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-arm64-v8a" dl_if_dne "${MODULE_TEMPLATE_DIR}/bin/arm/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-armeabi-v7a" + dl_if_dne "${MODULE_TEMPLATE_DIR}/bin/x86/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-x86" HTMLQ="${TEMP_DIR}/htmlq" if [ ! -f "$HTMLQ" ]; then @@ -432,15 +433,6 @@ build_rv() { # fi # fi # fi - - if [ "${args[riplib]}" = true ]; then - p_patcher_args+=("--rip-lib x86_64 --rip-lib x86") - if [ "$arch" = "arm64-v8a" ]; then - p_patcher_args+=("--rip-lib armeabi-v7a") - elif [ "$arch" = "arm-v7a" ]; then - p_patcher_args+=("--rip-lib arm64-v8a") - fi - fi if [ "$mode_arg" = module ]; then build_mode_arr=(module) elif [ "$mode_arg" = apk ]; then @@ -464,8 +456,18 @@ build_rv() { else patched_apk="${TEMP_DIR}/${app_name_l}-${rv_brand_f}-${version_f}-${arch_f}.apk" fi - if [ "$build_mode" = module ] && [ "${args[riplib]}" = true ]; then - patcher_args+=("--unsigned --rip-lib arm64-v8a --rip-lib armeabi-v7a") + if [ "${args[riplib]}" = true ]; then + if [ "$build_mode" = module ]; then + patcher_args+=("--unsigned --rip-lib arm64-v8a --rip-lib armeabi-v7a") + else + patcher_args+=("--rip-lib x86_64 --rip-lib x86") + if [ "$arch" = "arm64-v8a" ]; then + patcher_args+=("--rip-lib armeabi-v7a") + elif [ "$arch" = "arm-v7a" ]; then + patcher_args+=("--rip-lib arm64-v8a") + fi + + fi fi if [ ! -f "$patched_apk" ] || [ "$REBUILD" = true ]; then if ! patch_apk "$stock_apk" "$patched_apk" "${patcher_args[*]}" "${args[cli]}" "${args[ptjar]}"; then