Skip to content

Commit

Permalink
magisk > module
Browse files Browse the repository at this point in the history
Signed-off-by: Naveen <[email protected]>
  • Loading branch information
elohim-etz committed Jan 28, 2025
1 parent 413ae91 commit 7492b5f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
44 changes: 22 additions & 22 deletions build-termux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,45 +29,45 @@ if [ ! -f ~/.rvmm_"$(date '+%Y%m')" ]; then
yes "" | pkg update -y && pkg install -y git curl jq openjdk-17 zip
: >~/.rvmm_"$(date '+%Y%m')"
fi
mkdir -p /sdcard/Download/revanced-magisk-module/
mkdir -p /sdcard/Download/revanced-modules/

if [ -d revanced-magisk-module ] || [ -f config.toml ]; then
if [ -d revanced-magisk-module ]; then cd revanced-magisk-module; fi
pr "Checking for revanced-magisk-module updates"
if [ -d revanced-modules ] || [ -f config.toml ]; then
if [ -d revanced-modules ]; then cd revanced-modules; fi
pr "Checking for revanced-modules updates"
git fetch
if git status | grep -q 'is behind\|fatal'; then
pr "revanced-magisk-module is not synced with upstream."
pr "Cloning revanced-magisk-module. config.toml will be preserved."
pr "revanced-modules is not synced with upstream."
pr "Cloning revanced-modules. config.toml will be preserved."
cd ..
cp -f revanced-magisk-module/config.toml .
rm -rf revanced-magisk-module
cp -f revanced-modules/config.toml .
rm -rf revanced-modules
git clone https://github.com/j-hc/revanced-magisk-module --recurse --depth 1
mv -f config.toml revanced-magisk-module/config.toml
cd revanced-magisk-module
mv -f config.toml revanced-modules/config.toml
cd revanced-modules
fi
else
pr "Cloning revanced-magisk-module."
pr "Cloning revanced-modules."
git clone https://github.com/j-hc/revanced-magisk-module --depth 1
cd revanced-magisk-module
cd revanced-modules
sed -i '/^enabled.*/d; /^\[.*\]/a enabled = false' config.toml
grep -q 'revanced-magisk-module' ~/.gitconfig 2>/dev/null ||
git config --global --add safe.directory ~/revanced-magisk-module
grep -q 'revanced-modules' ~/.gitconfig 2>/dev/null ||
git config --global --add safe.directory ~/revanced-modules
fi

[ -f ~/storage/downloads/revanced-magisk-module/config.toml ] ||
cp config.toml ~/storage/downloads/revanced-magisk-module/config.toml
[ -f ~/storage/downloads/revanced-modules/config.toml ] ||
cp config.toml ~/storage/downloads/revanced-modules/config.toml

if ask "Open rvmm-config-gen to generate a config?"; then
am start -a android.intent.action.VIEW -d https://j-hc.github.io/rvmm-config-gen/
fi
printf "\n"
until
if ask "Open 'config.toml' to configure builds?\nAll are disabled by default, you will need to enable at first time building"; then
am start -a android.intent.action.VIEW -d file:///sdcard/Download/revanced-magisk-module/config.toml -t text/plain
am start -a android.intent.action.VIEW -d file:///sdcard/Download/revanced-modules/config.toml -t text/plain
fi
ask "Setup is done. Do you want to start building?"
do :; done
cp -f ~/storage/downloads/revanced-magisk-module/config.toml config.toml
cp -f ~/storage/downloads/revanced-modules/config.toml config.toml

./build.sh

Expand All @@ -78,10 +78,10 @@ for op in *; do
pr "glob fail"
exit 1
}
mv -f "${PWD}/${op}" ~/storage/downloads/revanced-magisk-module/"${op}"
mv -f "${PWD}/${op}" ~/storage/downloads/revanced-modules/"${op}"
done

pr "Outputs are available in /sdcard/Download/revanced-magisk-module folder"
am start -a android.intent.action.VIEW -d file:///sdcard/Download/revanced-magisk-module -t resource/folder
pr "Outputs are available in /sdcard/Download/revanced-modules folder"
am start -a android.intent.action.VIEW -d file:///sdcard/Download/revanced-modules -t resource/folder
sleep 2
am start -a android.intent.action.VIEW -d file:///sdcard/Download/revanced-magisk-module -t resource/folder
am start -a android.intent.action.VIEW -d file:///sdcard/Download/revanced-modules -t resource/folder
8 changes: 4 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ if [ "${2-}" = "--config-update" ]; then
fi

: >build.md
ENABLE_MAGISK_UPDATE=$(toml_get "$main_config_t" enable-magisk-update) || ENABLE_MAGISK_UPDATE=true
if [ "$ENABLE_MAGISK_UPDATE" = true ] && [ -z "${GITHUB_REPOSITORY-}" ]; then
pr "You are building locally. Magisk updates will not be enabled."
ENABLE_MAGISK_UPDATE=false
ENABLE_MODULE_UPDATE=$(toml_get "$main_config_t" enable-module-update) || ENABLE_MODULE_UPDATE=true
if [ "$ENABLE_MODULE_UPDATE" = true ] && [ -z "${GITHUB_REPOSITORY-}" ]; then
pr "You are building locally. Module updates will not be enabled."
ENABLE_MODULE_UPDATE=false
fi
if ((COMPRESSION_LEVEL > 9)) || ((COMPRESSION_LEVEL < 0)); then abort "compression-level must be within 0-9"; fi

Expand Down
2 changes: 1 addition & 1 deletion config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enable-magisk-update = true # set this to false if you do not want to receive updates for the module in magisk app
enable-module-update = true # set this to false if you do not want to receive updates for the module in magisk app
parallel-jobs = 1

# add 'enabled = false' for not patching a specific app or remove it from the config
Expand Down
4 changes: 2 additions & 2 deletions utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ build_rv() {
"${args[module_prop_name]}" \
"${app_name} ${args[rv_brand]}" \
"${version} (patches: ${rv_patches_ver%%.rvp})" \
"${app_name} ${args[rv_brand]} Magisk module" \
"${app_name} ${args[rv_brand]} Revanced module" \
"https://raw.githubusercontent.com/${GITHUB_REPOSITORY-}/update/${upj}" \
"$base_template"

Expand Down Expand Up @@ -622,5 +622,5 @@ versionCode=${NEXT_VER_CODE}
author=𝙴𝙻𝙾𝙷𝙸𝙼
description=${4}" >"${6}/module.prop"

if [ "$ENABLE_MAGISK_UPDATE" = true ]; then echo "updateJson=${5}" >>"${6}/module.prop"; fi
if [ "$ENABLE_MODULE_UPDATE" = true ]; then echo "updateJson=${5}" >>"${6}/module.prop"; fi
}

0 comments on commit 7492b5f

Please sign in to comment.