reduce unnecessary output to get effective information
ref: commit 16cef539c517d0e6bd3495a1e3079214a8b4bd24
yum/dnf: -q, --quiet ref: https://linux.die.net/man/8/yum ref: https://www.man7.org/linux/man-pages/man8/dnf.8.html
apt-get: -q, --quiet Quiet. Produces output suitable for logging, omitting progress indicators. More q's will produce more quiet up to a maximum of two. Note that quiet level 2 implies -y. ref: https://linux.die.net/man/8/apt-get
pacman: -q, --quiet ref: https://archlinux.org/pacman/pacman.8.html
zypper: --quiet, -q ref: https://en.opensuse.org/SDB:Zypper_usage
Signed-off-by: Wang Yong wangyong0117@qq.com --- distro/aliyun | 24 ++++++++++++------------ distro/archlinux | 11 ++++++----- distro/debian | 15 ++++++++------- distro/installer/archlinux | 3 ++- distro/installer/centos | 8 ++++---- distro/installer/debian | 5 +++-- distro/installer/fedora | 2 +- distro/installer/opensuse | 2 +- distro/installer/oracle | 6 +++--- distro/installer/ubuntu | 2 +- 10 files changed, 41 insertions(+), 37 deletions(-)
diff --git a/distro/aliyun b/distro/aliyun index 83727ce32..83f058c33 100755 --- a/distro/aliyun +++ b/distro/aliyun @@ -9,17 +9,17 @@ shopt -s nullglob support_repo_epel() { if ! rpm -q epel-release >/dev/null; then - yum install -y epel-release + yum install -yq epel-release fi }
update_yum_into_dnf() { if ! rpm -q dnf >/dev/null; then - yum install -y dnf + yum install -yq dnf ln -sf /usr/bin/dnf /usr/bin/yum else - dnf makecache timer + dnf makecache timer >/dev/null fi }
@@ -46,7 +46,7 @@ distro_install_depends()
for pkg in $packages do - rpm --quiet --query $pkg || yum install -y $pkg + rpm --quiet --query $pkg || yum install -yq $pkg done done } @@ -73,8 +73,8 @@ yum_download() [ ${DISTRO^^} == "CENTOS" ] && support_repo_epel [ ${DISTRO^^} == "CENTOS" ] && update_yum_into_dnf
- echo "yum install -y --downloadonly $*" - yum install -y --downloadonly "$@" + echo "yum install -yq --downloadonly $*" + yum install -yq --downloadonly "$@" }
yum_pack() @@ -137,9 +137,9 @@ install_gcc7() wget -O /tmp/centos-release-scl-rh-2-3.el7.centos.noarch.rpm https://rpmfind.net/linux/centos/7/extras/x86_64/Packages/centos-release-scl... rpm -ivh --ignoresize /tmp/centos-release-scl-rh-2-3.el7.centos.noarch.rpm else - yum install -y centos-release-scl-rh + yum install -yq centos-release-scl-rh fi - yum install -y "devtoolset-7-gcc*" + yum install -yq "devtoolset-7-gcc*" source /opt/rh/devtoolset-7/enable }
@@ -148,7 +148,7 @@ download_ocfs2_tools() local pkgs=$1
mkdir -p /opt/rpms - yum install -y wget + yum install -yq wget
wget -nc -P /opt/rpms https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/ocfs2-t...
@@ -160,7 +160,7 @@ download_ocfs2_tools() fi
# Try to download the dependences of ocfs2-tools/ocfs2-tools-devel - yum install -y --downloadonly "$download_pkgs" + yum install -yq --downloadonly "$download_pkgs" }
install_ocfs2_tools() @@ -169,8 +169,8 @@ install_ocfs2_tools()
download_ocfs2_tools "$pkgs"
- yum install -y /opt/rpms/ocfs2-tools-1.8.6-11.el7.x86_64.rpm + yum install -yq /opt/rpms/ocfs2-tools-1.8.6-11.el7.x86_64.rpm
echo "$pkgs" | grep -q 'ocfs2-tools-devel' && \ - yum install -y /opt/rpms/ocfs2-tools-devel-1.8.6-11.el7.x86_64.rpm + yum install -yq /opt/rpms/ocfs2-tools-devel-1.8.6-11.el7.x86_64.rpm } diff --git a/distro/archlinux b/distro/archlinux index 59c8da1d6..dd4b2331c 100755 --- a/distro/archlinux +++ b/distro/archlinux @@ -43,8 +43,8 @@ find_pacman_package()
pacman_download() { - echo "pacman -Sw --noconfirm $*" - pacman -Sw --noconfirm "$@" + echo "pacman -Swq --noconfirm $*" + pacman -Swq --noconfirm "$@" }
pacman_pack() @@ -88,7 +88,8 @@ distro_install_depends()
for pkg in $packages do - pacman -Qq --noconfirm $pkg > /dev/null || pacman -Sy --noconfirm $pkg + pacman -Qq --noconfirm $pkg > /dev/null || pacman -Syq --noconfirm --needed $pkg >/tmp/pacman_info 2>&1 + [ -f /tmp/pacman_info ] && grep -v "warning: could not get file information for *" /tmp/pacman_info done done } @@ -115,13 +116,13 @@ add_aur_helper() { echo "lkp ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
- pacman -Q yay 2>/dev/null && return + pacman -Qq yay >/dev/null && return
local user=lkp local dir=/home/${user}
mkdir -p ${dir} && chown ${user}:${user} ${dir} - pacman -S --needed --noconfirm git base-devel 2>/dev/null + pacman -Sq --needed --noconfirm git base-devel 2>/dev/null su - ${user} -c "git clone https://aur.archlinux.org/yay.git" su - ${user} -c "cd yay && makepkg -si --needed --noconfirm" } diff --git a/distro/debian b/distro/debian index 21dafe21b..a1642cc1f 100755 --- a/distro/debian +++ b/distro/debian @@ -8,7 +8,7 @@ shopt -s nullglob
update() { - apt-get update + apt-get -qq update }
add_i386_package() @@ -18,8 +18,8 @@ add_i386_package()
download() { - echo apt-get download $* - apt-get download $* + echo apt-get -qq download $* + apt-get -qq download $* }
hardlink_to_symlink() @@ -128,7 +128,7 @@ resolve_depends() local deps=$* local command
- command="apt-get --simulate --no-install-recommends install $deps" + command="apt-get --simulate --no-install-recommends install -qq $deps" # using "bash -c" to support wildcard in apt-get. # if use wildcard in the package version variable, # apt-get will treat the wildcard as a normal character. @@ -193,7 +193,8 @@ distro_install_depends() do $chronic apt-get -o Dpkg::Options::=--force-confdef \ -o Dpkg::Options::=--force-confold \ - install -y --no-upgrade $package + install -qq --no-upgrade $package >/tmp/apt-get_info 2>&1 + grep -v "dpkg: warning: files list file for package '.*' missing;" /tmp/apt-get_info done done } @@ -225,7 +226,7 @@ fixup_distro_mirror()
fixup_preinstall() { - apt-get install -yf + apt-get install -qqf }
fixup_arch_install() @@ -235,7 +236,7 @@ fixup_arch_install()
dpkg --add-architecture i386 update - apt -y --allow-remove-essential --fix-broken install -o=APT::Architecture="i386" + apt --allow-remove-essential --fix-broken install -qq -o=APT::Architecture="i386" }
pack_benchmark_deps() diff --git a/distro/installer/archlinux b/distro/installer/archlinux index 3be9e7953..81ca82f73 100755 --- a/distro/installer/archlinux +++ b/distro/installer/archlinux @@ -13,4 +13,5 @@ add_aur_helper
regular_user=$(grep 1090 /etc/passwd | awk -F':' '{ print $1 }')
-sudo -u $regular_user yay -S --needed --noconfirm $* +sudo -u $regular_user yay -Sq --needed --noconfirm $* >/tmp/pacman_info 2>&1 +[ -f /tmp/pacman_info ] && grep -v "warning: could not get file information for *" /tmp/pacman_info diff --git a/distro/installer/centos b/distro/installer/centos index d9ad60038..704d3e3cc 100755 --- a/distro/installer/centos +++ b/distro/installer/centos @@ -1,12 +1,12 @@ #!/bin/bash
if ! rpm -q epel-release >/dev/null; then - [ ${DISTRO^^} == "OPENEULER" ] || yum install -y epel-release + [ ${DISTRO^^} == "OPENEULER" ] || yum install -yq epel-release if [ ${DISTRO^^} == "OPENEULER" ]; then - yum makecache timer + yum makecache timer >/dev/null else - yum makecache fast + yum makecache fast >/dev/null fi fi
-yum install -y $* +yum install -yq $* diff --git a/distro/installer/debian b/distro/installer/debian index 35b3209bd..8bf166458 100755 --- a/distro/installer/debian +++ b/distro/installer/debian @@ -2,7 +2,8 @@
# Debian package installation export DEBIAN_FRONTEND=noninteractive -dpkg --add-architecture i386 && apt-get update +dpkg --add-architecture i386 && apt-get -qq update apt-get -o Dpkg::Options::="--force-confdef" \ -o Dpkg::Options::="--force-confold" \ - -y install $* >/tmp/apt-get_info 2>&1 + -qq install $* +grep -v "dpkg: warning: files list file for package '.*' missing;" /tmp/apt-get_info diff --git a/distro/installer/fedora b/distro/installer/fedora index 1da708c2a..61176b361 100755 --- a/distro/installer/fedora +++ b/distro/installer/fedora @@ -1,3 +1,3 @@ #!/bin/sh
-dnf -y install $* +dnf -yq install $* diff --git a/distro/installer/opensuse b/distro/installer/opensuse index cbdbf4eff..392d77b4a 100755 --- a/distro/installer/opensuse +++ b/distro/installer/opensuse @@ -1,3 +1,3 @@ #!/bin/bash
-zypper install -y $* +zypper -q install -y $* diff --git a/distro/installer/oracle b/distro/installer/oracle index 11df716d6..c6881070c 100755 --- a/distro/installer/oracle +++ b/distro/installer/oracle @@ -1,8 +1,8 @@ #!/bin/sh
if ! rpm -q epel-release >/dev/null; then - yum install -y epel-release - yum makecache fast + yum install -yq epel-release + yum makecache fast >/dev/null fi
-yum install -y $* +yum install -yq $* diff --git a/distro/installer/ubuntu b/distro/installer/ubuntu index 541ba74f6..0ce801a79 100755 --- a/distro/installer/ubuntu +++ b/distro/installer/ubuntu @@ -6,4 +6,4 @@ dpkg --add-architecture i386 && apt-get update apt-get -o Dpkg::Options::="--force-confdef" \ -o Dpkg::Options::="--force-confold" \ -o Dpkg::Options::="--force-overwrite" \ - -y install $* + -qq install $*