diff --git a/native/jni/core/daemon.cpp b/native/jni/core/daemon.cpp index 2c1604417..940dfc7c1 100644 --- a/native/jni/core/daemon.cpp +++ b/native/jni/core/daemon.cpp @@ -124,7 +124,7 @@ static void main_daemon() { }); } - LOGI(SHOW_VER(Magisk) " daemon started\n"); + LOGI(NAME_WITH_VER(Magisk) " daemon started\n"); // Get server stat stat("/proc/self/exe", &self_st); diff --git a/native/jni/core/magisk.cpp b/native/jni/core/magisk.cpp index 94ce92c33..0c9d0e32d 100644 --- a/native/jni/core/magisk.cpp +++ b/native/jni/core/magisk.cpp @@ -15,7 +15,7 @@ using namespace std::literals; [[noreturn]] static void usage() { fprintf(stderr, -FULL_VER(Magisk) R"EOF( multi-call binary +NAME_WITH_VER(Magisk) R"EOF( multi-call binary Usage: magisk [applet [arguments]...] or: magisk [options]... diff --git a/native/jni/include/flags.h b/native/jni/include/flags.h index b2444c6ff..001b4b6fd 100644 --- a/native/jni/include/flags.h +++ b/native/jni/include/flags.h @@ -11,9 +11,9 @@ #define MAGISK_VERSION str(__MVSTR) #define MAGISK_VER_CODE __MCODE +#define MAGISK_FULL_VER MAGISK_VERSION "(" str(MAGISK_VER_CODE) ")" -#define SHOW_VER(name) str(name) " v" MAGISK_VERSION "(" str(MAGISK_VER_CODE) ")" -#define FULL_VER(name) SHOW_VER(name) " (by topjohnwu)" +#define NAME_WITH_VER(name) str(name) " " MAGISK_FULL_VER #ifdef __MDBG #define MAGISK_DEBUG diff --git a/native/jni/magiskboot/main.cpp b/native/jni/magiskboot/main.cpp index 7d68592a1..71afdf43e 100644 --- a/native/jni/magiskboot/main.cpp +++ b/native/jni/magiskboot/main.cpp @@ -16,7 +16,7 @@ using namespace std; static void usage(char *arg0) { fprintf(stderr, -FULL_VER(MagiskBoot) R"EOF( - Boot Image Modification Tool +NAME_WITH_VER(MagiskBoot) R"EOF( - Boot Image Modification Tool Usage: %s [args...] diff --git a/native/jni/magiskhide/magiskhide.cpp b/native/jni/magiskhide/magiskhide.cpp index 888a78860..cceab78ed 100644 --- a/native/jni/magiskhide/magiskhide.cpp +++ b/native/jni/magiskhide/magiskhide.cpp @@ -20,7 +20,7 @@ bool hide_enabled = false; [[noreturn]] static void usage(char *arg0) { fprintf(stderr, - FULL_VER(MagiskHide) "\n\n" + NAME_WITH_VER(MagiskHide) "\n\n" "Usage: %s [action [arguments...] ]\n\n" "Actions:\n" " status Return the status of magiskhide\n" diff --git a/native/jni/magiskpolicy/magiskpolicy.cpp b/native/jni/magiskpolicy/magiskpolicy.cpp index 42bf95a11..e9be0b011 100644 --- a/native/jni/magiskpolicy/magiskpolicy.cpp +++ b/native/jni/magiskpolicy/magiskpolicy.cpp @@ -12,7 +12,7 @@ using namespace std::literals; [[noreturn]] static void usage(char *arg0) { fprintf(stderr, -FULL_VER(MagiskPolicy) R"EOF( +NAME_WITH_VER(MagiskPolicy) R"EOF( Usage: %s [--options...] [policy statements...] diff --git a/native/jni/resetprop/resetprop.cpp b/native/jni/resetprop/resetprop.cpp index f3670e246..51e2a6eb1 100644 --- a/native/jni/resetprop/resetprop.cpp +++ b/native/jni/resetprop/resetprop.cpp @@ -55,7 +55,7 @@ illegal: [[noreturn]] static void usage(char* arg0) { fprintf(stderr, - FULL_VER(resetprop) " - System Props Modification Tool\n\n" + NAME_WITH_VER(resetprop) " - System Props Modification Tool\n\n" "Usage: %s [flags] [options...]\n" "\n" "Options:\n" diff --git a/native/jni/su/su.cpp b/native/jni/su/su.cpp index 043334a8a..bb43f5d6c 100644 --- a/native/jni/su/su.cpp +++ b/native/jni/su/su.cpp @@ -34,7 +34,7 @@ static void usage(int status) { FILE *stream = (status == EXIT_SUCCESS) ? stdout : stderr; fprintf(stream, - FULL_VER(MagiskSU) "\n\n" + NAME_WITH_VER(MagiskSU) "\n\n" "Usage: su [options] [-] [user [argument...]]\n\n" "Options:\n" " -c, --command COMMAND pass COMMAND to the invoked shell\n" diff --git a/scripts/addon.d.sh b/scripts/addon.d.sh index 16421b3e2..016560673 100644 --- a/scripts/addon.d.sh +++ b/scripts/addon.d.sh @@ -74,8 +74,11 @@ main() { $BOOTMODE || recovery_actions - PRETTY_VER=$MAGISK_VER - echo $PRETTY_VER | grep -q '\.' && PRETTY_VER=v$PRETTY_VER + if echo $MAGISK_VER | grep -q '\.'; then + PRETTY_VER=$MAGISK_VER + else + PRETTY_VER="$MAGISK_VER($MAGISK_VER_CODE)" + fi print_title "Magisk $PRETTY_VER addon.d" mount_partitions diff --git a/scripts/flash_script.sh b/scripts/flash_script.sh index 488312ad4..f1648cbb7 100644 --- a/scripts/flash_script.sh +++ b/scripts/flash_script.sh @@ -34,8 +34,11 @@ setup_flashable # Detection ############ -PRETTY_VER=$MAGISK_VER -echo $PRETTY_VER | grep -q '\.' && PRETTY_VER=v$PRETTY_VER +if echo $MAGISK_VER | grep -q '\.'; then + PRETTY_VER=$MAGISK_VER +else + PRETTY_VER="$MAGISK_VER($MAGISK_VER_CODE)" +fi print_title "Magisk $PRETTY_VER Installer" is_mounted /data || mount /data || is_mounted /cache || mount /cache