Skip to content

Commit

Permalink
Add OF_USE_LATEST_MAGISK
Browse files Browse the repository at this point in the history
Signed-off-by: Sushrut1101 <[email protected]>
  • Loading branch information
Sushrut1101 committed May 12, 2022
1 parent cfd6ad8 commit 4472d4f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ export OUTPUT="OrangeFox*.zip"
# Extra Command
export EXTRA_CMD="git clone https://github.com/OrangeFoxRecovery/Avatar.git misc"

# Magisk
## Use the Latest Release of Magisk for the OrangeFox addon
OF_USE_LATEST_MAGISK=true

# Not Recommended to Change
export SYNC_PATH="$HOME/work" # Full (absolute) path.
export USE_CCACHE=1
Expand Down
6 changes: 6 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ fi
# Set BRANCH_INT variable for future use
BRANCH_INT=$(echo $SYNC_BRANCH | cut -d. -f1)

# Magisk
if [[ $OF_USE_LATEST_MAGISK = "true" || $OF_USE_LATEST_MAGISK = "1" ]]; then
echo "Using the Latest Release of Magisk..."
export FOX_USE_SPECIFIC_MAGISK_ZIP="~/Magisk/$(ls ~/Magisk/Magisk*.zip)"
fi

# Legacy Build Systems
if [ $BRANCH_INT -le 6 ]; then
export OF_DISABLE_KEYMASTER2=1 # Disable Keymaster2
Expand Down
14 changes: 14 additions & 0 deletions scripts/sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,19 @@ git clone $DT_LINK $DT_PATH || { echo "ERROR: Failed to Clone the Device Trees!"
# only if the Kernel Source is Specified in the Config
[ ! -z "$KERNEL_SOURCE" ] && git clone --depth=1 --single-branch $KERNEL_SOURCE $KERNEL_PATH

# Magisk
if [[ $OF_USE_LATEST_MAGISK = "true" || $OF_USE_LATEST_MAGISK = "1" ]]; then
echo "Downloading the Latest Release of Magisk..."
LATEST_MAGISK_URL="$(curl -sL https://api.github.com/repos/topjohnwu/Magisk/releases/latest | jq -r . | grep browser_download_url | grep Magisk- | cut -d : -f 2,3 | sed 's/"//g')"
mkdir -p ~/Magisk
cd ~/Magisk
aria2c $LATEST_MAGISK_URL 2>&1 || wget $LATEST_MAGISK_URL 2>&1
echo "Magisk Downloaded Successfully"
echo "Renaming .apk to .zip ..."
rename 's/.apk/.zip/' Magisk*
cd $SYNC_PATH >/dev/null
echo "Done!"
fi

# Exit
exit 0

0 comments on commit 4472d4f

Please sign in to comment.