From 9908c9a90961a5e4d0ef9905a1cc8e82b2fac6c6 Mon Sep 17 00:00:00 2001 From: Howard Wu <40033067+Howard20181@users.noreply.github.com> Date: Wed, 31 Aug 2022 01:10:20 +0800 Subject: [PATCH] Check if custom Magisk exists --- scripts/build.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index 280fb8a16a..7f8c7c2116 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -234,19 +234,25 @@ declare -A RELEASE_NAME_MAP=(["retail"]="Retail" ["RP"]="Release Preview" ["WIS" RELEASE_NAME=${RELEASE_NAME_MAP[$RELEASE_TYPE]} || abort echo -e "build: ARCH=$ARCH\nRELEASE_TYPE=$RELEASE_NAME\nMAGISK_VER=$MAGISK_VER\nGAPPS_VARIANT=$GAPPS_VARIANT\nROOT_SOL=$ROOT_SOL" -if [ "$(sudo whoami)" != "root" ]; then - sudo echo "" -fi + WSA_ZIP_PATH=$DOWNLOAD_DIR/wsa-$ARCH-$RELEASE_TYPE.zip vclibs_PATH=$DOWNLOAD_DIR/vclibs-"$ARCH".appx xaml_PATH=$DOWNLOAD_DIR/xaml-"$ARCH".appx MAGISK_PATH=$DOWNLOAD_DIR/magisk-$MAGISK_VER.zip +if [ "$CUSTOM_MAGISK" ]; then + if [ ! -f "$MAGISK_PATH" ]; then + echo "Custom Magisk not found, please rename it to magisk-debug.zip and put it in $DOWNLOAD_DIR" + abort + fi +fi if [ "$GAPPS_BRAND" = "OpenGApps" ]; then GAPPS_PATH="$DOWNLOAD_DIR"/OpenGApps-$ARCH-$GAPPS_VARIANT.zip else GAPPS_PATH="$DOWNLOAD_DIR"/MindTheGapps-"$ARCH".zip fi - +if [ "$(sudo whoami)" != "root" ]; then + sudo echo "sudo is required to run this script" +fi if [ -z "${OFFLINE+x}" ]; then trap 'rm -f -- "${DOWNLOAD_DIR:?}/${DOWNLOAD_CONF_NAME}"' EXIT echo "Generate Download Links"