From 9b8a5e9bf3e8d607f5d732a691643ad0b939775b Mon Sep 17 00:00:00 2001 From: osm0sis Date: Tue, 21 Apr 2020 20:14:18 -0300 Subject: [PATCH] scripts: add author name back to module install banner print --- scripts/module_installer.sh | 12 ++++++++---- scripts/util_functions.sh | 13 +++++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/scripts/module_installer.sh b/scripts/module_installer.sh index 9a92bbc6a..2b391f8bb 100644 --- a/scripts/module_installer.sh +++ b/scripts/module_installer.sh @@ -48,12 +48,15 @@ is_legacy_script() { } print_modname() { - local len - len=`echo -n $MODNAME | wc -c` + local authlen len namelen pounds + namelen=`echo -n $MODNAME | wc -c` + authlen=$((`echo -n $MODAUTH | wc -c` + 3)) + [ $namelen -gt $authlen ] && len=$namelen || len=$authlen len=$((len + 2)) - local pounds=`printf "%${len}s" | tr ' ' '*'` + pounds=$(printf "%${len}s" | tr ' ' '*') ui_print "$pounds" ui_print " $MODNAME " + ui_print " by $MODAUTH " ui_print "$pounds" ui_print "*******************" ui_print " Powered by Magisk " @@ -95,8 +98,9 @@ unzip -o "$ZIPFILE" module.prop -d $TMPDIR >&2 $BOOTMODE && MODDIRNAME=modules_update || MODDIRNAME=modules MODULEROOT=$NVBASE/$MODDIRNAME MODID=`grep_prop id $TMPDIR/module.prop` -MODPATH=$MODULEROOT/$MODID MODNAME=`grep_prop name $TMPDIR/module.prop` +MODAUTH=`grep_prop author $TMPDIR/module.prop` +MODPATH=$MODULEROOT/$MODID # Create mod paths rm -rf $MODPATH 2>/dev/null diff --git a/scripts/util_functions.sh b/scripts/util_functions.sh index b12b6776e..ec3be90e2 100644 --- a/scripts/util_functions.sh +++ b/scripts/util_functions.sh @@ -61,11 +61,15 @@ resolve_vars() { } print_title() { - local len=$(echo -n $1 | wc -c) + local len line1len line2len pounds + line1len=$(echo -n $1 | wc -c) + line2len=$(echo -n $2 | wc -c) + [ $line1len -gt $line2len ] && len=$line1len || len=$line2len len=$((len + 2)) - local pounds=$(printf "%${len}s" | tr ' ' '*') + pounds=$(printf "%${len}s" | tr ' ' '*') ui_print "$pounds" ui_print " $1 " + [ "$2" ] && ui_print " $2 " ui_print "$pounds" } @@ -654,8 +658,9 @@ install_module() { $BOOTMODE && MODDIRNAME=modules_update || MODDIRNAME=modules local MODULEROOT=$NVBASE/$MODDIRNAME MODID=`grep_prop id $TMPDIR/module.prop` - MODPATH=$MODULEROOT/$MODID MODNAME=`grep_prop name $TMPDIR/module.prop` + MODAUTH=`grep_prop author $TMPDIR/module.prop` + MODPATH=$MODULEROOT/$MODID # Create mod paths rm -rf $MODPATH 2>/dev/null @@ -681,7 +686,7 @@ install_module() { ui_print "- Setting permissions" set_permissions else - print_title "$MODNAME" + print_title "$MODNAME" "by $MODAUTH" print_title "Powered by Magisk" unzip -o "$ZIPFILE" customize.sh -d $MODPATH >&2