mirror of
https://github.com/Nezumi-2711/revanced-apk-build.git
synced 2026-09-22 20:02:00 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d5e85fc3e | ||
|
|
a14e4f9c7d | ||
|
|
d7a7688aa8 |
+27
-18
@@ -59,19 +59,21 @@ jobs:
|
|||||||
cat build.md >> "$GITHUB_OUTPUT"
|
cat build.md >> "$GITHUB_OUTPUT"
|
||||||
echo "${DELIM}" >> "$GITHUB_OUTPUT"
|
echo "${DELIM}" >> "$GITHUB_OUTPUT"
|
||||||
cp -f build.md build.tmp
|
cp -f build.md build.tmp
|
||||||
|
|
||||||
|
- name: Upload release
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
TAG: ${{ steps.next_ver_code.outputs.NEXT_VER_CODE }}
|
||||||
|
BODY: ${{ steps.get_output.outputs.BUILD_LOG }}
|
||||||
|
run: |
|
||||||
|
if gh release view "$TAG" >/dev/null 2>&1; then
|
||||||
|
gh release edit "$TAG" --title "Release" --notes "$BODY"
|
||||||
|
gh release upload "$TAG" ./build/* --clobber
|
||||||
|
else
|
||||||
|
gh release create "$TAG" ./build/* --title "Release" --notes "$BODY"
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Upload modules to release
|
- name: Update modules changelog and update json
|
||||||
uses: svenstaro/upload-release-action@v2
|
|
||||||
with:
|
|
||||||
body: ${{ steps.get_output.outputs.BUILD_LOG }}
|
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
file: ./build/*
|
|
||||||
release_name: ReVanced
|
|
||||||
tag: ${{ steps.next_ver_code.outputs.NEXT_VER_CODE }}
|
|
||||||
file_glob: true
|
|
||||||
overwrite: true
|
|
||||||
|
|
||||||
- name: Update changelog and update json
|
|
||||||
id: update_config
|
id: update_config
|
||||||
run: |
|
run: |
|
||||||
git checkout -f update || git switch --discard-changes --orphan update
|
git checkout -f update || git switch --discard-changes --orphan update
|
||||||
@@ -100,12 +102,19 @@ jobs:
|
|||||||
|
|
||||||
find . -name "*-update.json" | grep . || : >dummy-update.json
|
find . -name "*-update.json" | grep . || : >dummy-update.json
|
||||||
|
|
||||||
- uses: stefanzweifel/git-auto-commit-action@v7
|
- name: Commit module json changes
|
||||||
with:
|
run: |
|
||||||
branch: update
|
git config user.name "github-actions[bot]"
|
||||||
skip_checkout: true
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
file_pattern: build.md *-update.json
|
|
||||||
commit_message: Bump version ${{ steps.next_ver_code.outputs.NEXT_VER_CODE }}
|
git add build.md *-update.json
|
||||||
|
|
||||||
|
if ! git diff --cached --quiet; then
|
||||||
|
git commit -m "Bump version ${{ steps.next_ver_code.outputs.NEXT_VER_CODE }}"
|
||||||
|
git push origin HEAD:update
|
||||||
|
else
|
||||||
|
echo "no changes!"
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Report to Telegram
|
- name: Report to Telegram
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -47,4 +47,4 @@ jobs:
|
|||||||
needs: check
|
needs: check
|
||||||
uses: ./.github/workflows/build.yml
|
uses: ./.github/workflows/build.yml
|
||||||
if: ${{ needs.check.outputs.SHOULD_BUILD == 1 }}
|
if: ${{ needs.check.outputs.SHOULD_BUILD == 1 }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|||||||
@@ -6,3 +6,4 @@ test*
|
|||||||
/logs
|
/logs
|
||||||
build.md
|
build.md
|
||||||
cmpr
|
cmpr
|
||||||
|
*-temporary-files
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ excluded-patches = """\
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
included-patches = "'Some Patch'" # whitespace seperated list of non-default patches to include. default: ""
|
included-patches = "'Some Patch'" # whitespace seperated list of non-default patches to include. default: ""
|
||||||
include-stock = true # includes stock apk in the module. default: true
|
include-stock = "merged" # 'merged', 'split' or 'disable'. default: merged
|
||||||
exclusive-patches = false # exclude all patches by default. default: false
|
exclusive-patches = false # exclude all patches by default. default: false
|
||||||
|
|
||||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/inc/app"
|
apkmirror-dlurl = "https://www.apkmirror.com/apk/inc/app"
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ DEF_CLI_VER=$(toml_get "$main_config_t" cli-version) || DEF_CLI_VER="latest"
|
|||||||
DEF_PATCHES_SRC=$(toml_get "$main_config_t" patches-source) || DEF_PATCHES_SRC="ReVanced/revanced-patches"
|
DEF_PATCHES_SRC=$(toml_get "$main_config_t" patches-source) || DEF_PATCHES_SRC="ReVanced/revanced-patches"
|
||||||
DEF_CLI_SRC=$(toml_get "$main_config_t" cli-source) || DEF_CLI_SRC="ReVanced/revanced-cli"
|
DEF_CLI_SRC=$(toml_get "$main_config_t" cli-source) || DEF_CLI_SRC="ReVanced/revanced-cli"
|
||||||
DEF_RV_BRAND=$(toml_get "$main_config_t" rv-brand) || DEF_RV_BRAND="ReVanced"
|
DEF_RV_BRAND=$(toml_get "$main_config_t" rv-brand) || DEF_RV_BRAND="ReVanced"
|
||||||
DEF_DPI_LIST=$(toml_get "$main_config_t" dpi) || DEF_DPI_LIST="nodpi anydpi"
|
|
||||||
mkdir -p "$TEMP_DIR" "$BUILD_DIR"
|
mkdir -p "$TEMP_DIR" "$BUILD_DIR"
|
||||||
|
|
||||||
if [ "${2-}" = "--config-update" ]; then
|
if [ "${2-}" = "--config-update" ]; then
|
||||||
@@ -82,7 +81,7 @@ for table_name in $(toml_get_table_names); do
|
|||||||
epr "Could not get prebuilts"
|
epr "Could not get prebuilts"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
read -r cli_jar patches_jar <<<"$PREBUILTS"
|
read -r patches_jar cli_jar <<<"$PREBUILTS"
|
||||||
app_args[cli]=$cli_jar
|
app_args[cli]=$cli_jar
|
||||||
app_args[ptjar]=$patches_jar
|
app_args[ptjar]=$patches_jar
|
||||||
app_args[rv_brand]=$(toml_get "$t" rv-brand) || app_args[rv_brand]=$DEF_RV_BRAND
|
app_args[rv_brand]=$(toml_get "$t" rv-brand) || app_args[rv_brand]=$DEF_RV_BRAND
|
||||||
@@ -101,6 +100,11 @@ for table_name in $(toml_get_table_names); do
|
|||||||
abort "ERROR: build-mode '${app_args[build_mode]}' is not a valid option for '${table_name}': only 'both', 'apk' or 'module' is allowed"
|
abort "ERROR: build-mode '${app_args[build_mode]}' is not a valid option for '${table_name}': only 'both', 'apk' or 'module' is allowed"
|
||||||
fi
|
fi
|
||||||
} || app_args[build_mode]=apk
|
} || app_args[build_mode]=apk
|
||||||
|
app_args[include_stock]=$(toml_get "$t" include-stock) && {
|
||||||
|
if ! isoneof "${app_args[include_stock]}" disable merged split; then
|
||||||
|
abort "ERROR: include-stock '${app_args[include_stock]}' is not a valid option for '${table_name}': only 'disable', 'merged' or 'split' is allowed"
|
||||||
|
fi
|
||||||
|
} || app_args[include_stock]=merged
|
||||||
|
|
||||||
for dl_from in "${DL_SRCS[@]}"; do
|
for dl_from in "${DL_SRCS[@]}"; do
|
||||||
if app_args[${dl_from}_dlurl]=$(toml_get "$t" "${dl_from}-dlurl"); then
|
if app_args[${dl_from}_dlurl]=$(toml_get "$t" "${dl_from}-dlurl"); then
|
||||||
@@ -118,8 +122,8 @@ for table_name in $(toml_get_table_names); do
|
|||||||
abort "wrong arch '${app_args[arch]}' for '$table_name'"
|
abort "wrong arch '${app_args[arch]}' for '$table_name'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
app_args[include_stock]=$(toml_get "$t" include-stock) || app_args[include_stock]=true && vtf "${app_args[include_stock]}" "include-stock"
|
app_args[pkg_name]=$(toml_get "$t" pkg-name) || app_args[pkg_name]=""
|
||||||
app_args[dpi]=$(toml_get "$t" dpi) || app_args[dpi]="$DEF_DPI_LIST"
|
app_args[dpi]=$(toml_get "$t" dpi) || app_args[dpi]=""
|
||||||
table_name_f=${table_name,,}
|
table_name_f=${table_name,,}
|
||||||
table_name_f=${table_name_f// /-}
|
table_name_f=${table_name_f// /-}
|
||||||
app_args[module_prop_name]=$(toml_get "$t" module-prop-name) || app_args[module_prop_name]="${table_name_f}-jhc"
|
app_args[module_prop_name]=$(toml_get "$t" module-prop-name) || app_args[module_prop_name]="${table_name_f}-jhc"
|
||||||
@@ -151,11 +155,12 @@ for table_name in $(toml_get_table_names); do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
wait
|
wait
|
||||||
rm -rf temp/tmp.*
|
_clean_tmp
|
||||||
if [ -z "$(ls -A1 "${BUILD_DIR}")" ]; then abort "All builds failed."; fi
|
if [ -z "$(ls -A1 "${BUILD_DIR}")" ]; then abort "All builds failed."; fi
|
||||||
|
|
||||||
log "\nInstall [MicroG-RE](https://github.com/MorpheApp/MicroG-RE/releases) for non-root YouTube and YT Music APKs"
|
log "\nInstall [Microg](https://github.com/ReVanced/GmsCore/releases) for non-root YouTube and YT Music APKs"
|
||||||
log "Use [zygisk-detach](https://github.com/j-hc/zygisk-detach) to detach YouTube and YT Music modules from Play Store"
|
log "Use [zygisk-detach](https://github.com/j-hc/zygisk-detach) to detach YouTube and YT Music modules from Play Store"
|
||||||
|
log "\n[revanced-magisk-module](https://github.com/j-hc/revanced-magisk-module)\n"
|
||||||
log "$(cat "$TEMP_DIR"/*/changelog.md)"
|
log "$(cat "$TEMP_DIR"/*/changelog.md)"
|
||||||
|
|
||||||
SKIPPED=$(cat "$TEMP_DIR"/skipped 2>/dev/null || :)
|
SKIPPED=$(cat "$TEMP_DIR"/skipped 2>/dev/null || :)
|
||||||
|
|||||||
+24
-9
@@ -8,6 +8,7 @@ parallel-jobs = 1
|
|||||||
|
|
||||||
[YouTube]
|
[YouTube]
|
||||||
build-mode = "both"
|
build-mode = "both"
|
||||||
|
excluded-patches = "'Custom branding'"
|
||||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube"
|
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube"
|
||||||
uptodown-dlurl = "https://youtube.en.uptodown.com/android"
|
uptodown-dlurl = "https://youtube.en.uptodown.com/android"
|
||||||
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.youtube"
|
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.youtube"
|
||||||
@@ -18,6 +19,7 @@ patches-source = "MorpheApp/morphe-patches"
|
|||||||
cli-source = "MorpheApp/morphe-cli"
|
cli-source = "MorpheApp/morphe-cli"
|
||||||
rv-brand = "Morphe"
|
rv-brand = "Morphe"
|
||||||
build-mode = "both"
|
build-mode = "both"
|
||||||
|
excluded-patches = "'Custom branding'"
|
||||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube"
|
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube"
|
||||||
uptodown-dlurl = "https://youtube.en.uptodown.com/android"
|
uptodown-dlurl = "https://youtube.en.uptodown.com/android"
|
||||||
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.youtube"
|
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.youtube"
|
||||||
@@ -25,6 +27,7 @@ archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.y
|
|||||||
[Music]
|
[Music]
|
||||||
build-mode = "both"
|
build-mode = "both"
|
||||||
arch = "both"
|
arch = "both"
|
||||||
|
excluded-patches = "'Custom branding'"
|
||||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music"
|
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music"
|
||||||
uptodown-dlurl = "https://youtube-music.en.uptodown.com/android"
|
uptodown-dlurl = "https://youtube-music.en.uptodown.com/android"
|
||||||
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.apps.youtube.music"
|
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.apps.youtube.music"
|
||||||
@@ -36,6 +39,7 @@ cli-source = "MorpheApp/morphe-cli"
|
|||||||
rv-brand = "Morphe"
|
rv-brand = "Morphe"
|
||||||
build-mode = "both"
|
build-mode = "both"
|
||||||
arch = "both"
|
arch = "both"
|
||||||
|
excluded-patches = "'Custom branding'"
|
||||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music"
|
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/youtube-music"
|
||||||
uptodown-dlurl = "https://youtube-music.en.uptodown.com/android"
|
uptodown-dlurl = "https://youtube-music.en.uptodown.com/android"
|
||||||
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.apps.youtube.music"
|
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.apps.youtube.music"
|
||||||
@@ -43,23 +47,34 @@ archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.a
|
|||||||
[Reddit-Morphe]
|
[Reddit-Morphe]
|
||||||
app-name = "Reddit"
|
app-name = "Reddit"
|
||||||
rv-brand = "Morphe"
|
rv-brand = "Morphe"
|
||||||
build-mode = "both"
|
build-mode = "apk"
|
||||||
patches-source = "MorpheApp/morphe-patches"
|
patches-source = "MorpheApp/morphe-patches"
|
||||||
cli-source = "MorpheApp/morphe-cli"
|
cli-source = "MorpheApp/morphe-cli"
|
||||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/redditinc/reddit/"
|
apkmirror-dlurl = "https://www.apkmirror.com/apk/redditinc/reddit/"
|
||||||
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.reddit.frontpage"
|
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.reddit.frontpage"
|
||||||
uptodown-dlurl = "https://reddit-official-app.en.uptodown.com/android"
|
uptodown-dlurl = "https://reddit-official-app.en.uptodown.com/android"
|
||||||
|
excluded-patches = "'Custom branding name for Reddit'"
|
||||||
dpi = "120-640dpi"
|
dpi = "120-640dpi"
|
||||||
|
|
||||||
|
[Twitter]
|
||||||
|
enabled = false
|
||||||
|
patches-source = "crimera/piko"
|
||||||
|
cli-source = "MorpheApp/morphe-cli"
|
||||||
|
rv-brand = "Piko"
|
||||||
|
apkmirror-dlurl = "https://www.apkmirror.com/apk/x-corp/twitter/"
|
||||||
|
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.twitter.android"
|
||||||
|
build-mode = "module"
|
||||||
|
version = "11.81.0-release.0"
|
||||||
|
include-stock = "split"
|
||||||
|
|
||||||
|
[GooglePhotos]
|
||||||
|
build-mode = "both"
|
||||||
|
arch = "both"
|
||||||
|
apkmirror-dlurl = "https://www.apkmirror.com/apk/google-inc/photos/"
|
||||||
|
uptodown-dlurl = "https://google-photos.en.uptodown.com/android"
|
||||||
|
archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.google.android.apps.photos"
|
||||||
|
|
||||||
[Twitch]
|
[Twitch]
|
||||||
enabled = false
|
enabled = false
|
||||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/twitch-interactive-inc/twitch/"
|
apkmirror-dlurl = "https://www.apkmirror.com/apk/twitch-interactive-inc/twitch/"
|
||||||
uptodown-dlurl = "https://twitch.en.uptodown.com/android"
|
uptodown-dlurl = "https://twitch.en.uptodown.com/android"
|
||||||
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/tv.twitch.android.app"
|
|
||||||
|
|
||||||
[Twitter]
|
|
||||||
enabled = false
|
|
||||||
apkmirror-dlurl = "https://www.apkmirror.com/apk/x-corp/twitter"
|
|
||||||
build-mode = "apk"
|
|
||||||
dpi = "120-640dpi"
|
|
||||||
# archive-dlurl = "https://archive.org/download/jhc-apks/apks/com.twitter.android"
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
libs
|
|
||||||
obj
|
|
||||||
*.mk
|
|
||||||
@@ -1,128 +0,0 @@
|
|||||||
#include <errno.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <sys/syscall.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#define KSU_INSTALL_MAGIC1 0xDEADBEEF
|
|
||||||
#define KSU_INSTALL_MAGIC2 0xCAFEBABE
|
|
||||||
|
|
||||||
#define KSU_APP_PROFILE_VER 2
|
|
||||||
#define KSU_MAX_PACKAGE_NAME 256
|
|
||||||
#define KSU_MAX_GROUPS 32
|
|
||||||
#define KSU_SELINUX_DOMAIN 64
|
|
||||||
|
|
||||||
#define KSU_IOCTL_MAGIC 'K'
|
|
||||||
#define KSU_IOCTL_UID_SHOULD_UMOUNT _IOC(_IOC_READ | _IOC_WRITE, KSU_IOCTL_MAGIC, 9, 0)
|
|
||||||
#define KSU_IOCTL_GET_MANAGER_APPID _IOC(_IOC_READ, KSU_IOCTL_MAGIC, 10, 0)
|
|
||||||
#define KSU_IOCTL_GET_APP_PROFILE _IOC(_IOC_READ | _IOC_WRITE, KSU_IOCTL_MAGIC, 11, 0)
|
|
||||||
#define KSU_IOCTL_SET_APP_PROFILE _IOC(_IOC_WRITE, KSU_IOCTL_MAGIC, 12, 0)
|
|
||||||
|
|
||||||
struct root_profile {
|
|
||||||
int32_t uid;
|
|
||||||
int32_t gid;
|
|
||||||
int32_t groups_count;
|
|
||||||
int32_t groups[KSU_MAX_GROUPS];
|
|
||||||
|
|
||||||
struct {
|
|
||||||
uint64_t effective;
|
|
||||||
uint64_t permitted;
|
|
||||||
uint64_t inheritable;
|
|
||||||
} capabilities;
|
|
||||||
|
|
||||||
char selinux_domain[KSU_SELINUX_DOMAIN];
|
|
||||||
int32_t namespaces;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct non_root_profile {
|
|
||||||
bool umount_modules;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct app_profile {
|
|
||||||
uint32_t version;
|
|
||||||
char key[KSU_MAX_PACKAGE_NAME];
|
|
||||||
int32_t current_uid;
|
|
||||||
bool allow_su;
|
|
||||||
union {
|
|
||||||
struct {
|
|
||||||
bool use_default;
|
|
||||||
char template_name[KSU_MAX_PACKAGE_NAME];
|
|
||||||
struct root_profile profile;
|
|
||||||
} rp_config;
|
|
||||||
struct {
|
|
||||||
bool use_default;
|
|
||||||
struct non_root_profile profile;
|
|
||||||
} nrp_config;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ksu_uid_should_umount_cmd {
|
|
||||||
uint32_t uid;
|
|
||||||
uint8_t should_umount;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ksu_get_manager_appid_cmd {
|
|
||||||
uint32_t appid;
|
|
||||||
};
|
|
||||||
|
|
||||||
static int _fd = -1;
|
|
||||||
#define ksuctl(op, ...) (ioctl(_fd, op, __VA_ARGS__) >= 0)
|
|
||||||
|
|
||||||
#define REPORT_ERR() fprintf(stderr, "%s:%d ERROR: %s\n", __FILE__, __LINE__, strerror(errno));
|
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
|
||||||
if (argc <= 2) {
|
|
||||||
fprintf(stderr,
|
|
||||||
"ksu_profile (github.com/j-hc)\n"
|
|
||||||
"Disables \"Unmount modules\" for given package\n"
|
|
||||||
" Usage: %s <pkg uid> <pkg name>\n",
|
|
||||||
argv[0]);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
syscall(SYS_reboot, KSU_INSTALL_MAGIC1, KSU_INSTALL_MAGIC2, 0, &_fd);
|
|
||||||
if (_fd == -1) {
|
|
||||||
REPORT_ERR();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
long uid = atol(argv[1]);
|
|
||||||
|
|
||||||
struct ksu_uid_should_umount_cmd umount_cmd = {0};
|
|
||||||
if (!ksuctl(KSU_IOCTL_UID_SHOULD_UMOUNT, &umount_cmd)) {
|
|
||||||
REPORT_ERR();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (!umount_cmd.should_umount) return 0;
|
|
||||||
|
|
||||||
struct ksu_get_manager_appid_cmd appid_cmd = {0};
|
|
||||||
if (!ksuctl(KSU_IOCTL_GET_MANAGER_APPID, &appid_cmd)) {
|
|
||||||
REPORT_ERR();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (setuid(appid_cmd.appid) != 0) {
|
|
||||||
REPORT_ERR();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
struct app_profile profile = {0};
|
|
||||||
profile.current_uid = uid;
|
|
||||||
if (!ksuctl(KSU_IOCTL_GET_APP_PROFILE, &profile)) {
|
|
||||||
printf("Create profile for %s\n", argv[2]);
|
|
||||||
profile.version = KSU_APP_PROFILE_VER;
|
|
||||||
strncpy(profile.key, argv[2], sizeof(profile.key) / sizeof(profile.key[0]));
|
|
||||||
}
|
|
||||||
|
|
||||||
profile.nrp_config.use_default = false;
|
|
||||||
profile.nrp_config.profile.umount_modules = false;
|
|
||||||
|
|
||||||
if (!ksuctl(KSU_IOCTL_SET_APP_PROFILE, &profile)) {
|
|
||||||
REPORT_ERR();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Regular → Executable
Regular → Executable
Executable
+23
@@ -0,0 +1,23 @@
|
|||||||
|
#!/system/bin/sh
|
||||||
|
MODDIR=${0%/*}
|
||||||
|
. "$MODDIR/utils.sh"
|
||||||
|
|
||||||
|
DFILE="$MODDIR/disabled_by_action"
|
||||||
|
|
||||||
|
if [ -z "$(get_mounts)" ]; then
|
||||||
|
rm -f "$DFILE"
|
||||||
|
if mount_nosleep; then
|
||||||
|
echo "* Enabled successfully"
|
||||||
|
cp -f "$MODDIR/module.prop.orig" "$MODDIR/module.prop"
|
||||||
|
else
|
||||||
|
echo "* Failed"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
get_mounts
|
||||||
|
else
|
||||||
|
touch "$DFILE"
|
||||||
|
umount_all
|
||||||
|
echo "* Disabled"
|
||||||
|
|
||||||
|
ch_desc "⛔ Disabled by action"
|
||||||
|
fi
|
||||||
Regular → Executable
BIN
Binary file not shown.
Regular → Executable
BIN
Binary file not shown.
Regular → Executable
BIN
Binary file not shown.
Regular → Executable
BIN
Binary file not shown.
Regular → Executable
+82
-103
@@ -1,4 +1,6 @@
|
|||||||
. "$MODPATH/config"
|
#!/system/bin/sh
|
||||||
|
MODDIR=$MODPATH
|
||||||
|
. "$MODPATH/utils.sh"
|
||||||
|
|
||||||
ui_print ""
|
ui_print ""
|
||||||
if [ -n "$MODULE_ARCH" ] && [ "$MODULE_ARCH" != "$ARCH" ]; then
|
if [ -n "$MODULE_ARCH" ] && [ "$MODULE_ARCH" != "$ARCH" ]; then
|
||||||
@@ -15,127 +17,106 @@ elif [ "$ARCH" = "x86" ]; then
|
|||||||
elif [ "$ARCH" = "x64" ]; then
|
elif [ "$ARCH" = "x64" ]; then
|
||||||
ARCH_LIB=x86_64
|
ARCH_LIB=x86_64
|
||||||
else abort "ERROR: unreachable: ${ARCH}"; fi
|
else abort "ERROR: unreachable: ${ARCH}"; fi
|
||||||
RVPATH=/data/adb/rvhc/${MODPATH##*/}.apk
|
|
||||||
|
|
||||||
set_perm_recursive "$MODPATH/bin" 0 0 0755 0777
|
set_perm_recursive "$MODPATH/bin" 0 0 0755 0777
|
||||||
|
|
||||||
if su -M -c true >/dev/null 2>/dev/null; then
|
umount_all
|
||||||
alias mm='su -M -c'
|
|
||||||
else alias mm='nsenter -t1 -m'; fi
|
|
||||||
|
|
||||||
mm grep -F "$PKG_NAME" /proc/mounts | while read -r line; do
|
if OP=$(dumpsys package "$PKG_NAME") && [ "$OP" ]; then
|
||||||
ui_print "* Un-mount"
|
if echo "$OP" | grep -m1 pkgFlags | grep -Fq UPDATED_SYSTEM_APP; then
|
||||||
mp=${line#* } mp=${mp%% *}
|
pmex uninstall-system-updates "$PKG_NAME" >/dev/null 2>&1
|
||||||
mm umount -l "${mp%%\\*}"
|
fi
|
||||||
done
|
else
|
||||||
am force-stop "$PKG_NAME"
|
if pmex install-existing "$PKG_NAME" >/dev/null 2>&1; then
|
||||||
|
pmex uninstall-system-updates "$PKG_NAME" >/dev/null 2>&1
|
||||||
pmex() {
|
|
||||||
OP=$(pm "$@" 2>&1 </dev/null)
|
|
||||||
RET=$?
|
|
||||||
echo "$OP"
|
|
||||||
return $RET
|
|
||||||
}
|
|
||||||
|
|
||||||
if ! pmex path "$PKG_NAME" >&2; then
|
|
||||||
if pmex install-existing "$PKG_NAME" >&2; then
|
|
||||||
pmex uninstall-system-updates "$PKG_NAME"
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
IS_SYS=false
|
|
||||||
INS=true
|
INS=true
|
||||||
if BASEPATH=$(pmex path "$PKG_NAME"); then
|
if BASEPATH=$(get_basepath); then
|
||||||
echo >&2 "'$BASEPATH'"
|
|
||||||
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
|
|
||||||
if [ "${BASEPATH:1:4}" != data ]; then
|
if [ "${BASEPATH:1:4}" != data ]; then
|
||||||
ui_print "* $PKG_NAME is a system app."
|
ui_print "* Detected $PKG_NAME as a system app"
|
||||||
IS_SYS=true
|
SCNM="/data/adb/post-fs-data.d/$PKG_NAME-uninstall.sh"
|
||||||
elif [ ! -f "$MODPATH/$PKG_NAME.apk" ]; then
|
mkdir -p /data/adb/post-fs-data.d
|
||||||
ui_print "* Stock $PKG_NAME APK was not found"
|
echo "mount -t tmpfs none $BASEPATH" >"$SCNM"
|
||||||
VERSION=$(dumpsys package "$PKG_NAME" 2>&1 | grep -m1 versionName) VERSION="${VERSION#*=}"
|
chmod +x "$SCNM"
|
||||||
if [ "$VERSION" = "$PKG_VER" ] || [ -z "$VERSION" ]; then
|
ui_print "* Created the uninstall script."
|
||||||
ui_print "* Skipping stock installation"
|
ui_print ""
|
||||||
INS=false
|
ui_print "* Reboot and reflash the module!"
|
||||||
else
|
abort
|
||||||
abort "ERROR: Version mismatch
|
|
||||||
installed: $VERSION
|
|
||||||
module: $PKG_VER
|
|
||||||
"
|
|
||||||
fi
|
|
||||||
elif "${MODPATH:?}/bin/$ARCH/cmpr" "$BASEPATH/base.apk" "$MODPATH/$PKG_NAME.apk"; then
|
|
||||||
ui_print "* $PKG_NAME is up-to-date"
|
|
||||||
INS=false
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
VERSION=$(get_app_version)
|
||||||
|
if [ "$VERSION" ] && [ "$VERSION" = "$PKG_VER" ]; then
|
||||||
|
ui_print "* $PKG_NAME is up-to-date ($VERSION)"
|
||||||
|
INS=false
|
||||||
|
elif [ ! -f "$MODPATH/stock/base.apk" ]; then
|
||||||
|
ui_print "ERROR: Version mismatch
|
||||||
|
installed: '$VERSION'
|
||||||
|
module: '$PKG_VER'"
|
||||||
|
abort
|
||||||
|
fi
|
||||||
|
|
||||||
|
# TODO:
|
||||||
|
# elif "${MODPATH:?}/bin/$ARCH/cmpr" "$BASEPATH/base.apk" "$MODPATH/$PKG_NAME.apk"; then
|
||||||
|
# ui_print "* $PKG_NAME is up-to-date"
|
||||||
|
# INS=false
|
||||||
|
# fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
install() {
|
install() {
|
||||||
if [ ! -f "$MODPATH/$PKG_NAME.apk" ]; then
|
if [ ! -f "$MODPATH/stock/base.apk" ]; then
|
||||||
abort "ERROR: Stock $PKG_NAME apk was not found"
|
abort "ERROR: Stock $PKG_NAME apk was not found"
|
||||||
fi
|
fi
|
||||||
ui_print "* Updating $PKG_NAME to $PKG_VER"
|
|
||||||
install_err=""
|
install_err=""
|
||||||
VERIF1=$(settings get global verifier_verify_adb_installs)
|
VERIF1=$(settings get global verifier_verify_adb_installs)
|
||||||
VERIF2=$(settings get global package_verifier_enable)
|
VERIF2=$(settings get global package_verifier_enable)
|
||||||
settings put global verifier_verify_adb_installs 0
|
settings put global verifier_verify_adb_installs 0
|
||||||
settings put global package_verifier_enable 0
|
settings put global package_verifier_enable 0
|
||||||
SZ=$(stat -c "%s" "$MODPATH/$PKG_NAME.apk")
|
|
||||||
|
SZ=$(stat -c "%s" "$MODPATH"/stock/*.apk | awk '{sum += $0} END {print sum}')
|
||||||
for IT in 1 2; do
|
for IT in 1 2; do
|
||||||
if ! SES=$(pmex install-create --user 0 -i com.android.vending -r -d -S "$SZ"); then
|
ui_print "* Updating $PKG_NAME to $PKG_VER"
|
||||||
|
if ! SES=$(pmex install-create --user 0 -i com.android.vending -r -S "$SZ"); then
|
||||||
ui_print "ERROR: install-create failed"
|
ui_print "ERROR: install-create failed"
|
||||||
install_err="$SES"
|
install_err="$SES"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
SES=${SES#*[} SES=${SES%]*}
|
SES=${SES#*[} SES=${SES%]*}
|
||||||
set_perm "$MODPATH/$PKG_NAME.apk" 1000 1000 644 u:object_r:apk_data_file:s0
|
|
||||||
if ! op=$(pmex install-write -S "$SZ" "$SES" "$PKG_NAME.apk" "$MODPATH/$PKG_NAME.apk"); then
|
for apki in "$MODPATH/stock"/*.apk; do
|
||||||
ui_print "ERROR: install-write failed"
|
set_perm "${apki}" 1000 1000 644 u:object_r:apk_data_file:s0
|
||||||
install_err="$op"
|
if ! op=$(pmex install-write -S "$SZ" "$SES" "$(basename "${apki}")" "${apki}"); then
|
||||||
break
|
ui_print "ERROR: install-write failed"
|
||||||
fi
|
install_err="$op"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ "$install_err" ]; then break; fi
|
||||||
|
|
||||||
if ! op=$(pmex install-commit "$SES"); then
|
if ! op=$(pmex install-commit "$SES"); then
|
||||||
ui_print "$op"
|
ui_print "$op"
|
||||||
if echo "$op" | grep -q -e INSTALL_FAILED_VERSION_DOWNGRADE -e INSTALL_FAILED_UPDATE_INCOMPATIBLE; then
|
if echo "$op" | grep -q -e INSTALL_FAILED_VERSION_DOWNGRADE -e INSTALL_FAILED_UPDATE_INCOMPATIBLE -e INSTALL_FAILED_DUPLICATE; then
|
||||||
ui_print "* Handling install error"
|
ui_print "* Uninstalling..."
|
||||||
pmex uninstall-system-updates "$PKG_NAME"
|
ex_unins_arg=""
|
||||||
if BASEPATH=$(pmex path "$PKG_NAME"); then
|
if echo "$op" | grep -q INSTALL_FAILED_DUPLICATE; then
|
||||||
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
|
ex_unins_arg="-k"
|
||||||
if [ "${BASEPATH:1:4}" != data ]; then IS_SYS=true; fi
|
|
||||||
fi
|
fi
|
||||||
if [ "$IS_SYS" = true ]; then
|
if ! op=$(pmex uninstall --user 0 $ex_unins_arg "$PKG_NAME"); then
|
||||||
SCNM="/data/adb/post-fs-data.d/$PKG_NAME-uninstall.sh"
|
ui_print "$op"
|
||||||
if [ -f "$SCNM" ]; then
|
if [ $IT = 2 ]; then
|
||||||
ui_print "* Remove the old module. Reboot and reflash!"
|
install_err="ERROR: pm uninstall failed."
|
||||||
ui_print ""
|
|
||||||
install_err=" "
|
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
mkdir -p /data/adb/rvhc/empty /data/adb/post-fs-data.d
|
|
||||||
echo "mount -o bind /data/adb/rvhc/empty $BASEPATH" >"$SCNM"
|
|
||||||
chmod +x "$SCNM"
|
|
||||||
ui_print "* Created the uninstall script."
|
|
||||||
ui_print ""
|
|
||||||
ui_print "* Reboot and reflash the module!"
|
|
||||||
install_err=" "
|
|
||||||
break
|
|
||||||
else
|
|
||||||
ui_print "* Uninstalling..."
|
|
||||||
if ! op=$(pmex uninstall -k --user 0 "$PKG_NAME"); then
|
|
||||||
ui_print "$op"
|
|
||||||
if [ $IT = 2 ]; then
|
|
||||||
install_err="ERROR: pm uninstall failed."
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
continue
|
|
||||||
fi
|
fi
|
||||||
|
continue
|
||||||
fi
|
fi
|
||||||
ui_print "ERROR: install-commit failed"
|
ui_print "ERROR: install-commit failed"
|
||||||
install_err="$op"
|
install_err="$op"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
if BASEPATH=$(pmex path "$PKG_NAME"); then
|
if BASEPATH=$(get_basepath); then
|
||||||
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
|
:
|
||||||
else
|
else
|
||||||
install_err=" "
|
install_err=" "
|
||||||
break
|
break
|
||||||
@@ -145,8 +126,7 @@ install() {
|
|||||||
settings put global verifier_verify_adb_installs "$VERIF1"
|
settings put global verifier_verify_adb_installs "$VERIF1"
|
||||||
settings put global package_verifier_enable "$VERIF2"
|
settings put global package_verifier_enable "$VERIF2"
|
||||||
if [ "$install_err" ]; then
|
if [ "$install_err" ]; then
|
||||||
ui_print "$install_err"
|
abort "$install_err"
|
||||||
abort "ERROR: disable the module, reboot, install $PKG_NAME manually and reflash again"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
if [ $INS = true ] && ! install; then abort; fi
|
if [ $INS = true ] && ! install; then abort; fi
|
||||||
@@ -154,52 +134,51 @@ BASEPATHLIB=${BASEPATH}/lib/${ARCH}
|
|||||||
if [ $INS = true ] || [ -z "$(ls -A1 "$BASEPATHLIB")" ]; then
|
if [ $INS = true ] || [ -z "$(ls -A1 "$BASEPATHLIB")" ]; then
|
||||||
ui_print "* Extracting native libs"
|
ui_print "* Extracting native libs"
|
||||||
if [ ! -d "$BASEPATHLIB" ]; then mkdir -p "$BASEPATHLIB"; else rm -f "$BASEPATHLIB"/* >/dev/null 2>&1 || :; fi
|
if [ ! -d "$BASEPATHLIB" ]; then mkdir -p "$BASEPATHLIB"; else rm -f "$BASEPATHLIB"/* >/dev/null 2>&1 || :; fi
|
||||||
if ! op=$(unzip -o -j "$MODPATH/$PKG_NAME.apk" "lib/${ARCH_LIB}/*" -d "$BASEPATHLIB" 2>&1); then
|
if op=$(unzip -o -j "$MODPATH/stock/base.apk" "lib/${ARCH_LIB}/*" -d "$BASEPATHLIB" 2>&1); then
|
||||||
ui_print "ERROR: extracting native libs failed"
|
set_perm_recursive "${BASEPATH}/lib" 1000 1000 755 755 u:object_r:apk_data_file:s0
|
||||||
abort "$op"
|
else
|
||||||
|
echo >&2 "ERROR: extracting native libs failed: '$op'"
|
||||||
fi
|
fi
|
||||||
set_perm_recursive "${BASEPATH}/lib" 1000 1000 755 755 u:object_r:apk_data_file:s0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ui_print "* Setting Permissions"
|
|
||||||
set_perm "$MODPATH/base.apk" 1000 1000 644 u:object_r:apk_data_file:s0
|
set_perm "$MODPATH/base.apk" 1000 1000 644 u:object_r:apk_data_file:s0
|
||||||
|
|
||||||
ui_print "* Mounting $PKG_NAME"
|
ui_print "* Mounting $PKG_NAME"
|
||||||
|
# move out the apk from /data/adb/modules/.. to /data/adb/rvhc to not trip some root detections
|
||||||
mkdir -p "/data/adb/rvhc"
|
mkdir -p "/data/adb/rvhc"
|
||||||
RVPATH=/data/adb/rvhc/${MODPATH##*/}.apk
|
|
||||||
mv -f "$MODPATH/base.apk" "$RVPATH"
|
mv -f "$MODPATH/base.apk" "$RVPATH"
|
||||||
|
|
||||||
if ! op=$(mm 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 "ERROR: Mount failed!"
|
||||||
ui_print "$op"
|
ui_print "$op"
|
||||||
fi
|
fi
|
||||||
am force-stop "$PKG_NAME"
|
am force-stop "$PKG_NAME"
|
||||||
ui_print "* Optimizing $PKG_NAME"
|
|
||||||
|
|
||||||
cmd package compile -m speed-profile -f "$PKG_NAME"
|
ui_print "* Optimizing $PKG_NAME"
|
||||||
|
cmd package compile -m speed-profile -f "$PKG_NAME" >/dev/null 2>&1
|
||||||
# nohup cmd package compile -m speed-profile -f "$PKG_NAME" >/dev/null 2>&1
|
# nohup cmd package compile -m speed-profile -f "$PKG_NAME" >/dev/null 2>&1
|
||||||
|
|
||||||
if [ "$KSU" ]; then
|
if [ "$KSU" ]; then
|
||||||
UID=$(dumpsys package "$PKG_NAME" 2>&1 | grep -m1 uid)
|
DUMPSYS=$(dumpsys package "$PKG_NAME" 2>&1)
|
||||||
|
UID=$(echo "$DUMPSYS" | grep -m1 uid=)
|
||||||
UID=${UID#*=} UID=${UID%% *}
|
UID=${UID#*=} UID=${UID%% *}
|
||||||
if [ -z "$UID" ]; then
|
if [ -z "$UID" ]; then
|
||||||
UID=$(dumpsys package "$PKG_NAME" 2>&1 | grep -m1 userId)
|
UID=$(echo "$DUMPSYS" | grep -m1 userId=)
|
||||||
UID=${UID#*=} UID=${UID%% *}
|
UID=${UID#*=} UID=${UID%% *}
|
||||||
fi
|
fi
|
||||||
if [ "$UID" ]; then
|
if [ "$UID" ]; then
|
||||||
if ! OP=$("${MODPATH:?}/bin/$ARCH/ksu_profile" "$UID" "$PKG_NAME" 2>&1); then
|
if ! OP=$("${MODPATH:?}/bin/$ARCH/ksu_profile" "$UID" "$PKG_NAME" 2>&1); then
|
||||||
ui_print " $OP"
|
ui_print " $OP"
|
||||||
ui_print "* Because you are using a fork of KernelSU, "
|
ui_print " * In your root manager app,"
|
||||||
ui_print " you need to go to your root manager app and"
|
ui_print " disable 'Unmount modules' for $PKG_NAME"
|
||||||
ui_print " disable 'Unmount modules' option for $PKG_NAME"
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
ui_print "ERROR: UID could not be found for $PKG_NAME"
|
ui_print "ERROR: UID could not be found for $PKG_NAME"
|
||||||
dumpsys package "$PKG_NAME" >&2
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf "${MODPATH:?}/bin" "$MODPATH/$PKG_NAME.apk"
|
rm -rf "${MODPATH:?}/bin" "$MODPATH/stock/"
|
||||||
|
cp -f "$MODPATH/module.prop" "$MODPATH/module.prop.orig"
|
||||||
|
|
||||||
ui_print "* Done"
|
ui_print "* Done"
|
||||||
ui_print " by j-hc (github.com/j-hc)"
|
ui_print " by j-hc (github.com/j-hc)"
|
||||||
|
|||||||
Regular → Executable
+15
-38
@@ -1,49 +1,26 @@
|
|||||||
#!/system/bin/sh
|
#!/system/bin/sh
|
||||||
MODDIR=${0%/*}
|
MODDIR=${0%/*}
|
||||||
RVPATH=/data/adb/rvhc/${MODDIR##*/}.apk
|
. "$MODDIR/utils.sh"
|
||||||
. "$MODDIR/config"
|
|
||||||
|
|
||||||
err() {
|
|
||||||
[ ! -f "$MODDIR/err" ] && cp "$MODDIR/module.prop" "$MODDIR/err"
|
|
||||||
sed -i "s/^des.*/description=⚠️ Needs reflash: '${1}'/g" "$MODDIR/module.prop"
|
|
||||||
}
|
|
||||||
|
|
||||||
until [ "$(getprop sys.boot_completed)" = 1 ]; do sleep 1; done
|
|
||||||
until [ -d "/sdcard/Android" ]; do sleep 1; done
|
|
||||||
while
|
|
||||||
BASEPATH=$(pm path "$PKG_NAME" 2>&1 </dev/null)
|
|
||||||
SVCL=$?
|
|
||||||
[ $SVCL = 20 ]
|
|
||||||
do sleep 2; done
|
|
||||||
|
|
||||||
run() {
|
run() {
|
||||||
|
until [ "$(getprop sys.boot_completed)" = 1 ]; do sleep 1; done
|
||||||
|
until [ -d "/sdcard/Android" ]; do sleep 1; done
|
||||||
|
|
||||||
|
while
|
||||||
|
BASEPATH=$(get_basepath)
|
||||||
|
SVCL=$?
|
||||||
|
[ $SVCL = 20 ]
|
||||||
|
do sleep 2; done
|
||||||
|
|
||||||
if [ $SVCL != 0 ]; then
|
if [ $SVCL != 0 ]; then
|
||||||
err "app not installed"
|
ch_desc_err "App not installed"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
sleep 4
|
sleep 4
|
||||||
|
|
||||||
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
|
mount_rv "$BASEPATH"
|
||||||
if [ ! -d "$BASEPATH/lib" ]; then
|
|
||||||
err "mount failed (ROM issue). Dont report this, consider using rvmm-zygisk-mount."
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
VERSION=$(dumpsys package "$PKG_NAME" 2>&1 | grep -m1 versionName) VERSION="${VERSION#*=}"
|
|
||||||
if [ "$VERSION" != "$PKG_VER" ] && [ "$VERSION" ]; then
|
|
||||||
err "version mismatch (installed:${VERSION}, module:$PKG_VER)"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
grep "$PKG_NAME" /proc/mounts | while read -r line; do
|
|
||||||
mp=${line#* } mp=${mp%% *}
|
|
||||||
umount -l "${mp%%\\*}"
|
|
||||||
done
|
|
||||||
if ! chcon u:object_r:apk_data_file:s0 "$RVPATH"; then
|
|
||||||
err "apk not found"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
mount -o bind "$RVPATH" "$BASEPATH/base.apk"
|
|
||||||
am force-stop "$PKG_NAME"
|
|
||||||
[ -f "$MODDIR/err" ] && mv -f "$MODDIR/err" "$MODDIR/module.prop"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
run
|
if [ ! -f "$MODDIR/disabled_by_action" ]; then
|
||||||
|
run
|
||||||
|
fi
|
||||||
|
|||||||
Regular → Executable
+5
-9
@@ -1,13 +1,9 @@
|
|||||||
#!/system/bin/sh
|
#!/system/bin/sh
|
||||||
{
|
|
||||||
|
|
||||||
until [ "$(getprop sys.boot_completed)" = 1 ]; do sleep 1; done
|
MODDIR=${0%/*}
|
||||||
until [ -d "/sdcard/Android" ]; do sleep 1; done
|
. "$MODDIR/config"
|
||||||
|
|
||||||
MODDIR=${0%/*}
|
rm -f "/data/adb/rvhc/${MODDIR##*/}.apk"
|
||||||
. "$MODDIR/config"
|
rmdir "/data/adb/rvhc"
|
||||||
|
|
||||||
rm "/data/adb/rvhc/${MODDIR##*/}.apk"
|
rm -f "/data/adb/post-fs-data.d/$PKG_NAME-uninstall.sh"
|
||||||
rmdir "/data/adb/rvhc"
|
|
||||||
rm "/data/adb/post-fs-data.d/$PKG_NAME-uninstall.sh"
|
|
||||||
} &
|
|
||||||
|
|||||||
Executable
+74
@@ -0,0 +1,74 @@
|
|||||||
|
#!/system/bin/sh
|
||||||
|
|
||||||
|
RVPATH=/data/adb/rvhc/${MODDIR##*/}.apk
|
||||||
|
. "$MODDIR/config"
|
||||||
|
|
||||||
|
ch_desc() {
|
||||||
|
sed -i "s/^des.*/description=${1}/g" "$MODDIR/module.prop"
|
||||||
|
}
|
||||||
|
|
||||||
|
ch_desc_err() {
|
||||||
|
ch_desc "⚠️ Needs reflash: '${1}'"
|
||||||
|
}
|
||||||
|
|
||||||
|
pmex() {
|
||||||
|
OP=$(pm "$@" 2>&1 </dev/null)
|
||||||
|
RET=$?
|
||||||
|
echo "$OP"
|
||||||
|
return $RET
|
||||||
|
}
|
||||||
|
|
||||||
|
get_app_version() {
|
||||||
|
VERSION=$(dumpsys package "$PKG_NAME" 2>&1 | grep -m1 versionName=) VERSION="${VERSION#*=}"
|
||||||
|
echo "$VERSION"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_basepath() {
|
||||||
|
BASEPATH=$(pmex path "$PKG_NAME")
|
||||||
|
SVCL=$?
|
||||||
|
|
||||||
|
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
|
||||||
|
echo "$BASEPATH"
|
||||||
|
return $SVCL
|
||||||
|
}
|
||||||
|
|
||||||
|
umount_all() {
|
||||||
|
su -M -c grep -F "$PKG_NAME" /proc/mounts | while read -r line; do
|
||||||
|
mp=${line#* } mp=${mp%% *} mp=${mp%%\\*}
|
||||||
|
su -M -c umount -l "${mp}"
|
||||||
|
done
|
||||||
|
am force-stop "$PKG_NAME" || :
|
||||||
|
}
|
||||||
|
|
||||||
|
get_mounts() {
|
||||||
|
su -M -c grep -F "$PKG_NAME" /proc/mounts || :
|
||||||
|
}
|
||||||
|
|
||||||
|
mount_rv() {
|
||||||
|
if [ ! -d "${1}/lib" ]; then
|
||||||
|
ch_desc_err "Mount failed. Dont report this, consider using rvmm-zygisk-mount"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
VERSION=$(get_app_version)
|
||||||
|
if [ "$VERSION" != "$PKG_VER" ] && [ "$VERSION" ]; then
|
||||||
|
ch_desc_err "Version mismatch (installed:${VERSION}, module:$PKG_VER)"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
umount_all
|
||||||
|
if ! chcon u:object_r:apk_data_file:s0 "$RVPATH"; then
|
||||||
|
ch_desc_err "Apk not found"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
mount -o bind "$RVPATH" "${1}/base.apk"
|
||||||
|
am force-stop "$PKG_NAME"
|
||||||
|
cp -f "$MODDIR/module.prop.orig" "$MODDIR/module.prop"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
mount_nosleep() {
|
||||||
|
if ! BASEPATH=$(get_basepath); then
|
||||||
|
ch_desc_err "App not installed"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
mount_rv "$BASEPATH"
|
||||||
|
}
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
#!/sbin/sh
|
|
||||||
|
|
||||||
#################
|
|
||||||
# Initialization
|
|
||||||
#################
|
|
||||||
|
|
||||||
umask 022
|
|
||||||
|
|
||||||
# echo before loading util_functions
|
|
||||||
ui_print() { echo "$1"; }
|
|
||||||
|
|
||||||
require_new_magisk() {
|
|
||||||
ui_print "*******************************"
|
|
||||||
ui_print " Please install Magisk v20.4+! "
|
|
||||||
ui_print "*******************************"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
#########################
|
|
||||||
# Load util_functions.sh
|
|
||||||
#########################
|
|
||||||
|
|
||||||
OUTFD=$2
|
|
||||||
ZIPFILE=$3
|
|
||||||
|
|
||||||
mount /data 2>/dev/null
|
|
||||||
|
|
||||||
[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk
|
|
||||||
. /data/adb/magisk/util_functions.sh
|
|
||||||
[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk
|
|
||||||
|
|
||||||
install_module
|
|
||||||
exit 0
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
#MAGISK
|
|
||||||
@@ -1,185 +0,0 @@
|
|||||||
. "$MODPATH/config"
|
|
||||||
|
|
||||||
ui_print ""
|
|
||||||
if [ -n "$MODULE_ARCH" ] && [ "$MODULE_ARCH" != "$ARCH" ]; then
|
|
||||||
abort "ERROR: Wrong arch
|
|
||||||
Your device: $ARCH
|
|
||||||
Module: $MODULE_ARCH"
|
|
||||||
fi
|
|
||||||
if [ "$ARCH" = "arm" ]; then
|
|
||||||
ARCH_LIB=armeabi-v7a
|
|
||||||
elif [ "$ARCH" = "arm64" ]; then
|
|
||||||
ARCH_LIB=arm64-v8a
|
|
||||||
elif [ "$ARCH" = "x86" ]; then
|
|
||||||
ARCH_LIB=x86
|
|
||||||
elif [ "$ARCH" = "x64" ]; then
|
|
||||||
ARCH_LIB=x86_64
|
|
||||||
else abort "ERROR: unreachable: ${ARCH}"; fi
|
|
||||||
RVPATH=/data/adb/rvhc/${MODPATH##*/}.apk
|
|
||||||
|
|
||||||
set_perm_recursive "$MODPATH/bin" 0 0 0755 0777
|
|
||||||
|
|
||||||
if su -M -c true >/dev/null 2>/dev/null; then
|
|
||||||
alias mm='su -M -c'
|
|
||||||
else alias mm='nsenter -t1 -m'; fi
|
|
||||||
|
|
||||||
mm grep -F "$PKG_NAME" /proc/mounts | while read -r line; do
|
|
||||||
ui_print "* Un-mount"
|
|
||||||
mp=${line#* } mp=${mp%% *}
|
|
||||||
mm umount -l "${mp%%\\*}"
|
|
||||||
done
|
|
||||||
am force-stop "$PKG_NAME"
|
|
||||||
|
|
||||||
pmex() {
|
|
||||||
OP=$(pm "$@" 2>&1 </dev/null)
|
|
||||||
RET=$?
|
|
||||||
echo "$OP"
|
|
||||||
return $RET
|
|
||||||
}
|
|
||||||
|
|
||||||
if ! pmex path "$PKG_NAME" >&2; then
|
|
||||||
if pmex install-existing "$PKG_NAME" >&2; then
|
|
||||||
BASEPATH=$(pmex path "$PKG_NAME") || abort "ERROR: pm path failed $BASEPATH"
|
|
||||||
echo >&2 "'$BASEPATH'"
|
|
||||||
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
|
|
||||||
if [ "${BASEPATH:1:4}" = data ]; then
|
|
||||||
if pmex uninstall -k --user 0 "$PKG_NAME" >&2; then
|
|
||||||
rm -rf "$BASEPATH" 2>&1
|
|
||||||
ui_print "* Cleared existing $PKG_NAME package"
|
|
||||||
ui_print "* Reboot and reflash"
|
|
||||||
abort
|
|
||||||
else abort "ERROR: pm uninstall failed"; fi
|
|
||||||
else ui_print "* Installed stock $PKG_NAME package"; fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
IS_SYS=false
|
|
||||||
INS=true
|
|
||||||
if BASEPATH=$(pmex path "$PKG_NAME"); then
|
|
||||||
echo >&2 "'$BASEPATH'"
|
|
||||||
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
|
|
||||||
if [ "${BASEPATH:1:4}" != data ]; then
|
|
||||||
ui_print "* $PKG_NAME is a system app."
|
|
||||||
IS_SYS=true
|
|
||||||
elif [ ! -f "$MODPATH/$PKG_NAME.apk" ]; then
|
|
||||||
ui_print "* Stock $PKG_NAME APK was not found"
|
|
||||||
VERSION=$(dumpsys package "$PKG_NAME" | grep -m1 versionName) VERSION="${VERSION#*=}"
|
|
||||||
if [ "$VERSION" = "$PKG_VER" ] || [ -z "$VERSION" ]; then
|
|
||||||
ui_print "* Skipping stock installation"
|
|
||||||
INS=false
|
|
||||||
else
|
|
||||||
abort "ERROR: Version mismatch
|
|
||||||
installed: $VERSION
|
|
||||||
module: $PKG_VER
|
|
||||||
"
|
|
||||||
fi
|
|
||||||
elif "${MODPATH:?}/bin/$ARCH/cmpr" "$BASEPATH/base.apk" "$MODPATH/$PKG_NAME.apk"; then
|
|
||||||
ui_print "* $PKG_NAME is up-to-date"
|
|
||||||
INS=false
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
install() {
|
|
||||||
if [ ! -f "$MODPATH/$PKG_NAME.apk" ]; then
|
|
||||||
abort "ERROR: Stock $PKG_NAME apk was not found"
|
|
||||||
fi
|
|
||||||
ui_print "* Updating $PKG_NAME to $PKG_VER"
|
|
||||||
install_err=""
|
|
||||||
VERIF1=$(settings get global verifier_verify_adb_installs)
|
|
||||||
VERIF2=$(settings get global package_verifier_enable)
|
|
||||||
settings put global verifier_verify_adb_installs 0
|
|
||||||
settings put global package_verifier_enable 0
|
|
||||||
SZ=$(stat -c "%s" "$MODPATH/$PKG_NAME.apk")
|
|
||||||
for IT in 1 2; do
|
|
||||||
if ! SES=$(pmex install-create --user 0 -i com.android.vending -r -d -S "$SZ"); then
|
|
||||||
ui_print "ERROR: install-create failed"
|
|
||||||
install_err="$SES"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
SES=${SES#*[} SES=${SES%]*}
|
|
||||||
set_perm "$MODPATH/$PKG_NAME.apk" 1000 1000 644 u:object_r:apk_data_file:s0
|
|
||||||
if ! op=$(pmex install-write -S "$SZ" "$SES" "$PKG_NAME.apk" "$MODPATH/$PKG_NAME.apk"); then
|
|
||||||
ui_print "ERROR: install-write failed"
|
|
||||||
install_err="$op"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
if ! op=$(pmex install-commit "$SES"); then
|
|
||||||
if echo "$op" | grep -q INSTALL_FAILED_VERSION_DOWNGRADE; then
|
|
||||||
ui_print "* Handling INSTALL_FAILED_VERSION_DOWNGRADE.."
|
|
||||||
if [ "$IS_SYS" = true ]; then
|
|
||||||
mkdir -p /data/adb/rvhc/empty /data/adb/post-fs-data.d
|
|
||||||
SCNM="/data/adb/post-fs-data.d/$PKG_NAME-uninstall.sh"
|
|
||||||
echo "mount -o bind /data/adb/rvhc/empty $BASEPATH" >"$SCNM"
|
|
||||||
chmod +x "$SCNM"
|
|
||||||
ui_print "* Created the uninstall script."
|
|
||||||
ui_print ""
|
|
||||||
ui_print "* Reboot and reflash the module!"
|
|
||||||
install_err=" "
|
|
||||||
break
|
|
||||||
else
|
|
||||||
ui_print "* Uninstalling..."
|
|
||||||
if ! op=$(pmex uninstall -k --user 0 "$PKG_NAME"); then
|
|
||||||
ui_print "$op"
|
|
||||||
if [ $IT = 2 ]; then
|
|
||||||
install_err="ERROR: pm uninstall failed."
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
ui_print "ERROR: install-commit failed"
|
|
||||||
install_err="$op"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
if BASEPATH=$(pmex path "$PKG_NAME"); then
|
|
||||||
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
|
|
||||||
else
|
|
||||||
install_err="ERROR: install $PKG_NAME manually and reflash the module"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
break
|
|
||||||
done
|
|
||||||
settings put global verifier_verify_adb_installs "$VERIF1"
|
|
||||||
settings put global package_verifier_enable "$VERIF2"
|
|
||||||
if [ "$install_err" ]; then abort "$install_err"; fi
|
|
||||||
}
|
|
||||||
if [ $INS = true ] && ! install; then abort; fi
|
|
||||||
BASEPATHLIB=${BASEPATH}/lib/${ARCH}
|
|
||||||
if [ $INS = true ] || [ -z "$(ls -A1 "$BASEPATHLIB")" ]; then
|
|
||||||
ui_print "* Extracting native libs"
|
|
||||||
if [ ! -d "$BASEPATHLIB" ]; then mkdir -p "$BASEPATHLIB"; else rm -f "$BASEPATHLIB"/* >/dev/null 2>&1 || :; fi
|
|
||||||
if ! op=$(unzip -o -j "$MODPATH/$PKG_NAME.apk" "lib/${ARCH_LIB}/*" -d "$BASEPATHLIB" 2>&1); then
|
|
||||||
ui_print "ERROR: extracting native libs failed"
|
|
||||||
abort "$op"
|
|
||||||
fi
|
|
||||||
set_perm_recursive "${BASEPATH}/lib" 1000 1000 755 755 u:object_r:apk_data_file:s0
|
|
||||||
fi
|
|
||||||
|
|
||||||
ui_print "* Setting Permissions"
|
|
||||||
set_perm "$MODPATH/base.apk" 1000 1000 644 u:object_r:apk_data_file:s0
|
|
||||||
|
|
||||||
ui_print "* Mounting $PKG_NAME"
|
|
||||||
mkdir -p "/data/adb/rvhc"
|
|
||||||
RVPATH=/data/adb/rvhc/${MODPATH##*/}.apk
|
|
||||||
mv -f "$MODPATH/base.apk" "$RVPATH"
|
|
||||||
|
|
||||||
if ! op=$(mm mount -o bind "$RVPATH" "$BASEPATH/base.apk" 2>&1); then
|
|
||||||
ui_print "ERROR: Mount failed!"
|
|
||||||
ui_print "$op"
|
|
||||||
fi
|
|
||||||
am force-stop "$PKG_NAME"
|
|
||||||
ui_print "* Optimizing $PKG_NAME"
|
|
||||||
nohup cmd package compile --reset "$PKG_NAME" >/dev/null 2>&1 &
|
|
||||||
|
|
||||||
ui_print "* Cleanup"
|
|
||||||
rm -rf "${MODPATH:?}/bin" "$MODPATH/$PKG_NAME.apk"
|
|
||||||
|
|
||||||
if [ "$KSU" ] && [ -d "/data/adb/modules/zygisk-assistant" ]; then
|
|
||||||
ui_print "* If you are using zygisk-assistant, you need to"
|
|
||||||
ui_print " give root permissions to $PKG_NAME"
|
|
||||||
fi
|
|
||||||
|
|
||||||
ui_print "* Done"
|
|
||||||
ui_print " by j-hc (github.com/j-hc)"
|
|
||||||
ui_print " "
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
#!/system/bin/sh
|
|
||||||
MODDIR=${0%/*}
|
|
||||||
RVPATH=/data/adb/rvhc/${MODDIR##*/}.apk
|
|
||||||
. "$MODDIR/config"
|
|
||||||
|
|
||||||
err() {
|
|
||||||
[ ! -f "$MODDIR/err" ] && cp "$MODDIR/module.prop" "$MODDIR/err"
|
|
||||||
sed -i "s/^des.*/description=⚠️ Needs reflash: '${1}'/g" "$MODDIR/module.prop"
|
|
||||||
}
|
|
||||||
|
|
||||||
until [ "$(getprop sys.boot_completed)" = 1 ]; do sleep 1; done
|
|
||||||
until [ -d "/sdcard/Android" ]; do sleep 1; done
|
|
||||||
while
|
|
||||||
BASEPATH=$(pm path "$PKG_NAME" 2>&1 </dev/null)
|
|
||||||
SVCL=$?
|
|
||||||
[ $SVCL = 20 ]
|
|
||||||
do sleep 2; done
|
|
||||||
|
|
||||||
run() {
|
|
||||||
if [ $SVCL != 0 ]; then
|
|
||||||
err "app not installed"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
sleep 4
|
|
||||||
|
|
||||||
BASEPATH=${BASEPATH##*:} BASEPATH=${BASEPATH%/*}
|
|
||||||
if [ ! -d "$BASEPATH/lib" ]; then # TODO: is this ok? idk
|
|
||||||
ls -Zla "$BASEPATH" >"$MODDIR/log.txt"
|
|
||||||
ls -Zla "$BASEPATH/lib" >>"$MODDIR/log.txt"
|
|
||||||
else rm "$MODDIR/log.txt" >/dev/null 2>&1; fi
|
|
||||||
VERSION=$(dumpsys package "$PKG_NAME" | grep -m1 versionName) VERSION="${VERSION#*=}"
|
|
||||||
if [ "$VERSION" != "$PKG_VER" ] && [ "$VERSION" ]; then
|
|
||||||
err "version mismatch (installed:${VERSION}, module:$PKG_VER)"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
grep "$PKG_NAME" /proc/mounts | while read -r line; do
|
|
||||||
mp=${line#* } mp=${mp%% *}
|
|
||||||
umount -l "${mp%%\\*}"
|
|
||||||
done
|
|
||||||
if ! chcon u:object_r:apk_data_file:s0 "$RVPATH"; then
|
|
||||||
err "apk not found"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
mount -o bind "$RVPATH" "$BASEPATH/base.apk"
|
|
||||||
am force-stop "$PKG_NAME"
|
|
||||||
[ -f "$MODDIR/err" ] && mv -f "$MODDIR/err" "$MODDIR/module.prop"
|
|
||||||
}
|
|
||||||
|
|
||||||
run
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
#!/system/bin/sh
|
|
||||||
{
|
|
||||||
MODDIR=${0%/*}
|
|
||||||
. "$MODDIR/config"
|
|
||||||
|
|
||||||
rm "/data/adb/rvhc/${MODDIR##*/}.apk"
|
|
||||||
rmdir "/data/adb/rvhc"
|
|
||||||
rm "/data/adb/post-fs-data.d/$PKG_NAME-uninstall.sh"
|
|
||||||
} &
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
a2a1ad7ba7f41dfca4514e2afeb90691719af6d0fdbed4b09bbf0ed897701ceb com.google.android.apps.youtube.music
|
a2a1ad7ba7f41dfca4514e2afeb90691719af6d0fdbed4b09bbf0ed897701ceb com.google.android.apps.youtube.music
|
||||||
3d7a1223019aa39d9ea0e3436ab7c0896bfb4fb679f4de5fe7c23f326c8f994a com.google.android.youtube
|
3d7a1223019aa39d9ea0e3436ab7c0896bfb4fb679f4de5fe7c23f326c8f994a com.google.android.youtube
|
||||||
970b91143813b4c9d5f3634f672c9fcaa5621b4efaaedafd6c235cbbb869736f com.reddit.frontpage
|
970b91143813b4c9d5f3634f672c9fcaa5621b4efaaedafd6c235cbbb869736f com.reddit.frontpage
|
||||||
9041803e91bcb814b4b4399fb5c85a91640b755e5e8ba76813814bf4cf2ab5ba com.zhiliaoapp.musically
|
|
||||||
1338f9b049893cc70b78432a177582f90bd4bc6296ea4ed35bcc7df59687ac53 tv.twitch.android.app
|
1338f9b049893cc70b78432a177582f90bd4bc6296ea4ed35bcc7df59687ac53 tv.twitch.android.app
|
||||||
|
|||||||
@@ -45,10 +45,17 @@ wpr() {
|
|||||||
echo >&2 -e "\033[0;33m[!] ${1}\033[0m"
|
echo >&2 -e "\033[0;33m[!] ${1}\033[0m"
|
||||||
if [ "${GITHUB_REPOSITORY-}" ]; then echo >&2 -e "::warning::utils.sh [!] ${1}\n"; fi
|
if [ "${GITHUB_REPOSITORY-}" ]; then echo >&2 -e "::warning::utils.sh [!] ${1}\n"; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_clean_tmp() {
|
||||||
|
rm -rf ./${TEMP_DIR}/*tmp.* ./${TEMP_DIR}/*tmp_* ./${TEMP_DIR}/*/*tmp.* ./${TEMP_DIR}/*-temporary-files ./*-temporary-files
|
||||||
|
}
|
||||||
|
|
||||||
abort() {
|
abort() {
|
||||||
epr "ABORT: ${1-}"
|
epr "ABORT: ${1-}"
|
||||||
rm -rf ./${TEMP_DIR}/*tmp.* ./${TEMP_DIR}/*/*tmp.* ./${TEMP_DIR}/*-temporary-files
|
_clean_tmp
|
||||||
kill -n 9 0
|
trap - SIGTERM SIGINT EXIT
|
||||||
|
kill -9 -- -$$ 2>/dev/null
|
||||||
|
exit 1
|
||||||
}
|
}
|
||||||
java() { env -i java --enable-native-access=ALL-UNNAMED "$@"; }
|
java() { env -i java --enable-native-access=ALL-UNNAMED "$@"; }
|
||||||
|
|
||||||
@@ -59,15 +66,9 @@ get_prebuilts() {
|
|||||||
cl_dir=${TEMP_DIR}/${cl_dir,,}-rv
|
cl_dir=${TEMP_DIR}/${cl_dir,,}-rv
|
||||||
[ -d "$cl_dir" ] || mkdir "$cl_dir"
|
[ -d "$cl_dir" ] || mkdir "$cl_dir"
|
||||||
|
|
||||||
for src_ver in "$cli_src CLI $cli_ver cli" "$patches_src Patches $patches_ver patches"; do
|
for src_ver in "Patches $patches_src $patches_ver" "CLI $cli_src $cli_ver"; do
|
||||||
set -- $src_ver
|
set -- $src_ver
|
||||||
local src=$1 tag=$2 ver=${3-} fprefix=$4
|
local tag=$1 src=$2 ver=${3-}
|
||||||
|
|
||||||
if [ "$tag" = "CLI" ]; then
|
|
||||||
local grab_cl=false
|
|
||||||
elif [ "$tag" = "Patches" ]; then
|
|
||||||
local grab_cl=true
|
|
||||||
else abort unreachable; fi
|
|
||||||
|
|
||||||
local dir=${src%/*}
|
local dir=${src%/*}
|
||||||
dir=${TEMP_DIR}/${dir,,}-rv
|
dir=${TEMP_DIR}/${dir,,}-rv
|
||||||
@@ -87,8 +88,21 @@ get_prebuilts() {
|
|||||||
name_ver="$ver"
|
name_ver="$ver"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local url file tag_name matches
|
local file
|
||||||
file=$(find "$dir" -name "*${fprefix}-${name_ver#v}.*" -type f 2>/dev/null)
|
if [ "$tag" = "CLI" ]; then
|
||||||
|
file=$(find "$dir" -maxdepth 1 -name "*cli-${name_ver#v}*.jar" -o -name "*desktop-${name_ver#v}*.jar" -type f 2>/dev/null)
|
||||||
|
local grab_cl=false
|
||||||
|
elif [ "$tag" = "Patches" ]; then
|
||||||
|
file=$(find "$dir" -maxdepth 1 -name "*patches-${name_ver#v}.*" -type f 2>/dev/null)
|
||||||
|
local grab_cl=true
|
||||||
|
else abort unreachable; fi
|
||||||
|
|
||||||
|
local url tag_name matches
|
||||||
|
if [ "$ver" = "latest" ]; then
|
||||||
|
file=$(grep -v '/[^/]*dev[^/]*$' <<<"$file" | head -1)
|
||||||
|
else
|
||||||
|
file=$(grep "/[^/]*${ver#v}[^/]*\$" <<<"$file" | head -1)
|
||||||
|
fi
|
||||||
if [ -z "$file" ]; then
|
if [ -z "$file" ]; then
|
||||||
local resp asset name
|
local resp asset name
|
||||||
resp=$(gh_req "$rv_rel" -) || return 1
|
resp=$(gh_req "$rv_rel" -) || return 1
|
||||||
@@ -115,11 +129,6 @@ get_prebuilts() {
|
|||||||
echo "$tag: $(cut -d/ -f1 <<<"$src")/${name} " >>"${cl_dir}/changelog.md"
|
echo "$tag: $(cut -d/ -f1 <<<"$src")/${name} " >>"${cl_dir}/changelog.md"
|
||||||
else
|
else
|
||||||
grab_cl=false
|
grab_cl=false
|
||||||
local for_err=$file
|
|
||||||
if [ "$ver" = "latest" ]; then
|
|
||||||
file=$(grep -v '/[^/]*dev[^/]*$' <<<"$file" | head -1)
|
|
||||||
else file=$(grep "/[^/]*${ver#v}[^/]*\$" <<<"$file" | head -1); fi
|
|
||||||
if [ -z "$file" ]; then abort "filter fail: '$for_err' with '$ver'"; fi
|
|
||||||
name=$(basename "$file")
|
name=$(basename "$file")
|
||||||
tag_name=$(cut -d'-' -f3- <<<"$name")
|
tag_name=$(cut -d'-' -f3- <<<"$name")
|
||||||
tag_name=v${tag_name%.*}
|
tag_name=v${tag_name%.*}
|
||||||
@@ -242,7 +251,7 @@ get_highest_ver() {
|
|||||||
local vers m
|
local vers m
|
||||||
vers=$(tee)
|
vers=$(tee)
|
||||||
m=$(head -1 <<<"$vers")
|
m=$(head -1 <<<"$vers")
|
||||||
if ! semver_validate "$m"; then echo "$m"; else sort -rV <<<"$vers" | head -1; fi
|
if ! semver_validate "$m"; then echo "$m"; else sort -s -t- -k1,1Vr <<<"$vers" | head -1; fi
|
||||||
}
|
}
|
||||||
semver_validate() {
|
semver_validate() {
|
||||||
local a="${1%-*}"
|
local a="${1%-*}"
|
||||||
@@ -271,7 +280,7 @@ get_patch_last_supported_ver() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
op=$(patches_list_versions "$cli_jar" "$patches_jar" "$pkg_name") || return 1
|
op=$(patches_list_versions "$cli_jar" "$patches_jar" "$pkg_name") || return 1
|
||||||
op=$(sed -n '/(.* patch.*/,$p' <<<"$op" | awk '{$1=$1}1')
|
op=$(sed -n '/Most common compatible versions:/,$p' <<<"$op" | sed '1d' | awk '{$1=$1}1')
|
||||||
if [ "$op" = "Any" ]; then return; fi
|
if [ "$op" = "Any" ]; then return; fi
|
||||||
pcount=$(head -1 <<<"$op") pcount=${pcount#*(} pcount=${pcount% *}
|
pcount=$(head -1 <<<"$op") pcount=${pcount#*(} pcount=${pcount% *}
|
||||||
if [ -z "$pcount" ]; then
|
if [ -z "$pcount" ]; then
|
||||||
@@ -281,14 +290,28 @@ get_patch_last_supported_ver() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
patches_list_versions() {
|
patches_list_versions() {
|
||||||
local cli_jar=$1 patches_jar=$2 pkg_name=$3 op
|
local cli_jar=$1 patches_jar=$2 pkg_name=$3 op cmd
|
||||||
if ! op=$(java -jar "$cli_jar" list-versions -p "$patches_jar" -f "$pkg_name" -b 2>&1); then
|
local cmd_base="java -jar '$cli_jar' list-versions"
|
||||||
if ! op=$(java -jar "$cli_jar" list-versions "$patches_jar" -f "$pkg_name" 2>&1); then
|
|
||||||
epr "Could not list versions $cli_jar: '$op'"
|
# TODO: remove this later
|
||||||
return 1
|
local cli_name
|
||||||
fi
|
cli_name=$(basename "$cli_jar")
|
||||||
|
if [ "${cli_name::8}" = revanced ]; then cmd_base+=" -b"; fi
|
||||||
|
|
||||||
|
cmd="${cmd_base} --patches='$patches_jar' -f '$pkg_name'"
|
||||||
|
if op=$(eval "$cmd" 2>&1); then
|
||||||
|
echo "$op"
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
echo "$op"
|
|
||||||
|
cmd="${cmd_base} '$patches_jar' -f '$pkg_name'"
|
||||||
|
if op=$(eval "$cmd" 2>&1); then
|
||||||
|
echo "$op"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
epr "Could not list versions $cli_jar: '$op'"
|
||||||
|
return 1
|
||||||
}
|
}
|
||||||
patches_list() {
|
patches_list() {
|
||||||
local cli_jar=$1 patches_jar=$2 pkg_name=$3 op
|
local cli_jar=$1 patches_jar=$2 pkg_name=$3 op
|
||||||
@@ -330,20 +353,27 @@ merge_splits() {
|
|||||||
# -------------------- apkmirror --------------------
|
# -------------------- apkmirror --------------------
|
||||||
apkmirror_search() {
|
apkmirror_search() {
|
||||||
local resp="$1" dpi="$2" arch="$3" apk_bundle="$4"
|
local resp="$1" dpi="$2" arch="$3" apk_bundle="$4"
|
||||||
local apparch dlurl="" node app_table emptyCheck
|
local dlurl="" node app_table emptyCheck
|
||||||
if [ "$arch" = all ]; then
|
|
||||||
apparch=(universal noarch 'arm64-v8a + armeabi-v7a')
|
local apparch=('universal' 'noarch' 'arm64-v8a + armeabi-v7a')
|
||||||
else apparch=("$arch" universal noarch 'arm64-v8a + armeabi-v7a'); fi
|
if [ "$arch" != "all" ]; then
|
||||||
|
apparch+=("$arch")
|
||||||
|
fi
|
||||||
|
|
||||||
|
local appdpi=("nodpi" "anydpi")
|
||||||
|
if [ "$dpi" ]; then
|
||||||
|
appdpi+=($dpi)
|
||||||
|
fi
|
||||||
|
|
||||||
for ((n = 1; n < 40; n++)); do
|
for ((n = 1; n < 40; n++)); do
|
||||||
node=$($HTMLQ "div.table-row.headerFont:nth-last-child($n)" -r "span:nth-child(n+3)" <<<"$resp")
|
node=$($HTMLQ "div.table-row.headerFont:nth-last-child($n)" -r "span:nth-child(n+3)" <<<"$resp")
|
||||||
if [ -z "$node" ]; then break; fi
|
if [ -z "$node" ]; then break; fi
|
||||||
emptyCheck=$($HTMLQ -t -w "div.table-cell:nth-child(1) > a:nth-child(1)" <<<"$node" | xargs)
|
emptyCheck=$($HTMLQ -t -w "div.table-cell:nth-child(1) > a:nth-child(1)" <<<"$node" | xargs)
|
||||||
if [ "$emptyCheck" ]; then
|
if [ -z "$emptyCheck" ]; then break; fi
|
||||||
dlurl=$($HTMLQ --base https://www.apkmirror.com --attribute href "div:nth-child(1) > a:nth-child(1)" <<<"$node")
|
|
||||||
else break; fi
|
|
||||||
app_table=$($HTMLQ --text --ignore-whitespace <<<"$node")
|
app_table=$($HTMLQ --text --ignore-whitespace <<<"$node")
|
||||||
if [ "$(sed -n 3p <<<"$app_table")" = "$apk_bundle" ] &&
|
if [ "$(sed -n 3p <<<"$app_table")" != "$apk_bundle" ]; then continue; fi
|
||||||
[ "$(sed -n 6p <<<"$app_table")" = "$dpi" ] &&
|
dlurl=$($HTMLQ --base https://www.apkmirror.com --attribute href "div:nth-child(1) > a:nth-child(1)" <<<"$node")
|
||||||
|
if isoneof "$(sed -n 6p <<<"$app_table")" "${appdpi[@]}" &&
|
||||||
isoneof "$(sed -n 4p <<<"$app_table")" "${apparch[@]}"; then
|
isoneof "$(sed -n 4p <<<"$app_table")" "${apparch[@]}"; then
|
||||||
echo "$dlurl"
|
echo "$dlurl"
|
||||||
return 0
|
return 0
|
||||||
@@ -358,32 +388,34 @@ apkmirror_search() {
|
|||||||
}
|
}
|
||||||
dl_apkmirror() {
|
dl_apkmirror() {
|
||||||
local url=$1 version=${2// /-} output=$3 arch=$4 dpi=$5 is_bundle=false
|
local url=$1 version=${2// /-} output=$3 arch=$4 dpi=$5 is_bundle=false
|
||||||
|
|
||||||
if [ -f "${output}.apkm" ]; then
|
if [ -f "${output}.apkm" ]; then
|
||||||
is_bundle=true
|
merge_splits "${output}.apkm" "${output}"
|
||||||
else
|
return 0
|
||||||
if [ "$arch" = "arm-v7a" ]; then arch="armeabi-v7a"; fi
|
|
||||||
local resp node app_table apkmname dlurl=""
|
|
||||||
apkmname=$($HTMLQ "h1.marginZero" --text <<<"$__APKMIRROR_RESP__")
|
|
||||||
apkmname="${apkmname,,}" apkmname="${apkmname// /-}" apkmname="${apkmname//[^a-z0-9-]/}"
|
|
||||||
url="${url}/${apkmname}-${version//./-}-release/"
|
|
||||||
resp=$(req "$url" -) || return 1
|
|
||||||
node=$($HTMLQ "div.table-row.headerFont:nth-last-child(1)" -r "span:nth-child(n+3)" <<<"$resp")
|
|
||||||
if [ "$node" ]; then
|
|
||||||
for current_dpi in $dpi; do
|
|
||||||
for type in APK BUNDLE; do
|
|
||||||
if dlurl=$(apkmirror_search "$resp" "$current_dpi" "${arch}" "$type"); then
|
|
||||||
[[ "$type" == "BUNDLE" ]] && is_bundle=true || is_bundle=false
|
|
||||||
break 2
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
[ -z "$dlurl" ] && return 1
|
|
||||||
resp=$(req "$dlurl" -)
|
|
||||||
fi
|
|
||||||
url=$(echo "$resp" | $HTMLQ --base https://www.apkmirror.com --attribute href "a.btn") || return 1
|
|
||||||
url=$(req "$url" - | $HTMLQ --base https://www.apkmirror.com --attribute href "span > a[rel = nofollow]") || return 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$arch" = "arm-v7a" ]; then arch="armeabi-v7a"; fi
|
||||||
|
local resp node app_table apkmname dlurl=""
|
||||||
|
apkmname=$($HTMLQ "h1.marginZero" --text <<<"$__APKMIRROR_RESP__")
|
||||||
|
apkmname="${apkmname,,}" apkmname="${apkmname// /-}" apkmname="${apkmname//[^a-z0-9-]/}"
|
||||||
|
url="${url}/${apkmname}-${version//./-}-release/"
|
||||||
|
resp=$(req "$url" -) || return 1
|
||||||
|
node=$($HTMLQ "div.table-row.headerFont:nth-last-child(1)" -r "span:nth-child(n+3)" <<<"$resp")
|
||||||
|
if [ "$node" ]; then
|
||||||
|
for type in APK BUNDLE; do
|
||||||
|
if dlurl=$(apkmirror_search "$resp" "$dpi" "$arch" "$type"); then
|
||||||
|
if [ "$type" = "BUNDLE" ]; then
|
||||||
|
is_bundle=true
|
||||||
|
else is_bundle=false; fi
|
||||||
|
break 2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ -z "$dlurl" ]; then return 1; fi
|
||||||
|
resp=$(req "$dlurl" -)
|
||||||
|
fi
|
||||||
|
url=$(echo "$resp" | $HTMLQ --base https://www.apkmirror.com --attribute href "a.btn") || return 1
|
||||||
|
url=$(req "$url" - | $HTMLQ --base https://www.apkmirror.com --attribute href "span > a[rel = nofollow]") || return 1
|
||||||
|
|
||||||
if [ "$is_bundle" = true ]; then
|
if [ "$is_bundle" = true ]; then
|
||||||
req "$url" "${output}.apkm" || return 1
|
req "$url" "${output}.apkm" || return 1
|
||||||
merge_splits "${output}.apkm" "${output}"
|
merge_splits "${output}.apkm" "${output}"
|
||||||
@@ -421,11 +453,12 @@ get_uptodown_resp() {
|
|||||||
get_uptodown_vers() { $HTMLQ --text ".version" <<<"$__UPTODOWN_RESP__"; }
|
get_uptodown_vers() { $HTMLQ --text ".version" <<<"$__UPTODOWN_RESP__"; }
|
||||||
dl_uptodown() {
|
dl_uptodown() {
|
||||||
local uptodown_dlurl=$1 version=$2 output=$3 arch=$4 _dpi=$5
|
local uptodown_dlurl=$1 version=$2 output=$3 arch=$4 _dpi=$5
|
||||||
local apparch
|
|
||||||
if [ "$arch" = "arm-v7a" ]; then arch="armeabi-v7a"; fi
|
if [ "$arch" = "arm-v7a" ]; then arch="armeabi-v7a"; fi
|
||||||
if [ "$arch" = all ]; then
|
|
||||||
apparch=('arm64-v8a, armeabi-v7a, x86_64' 'arm64-v8a, armeabi-v7a, x86, x86_64' 'arm64-v8a, armeabi-v7a')
|
local apparch=('arm64-v8a, armeabi-v7a, x86_64' 'arm64-v8a, armeabi-v7a, x86, x86_64' 'arm64-v8a, armeabi-v7a')
|
||||||
else apparch=("$arch" 'arm64-v8a, armeabi-v7a, x86_64' 'arm64-v8a, armeabi-v7a, x86, x86_64' 'arm64-v8a, armeabi-v7a'); fi
|
if [ "$arch" != all ]; then
|
||||||
|
apparch+=("$arch")
|
||||||
|
fi
|
||||||
|
|
||||||
local op resp data_code
|
local op resp data_code
|
||||||
data_code=$($HTMLQ "#detail-app-name" --attribute data-code <<<"$__UPTODOWN_RESP__")
|
data_code=$($HTMLQ "#detail-app-name" --attribute data-code <<<"$__UPTODOWN_RESP__")
|
||||||
@@ -479,8 +512,19 @@ get_uptodown_pkg_name() { $HTMLQ --text "tr.full:nth-child(1) > td:nth-child(3)"
|
|||||||
dl_archive() {
|
dl_archive() {
|
||||||
local url=$1 version=$2 output=$3 arch=$4
|
local url=$1 version=$2 output=$3 arch=$4
|
||||||
local path version=${version// /}
|
local path version=${version// /}
|
||||||
path=$(grep "${version_f#v}-${arch// /}" <<<"$__ARCHIVE_RESP__") || return 1
|
|
||||||
req "${url}/${path}" "$output"
|
if [ -f "${output}.apkm" ]; then
|
||||||
|
merge_splits "${output}.apkm" "$output"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
path=$(grep -m1 "${version_f#v}-${arch// /}" <<<"$__ARCHIVE_RESP__") || return 1
|
||||||
|
if [ "${path##*.}" = "apkm" ]; then
|
||||||
|
req "${url}/${path}" "${output}.apkm" || return 1
|
||||||
|
merge_splits "${output}.apkm" "$output"
|
||||||
|
else
|
||||||
|
req "${url}/${path}" "${output}" || return 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
get_archive_resp() {
|
get_archive_resp() {
|
||||||
local r
|
local r
|
||||||
@@ -493,8 +537,17 @@ get_archive_pkg_name() { echo "$__ARCHIVE_PKG_NAME__"; }
|
|||||||
|
|
||||||
# -------------------- direct --------------------
|
# -------------------- direct --------------------
|
||||||
dl_direct() {
|
dl_direct() {
|
||||||
local url=$1 version=${2// /-} output=$3 arch=$4 dpi=$5
|
local url=$1 version=${2// /-} output=$3 arch=$4 _dpi=$5
|
||||||
req "$url" "${output}" || return 1
|
if ! grep -q "${version_f#v}-${arch// /}" <<<"$url"; then
|
||||||
|
epr "Given direct-dlurl for $output is not compatible. Set proper 'arch' and 'version' options."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if [ "${url##*.}" = "apkm" ]; then
|
||||||
|
req "$url" "${output}.apkm" || return 1
|
||||||
|
merge_splits "${output}.apkm" "$output"
|
||||||
|
else
|
||||||
|
req "$url" "${output}" || return 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
get_direct_vers() { cut -d- -f2 <<<"$__DIRECT_APKNAME__"; }
|
get_direct_vers() { cut -d- -f2 <<<"$__DIRECT_APKNAME__"; }
|
||||||
get_direct_pkg_name() { cut -d- -f1 <<<"$__DIRECT_APKNAME__"; }
|
get_direct_pkg_name() { cut -d- -f1 <<<"$__DIRECT_APKNAME__"; }
|
||||||
@@ -503,8 +556,11 @@ get_direct_resp() { __DIRECT_APKNAME__=$(awk -F/ '{print $NF}' <<<"$1"); }
|
|||||||
|
|
||||||
patch_apk() {
|
patch_apk() {
|
||||||
local stock_input=$1 patched_apk=$2 patcher_args=$3 cli_jar=$4 patches_jar=$5
|
local stock_input=$1 patched_apk=$2 patcher_args=$3 cli_jar=$4 patches_jar=$5
|
||||||
local cmd="java -jar '$cli_jar' patch '$stock_input' --purge -o '$patched_apk' -p '$patches_jar' --keystore=ks.keystore \
|
local tmp_files
|
||||||
--keystore-entry-password=123456789 --keystore-password=123456789 --signer=jhc --keystore-entry-alias=jhc $patcher_args"
|
tmp_files="$(pwd)/$(mktemp -d -p "$TEMP_DIR")"
|
||||||
|
|
||||||
|
local cmd="java -jar '$cli_jar' patch '$stock_input' -o '$patched_apk' -p '$patches_jar' --keystore=ks.keystore \
|
||||||
|
--keystore-entry-password=123456789 --keystore-password=123456789 --signer=jhc --keystore-entry-alias=jhc -t '$tmp_files' $patcher_args"
|
||||||
|
|
||||||
# TODO: remove this later
|
# TODO: remove this later
|
||||||
local cli_name
|
local cli_name
|
||||||
@@ -547,17 +603,22 @@ build_rv() {
|
|||||||
[ "${args[exclusive_patches]}" = true ] && p_patcher_args+=("--exclusive")
|
[ "${args[exclusive_patches]}" = true ] && p_patcher_args+=("--exclusive")
|
||||||
|
|
||||||
local tried_dl=()
|
local tried_dl=()
|
||||||
for dl_p in "${DL_SRCS[@]}"; do
|
if [ "${args[pkg_name]}" ]; then
|
||||||
if [ -z "${args[${dl_p}_dlurl]}" ]; then continue; fi
|
pkg_name="${args[pkg_name]}"
|
||||||
if ! get_${dl_p}_resp "${args[${dl_p}_dlurl]}" || ! pkg_name=$(get_"${dl_p}"_pkg_name); then
|
else
|
||||||
args[${dl_p}_dlurl]=""
|
for dl_p in "${DL_SRCS[@]}"; do
|
||||||
epr "ERROR: Could not find ${table} in ${dl_p}"
|
if [ -z "${args[${dl_p}_dlurl]}" ]; then continue; fi
|
||||||
continue
|
if ! get_${dl_p}_resp "${args[${dl_p}_dlurl]}" || ! pkg_name=$(get_"${dl_p}"_pkg_name); then
|
||||||
fi
|
args[${dl_p}_dlurl]=""
|
||||||
tried_dl+=("$dl_p")
|
epr "ERROR: Could not find ${table} in ${dl_p}"
|
||||||
dl_from=$dl_p
|
continue
|
||||||
break
|
fi
|
||||||
done
|
tried_dl+=("$dl_p")
|
||||||
|
dl_from=$dl_p
|
||||||
|
break
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$pkg_name" ]; then
|
if [ -z "$pkg_name" ]; then
|
||||||
epr "empty pkg name, not building ${table}."
|
epr "empty pkg name, not building ${table}."
|
||||||
return 0
|
return 0
|
||||||
@@ -622,9 +683,23 @@ build_rv() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ ! -f "${stock_apk}.apkm" ] && ! OP=$(check_sig "$stock_apk" "$pkg_name" 2>&1) && ! grep -qFx "ERROR: Missing META-INF/MANIFEST.MF" <<<"$OP"; then
|
|
||||||
epr "Not building $table, apk signature mismatch '$stock_apk': $OP"
|
local sig_op
|
||||||
return 0
|
if [ -f "${stock_apk}.apkm" ]; then
|
||||||
|
rm -rf "${stock_apk}-zip" || :
|
||||||
|
unzip -j "${stock_apk}.apkm" -d "${stock_apk}-zip" >/dev/null
|
||||||
|
for a in "${stock_apk}"-zip/*.apk; do
|
||||||
|
if ! sig_op=$(check_sig "$a" "$pkg_name" 2>&1); then
|
||||||
|
epr "Not building $table, apk signature mismatch '$a': $sig_op"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
rm -rf "${stock_apk}-zip" || :
|
||||||
|
else
|
||||||
|
if ! sig_op=$(check_sig "$stock_apk" "$pkg_name" 2>&1); then
|
||||||
|
epr "Not building $table, apk signature mismatch '$stock_apk': $sig_op"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
log "${table}: ${version}"
|
log "${table}: ${version}"
|
||||||
|
|
||||||
@@ -672,7 +747,9 @@ build_rv() {
|
|||||||
zip -d "$stock_apk_to_patch" "lib/x86_64/*" "lib/x86/*" >/dev/null 2>&1 || :
|
zip -d "$stock_apk_to_patch" "lib/x86_64/*" "lib/x86/*" >/dev/null 2>&1 || :
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "${NORB:-}" != true ] || [ ! -f "$patched_apk" ]; then
|
|
||||||
|
local apk_output="${BUILD_DIR}/${app_name_l}-${rv_brand_f}-v${version_f}-${arch_f}.apk"
|
||||||
|
if [ "${NORB:-}" != true ] || { [ ! -f "$patched_apk" ] && [ ! -f "$apk_output" ]; }; then
|
||||||
if ! patch_apk "$stock_apk_to_patch" "$patched_apk" "${patcher_args[*]}" "${args[cli]}" "${args[ptjar]}"; then
|
if ! patch_apk "$stock_apk_to_patch" "$patched_apk" "${patcher_args[*]}" "${args[cli]}" "${args[ptjar]}"; then
|
||||||
epr "Building '${table}' failed!"
|
epr "Building '${table}' failed!"
|
||||||
return 0
|
return 0
|
||||||
@@ -680,8 +757,11 @@ build_rv() {
|
|||||||
fi
|
fi
|
||||||
rm "$stock_apk_to_patch"
|
rm "$stock_apk_to_patch"
|
||||||
if [ "$build_mode" = apk ]; then
|
if [ "$build_mode" = apk ]; then
|
||||||
local apk_output="${BUILD_DIR}/${app_name_l}-${rv_brand_f}-v${version_f}-${arch_f}.apk"
|
if [ "${NORB:-}" != true ] || { [ ! -f "$patched_apk" ] && [ ! -f "$apk_output" ]; }; then
|
||||||
mv -f "$patched_apk" "$apk_output"
|
mv -f "$patched_apk" "$apk_output"
|
||||||
|
else
|
||||||
|
cp -f "$patched_apk" "$apk_output"
|
||||||
|
fi
|
||||||
pr "Built ${table} (non-root): '${apk_output}'"
|
pr "Built ${table} (non-root): '${apk_output}'"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
@@ -704,7 +784,30 @@ build_rv() {
|
|||||||
local module_output="${app_name_l}-${rv_brand_f}-module-v${version_f}-${arch_f}.zip"
|
local module_output="${app_name_l}-${rv_brand_f}-module-v${version_f}-${arch_f}.zip"
|
||||||
pr "Packing module ${table}"
|
pr "Packing module ${table}"
|
||||||
cp -f "$patched_apk" "${base_template}/base.apk"
|
cp -f "$patched_apk" "${base_template}/base.apk"
|
||||||
if [ "${args[include_stock]}" = true ]; then cp -f "$stock_apk" "${base_template}/${pkg_name}.apk"; fi
|
|
||||||
|
if [ "${args[include_stock]}" != "disable" ]; then
|
||||||
|
mkdir -p "${base_template}/stock/"
|
||||||
|
if [ "${args[include_stock]}" = "merged" ]; then
|
||||||
|
cp -f "$stock_apk" "${base_template}/stock/base.apk"
|
||||||
|
elif [ "${args[include_stock]}" = "split" ]; then
|
||||||
|
if [ ! -f "${stock_apk}.apkm" ]; then
|
||||||
|
epr "Cannot include as 'split' because stock apk of $table_name is not a bundle"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
if [ "$arch" = "arm64-v8a" ]; then
|
||||||
|
unzip -j "${stock_apk}.apkm" '*.apk' -x '*x86_64.apk' -x '*x86.apk' -x '*armeabi_v7a.apk' -d "${base_template}/stock/" >/dev/null 2>&1
|
||||||
|
elif [ "$arch" = "arm-v7a" ]; then
|
||||||
|
unzip -j "${stock_apk}.apkm" '*.apk' -x '*x86_64.apk' -x '*x86.apk' -x '*arm64_v8a.apk' -d "${base_template}/stock/" >/dev/null 2>&1
|
||||||
|
elif [ "$arch" = "x86" ]; then
|
||||||
|
unzip -j "${stock_apk}.apkm" '*.apk' -x '*x86_64.apk' -x '*arm64_v8a.apk' -x '*armeabi_v7a.apk' -d "${base_template}/stock/" >/dev/null 2>&1
|
||||||
|
elif [ "$arch" = "x86_64" ]; then
|
||||||
|
unzip -j "${stock_apk}.apkm" '*.apk' -x '*x86.apk' -x '*arm64_v8a.apk' -x '*armeabi_v7a.apk' -d "${base_template}/stock/" >/dev/null 2>&1
|
||||||
|
else
|
||||||
|
unzip -j "${stock_apk}.apkm" '*.apk' -x '*x86_64.apk' -x '*x86.apk' -d "${base_template}/stock/" >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
pushd >/dev/null "$base_template" || abort "Module template dir not found"
|
pushd >/dev/null "$base_template" || abort "Module template dir not found"
|
||||||
zip -"$COMPRESSION_LEVEL" -FSqr "${CWD}/${BUILD_DIR}/${module_output}" .
|
zip -"$COMPRESSION_LEVEL" -FSqr "${CWD}/${BUILD_DIR}/${module_output}" .
|
||||||
popd >/dev/null || :
|
popd >/dev/null || :
|
||||||
|
|||||||
Reference in New Issue
Block a user