[openwrt/openwrt] base-files: upgrade: add vn and variants

LEDE Commits lede-commits at lists.infradead.org
Wed Nov 11 10:47:02 EST 2020


yousong pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/7863c33ceaf155783861aa434cc81b5cf37f7a15

commit 7863c33ceaf155783861aa434cc81b5cf37f7a15
Author: Yousong Zhou <yszhou4tech at gmail.com>
AuthorDate: Tue Nov 10 21:30:29 2020 +0800

    base-files: upgrade: add vn and variants
    
    To be used with in the following pattern
    
      vn "Remaining: "
      for p in $xx; do
        _vn "$p"
      done
      _v
    
    Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
---
 package/base-files/files/lib/upgrade/common.sh | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh
index 2ae83f5bfb..0f25199365 100644
--- a/package/base-files/files/lib/upgrade/common.sh
+++ b/package/base-files/files/lib/upgrade/common.sh
@@ -63,8 +63,20 @@ ask_bool() {
 	[ "$answer" -gt 0 ]
 }
 
+_v() {
+	[ -n "$VERBOSE" ] && [ "$VERBOSE" -ge 1 ] && echo "$*" >&2
+}
+
+_vn() {
+	[ -n "$VERBOSE" ] && [ "$VERBOSE" -ge 1 ] && echo -n "$*" >&2
+}
+
 v() {
-	[ -n "$VERBOSE" ] && [ "$VERBOSE" -ge 1 ] && echo "$(date) upgrade: $@" >&2
+	_v "$(date) upgrade: $@"
+}
+
+vn() {
+	_vn "$(date) upgrade: $@"
 }
 
 json_string() {



More information about the lede-commits mailing list