From 37e3a698ffde540b012d7cabb106fce67554edcd Mon Sep 17 00:00:00 2001 From: j-hc Date: Fri, 3 Feb 2023 19:57:47 +0300 Subject: [PATCH] module: check arch upon flashing --- .github/ISSUE_TEMPLATE/bug_report.md | 11 +++++++++++ scripts/customize.sh | 13 ++++++++----- utils.sh | 15 +++++++++++---- 3 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..8f3f22a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,11 @@ +--- +name: Bug report +about: Bug report +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +**DO NOT REPORT REVANCED BUGS IN THIS REPO** diff --git a/scripts/customize.sh b/scripts/customize.sh index f2c115b..ef8f722 100755 --- a/scripts/customize.sh +++ b/scripts/customize.sh @@ -2,9 +2,11 @@ ui_print "" if [ $ARCH = "arm" ]; then - alias cmpr='$MODPATH/bin/arm/cmpr' + #arm ARCH_LIB=armeabi-v7a -elif [ $ARCH = "arm64" ] || [ $ARCH = "x64" ]; then + alias cmpr='$MODPATH/bin/arm/cmpr' +elif [ $ARCH = "arm64" ]; then + #arm64 ARCH_LIB=arm64-v8a alias cmpr='$MODPATH/bin/arm64/cmpr' else @@ -12,10 +14,11 @@ else fi set_perm_recursive $MODPATH/bin 0 0 0755 0777 -grep __PKGNAME /proc/self/mountinfo | while read -r line; do +grep __PKGNAME /proc/mounts | while read -r line; do ui_print "* Un-mount" - mountpoint=$(echo "$line" | cut -d' ' -f5) - umount -l "${mountpoint%%\\*}" + mp=${line#* } + mp=${mp%% *} + umount -l ${mp%%\\*} done am force-stop __PKGNAME diff --git a/utils.sh b/utils.sh index 2eea6ec..71b5ffb 100755 --- a/utils.sh +++ b/utils.sh @@ -156,7 +156,7 @@ dl_apkmirror() { } get_apkmirror_vers() { local apkmirror_category=$1 allow_alpha_version=$2 - local vers + local vers apkm_resp apkm_resp=$(req "https://www.apkmirror.com/uploads/?appcategory=${apkmirror_category}" -) # apkm_name=$(echo "$apkm_resp" | sed -n 's;.*Latest \(.*\) Uploads.*;\1;p') vers=$(sed -n 's;.*Version:\(.*\) .*;\1;p' <<<"$apkm_resp") @@ -180,6 +180,7 @@ get_uptodown_resp() { req "${1}/versions" -; } get_uptodown_vers() { sed -n 's;\(^.*\) .*.*;\1;p' <<<"$1"; } dl_uptodown() { local uptwod_resp=$1 version=$2 output=$3 + local url url=$(echo "$uptwod_resp" | grep "${version} " -B 1 | head -1 | sed -n 's;.*data-url="\(.*\)".*;\1;p') url=$(req "$url" - | sed -n 's;.*data-url="\(.*\)".*;\1;p') req "$url" "$output" @@ -305,7 +306,7 @@ build_rv() { build_mode_arr=(apk module) fi - local patcher_args patched_apk + local patcher_args patched_apk build_mode for build_mode in "${build_mode_arr[@]}"; do patcher_args=("${p_patcher_args[@]}") pr "Building '${app_name}' (${arch}) in '$build_mode' mode" @@ -346,7 +347,7 @@ build_rv() { uninstall_sh "$pkg_name" "$base_template" service_sh "$pkg_name" "$version" "$base_template" - customize_sh "$pkg_name" "$version" "$base_template" + customize_sh "$pkg_name" "$version" "$arch" "$base_template" module_prop \ "${args[module_prop_name]}" \ "${app_name} ${RV_BRAND}" \ @@ -371,7 +372,13 @@ join_args() { uninstall_sh() { echo "${UNINSTALL_SH//__PKGNAME/$1}" >"${2}/uninstall.sh"; } customize_sh() { local s="${CUSTOMIZE_SH//__PKGNAME/$1}" - echo "${s//__PKGVER/$2}" >"${3}/customize.sh" + # shellcheck disable=SC2016,SC2001 + if [ "$3" = "arm64-v8a" ]; then + s=$(sed 's/#arm$/abort "ERROR: Wrong arch\nYour device: arm\nModule: arm64"/g' <<<"$s") + elif [ "$3" = "arm-v7a" ]; then + s=$(sed 's/#arm64$/abort "ERROR: Wrong arch\nYour device: arm64\nModule: arm"/g' <<<"$s") + fi + echo "${s//__PKGVER/$2}" >"${4}/customize.sh" } service_sh() { local s="${SERVICE_SH//__PKGNAME/$1}"