Skip to content

Commit

Permalink
Make version reporting consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
topjohnwu committed Mar 23, 2020
1 parent 48d417f commit ba7cb47
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion native/jni/core/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion native/jni/core/magisk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]...
Expand Down
4 changes: 2 additions & 2 deletions native/jni/include/flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion native/jni/magiskboot/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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...]
Expand Down
2 changes: 1 addition & 1 deletion native/jni/magiskhide/magiskhide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion native/jni/magiskpolicy/magiskpolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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...]
Expand Down
2 changes: 1 addition & 1 deletion native/jni/resetprop/resetprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static bool check_legal_property_name(const char *name) {

[[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"
Expand Down
2 changes: 1 addition & 1 deletion native/jni/su/su.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 5 additions & 2 deletions scripts/addon.d.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions scripts/flash_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

1 comment on commit ba7cb47

@brad-hue
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.