From: Yousong Zhou <yszhou4tech@gmail.com> Date: Tue, 10 Nov 2020 13:30:29 +0000 (+0800) Subject: base-files: upgrade: add vn and variants X-Git-Tag: v21.02.0-rc1~1158 X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=7863c33ceaf155783861aa434cc81b5cf37f7a15;p=openwrt%2Fstaging%2Fchunkeey.git 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@gmail.com> --- 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() {