From 73fc6499d8416fc262c5d28688b91bf4580ab2b8 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 28 Jun 2021 09:06:06 +0200 Subject: [PATCH 1/3] [fix] utils/lib.sh: in a pipe, do not print ASCII escape code In 2a12637 an ASCII escape code was added, such escape codes should not be written to pipes (when the output is not a terminal). Signed-off-by: Markus Heiser --- utils/lib.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/utils/lib.sh b/utils/lib.sh index b75e3376..185012c5 100755 --- a/utils/lib.sh +++ b/utils/lib.sh @@ -78,9 +78,18 @@ required_commands() { # shellcheck disable=SC2034 set_terminal_colors() { - _colors=8 + # https://en.wikipedia.org/wiki/ANSI_escape_code + + # CSI (Control Sequence Introducer) sequences + _show_cursor='\e[?25h' + _hide_cursor='\e[?25l' + + # SGR (Select Graphic Rendition) parameters _creset='\e[0m' # reset all attributes + # original specification only had 8 colors + _colors=8 + _Black='\e[0;30m' _White='\e[1;37m' _Red='\e[0;31m' @@ -271,7 +280,7 @@ prefix_stdout () { echo -e "${prefix}$line" done) # some piped commands hide the cursor, show cursory when the stream ends - echo -en "\e[?25h" + echo -en "$_show_cursor" } append_line() { From b3ff510e10f6496876fab329bda55f056faa2431 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 28 Jun 2021 09:27:10 +0200 Subject: [PATCH 2/3] [fix] pacman --noprogressbar in shell scripts From pacman's man page: --noprogressbar Do not show a progress bar when downloading files. This can be useful for scripts that call pacman and capture the output. Signed-off-by: Markus Heiser --- utils/lib.sh | 4 ++-- utils/lxc.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/lib.sh b/utils/lib.sh index 185012c5..014d4a74 100755 --- a/utils/lib.sh +++ b/utils/lib.sh @@ -1557,7 +1557,7 @@ pkg_install() { ;; arch) # shellcheck disable=SC2068 - pacman -Sy --noconfirm $@ + pacman --noprogressbar -Sy --noconfirm $@ ;; fedora) # shellcheck disable=SC2068 @@ -1589,7 +1589,7 @@ pkg_remove() { ;; arch) # shellcheck disable=SC2068 - pacman -R --noconfirm $@ + pacman --noprogressbar -R --noconfirm $@ ;; fedora) # shellcheck disable=SC2068 diff --git a/utils/lxc.sh b/utils/lxc.sh index 90c4949a..f94e9841 100755 --- a/utils/lxc.sh +++ b/utils/lxc.sh @@ -45,8 +45,8 @@ ubu2010_boilerplate="$ubu1904_boilerplate" # shellcheck disable=SC2034 archlinux_boilerplate=" -pacman -Syu --noconfirm -pacman -S --noconfirm inetutils git curl wget sudo +pacman --noprogressbar -Syu --noconfirm +pacman --noprogressbar -S --noconfirm inetutils git curl wget sudo echo 'Set disable_coredump false' >> /etc/sudo.conf " From 129ed4c9fa712fd3445442ac5355a847682da333 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sat, 3 Jul 2021 18:25:46 +0200 Subject: [PATCH 3/3] [mod] add Makfile target lxc.clean which deletes ./lxc-env Signed-off-by: Markus Heiser --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index ea743dd3..2b9dfacc 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,9 @@ clean: py.clean docs.clean node.clean test.clean $(Q)find . -name '*~' -exec rm -f {} + $(Q)find . -name '*.bak' -exec rm -f {} + +lxc.clean: + $(Q)rm -rf lxc-env + PHONY += search.checker search.checker.% search.checker: install $(Q)./manage pyenv.cmd searx-checker -v