Make version reporting consistent

This commit is contained in:
topjohnwu 2020-03-23 01:17:13 -07:00
parent 48d417f9af
commit ba7cb47383
10 changed files with 19 additions and 13 deletions

View File

@ -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);

View File

@ -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]...

View File

@ -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

View File

@ -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 <action> [args...]

View File

@ -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"

View File

@ -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...]

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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