[PATCH v2 lkp-tests 1/4] bin/install-dependencies.sh: refactor file

all dependent functions is move to lib/env.sh, sbin/set-env.sh in not required. Signed-off-by: Wei Jihui <weijihuiall@163.com> --- sbin/install-dependencies.sh | 40 +++++++++++++++++------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/sbin/install-dependencies.sh b/sbin/install-dependencies.sh index 7605a29f..b4d3ad22 100755 --- a/sbin/install-dependencies.sh +++ b/sbin/install-dependencies.sh @@ -1,30 +1,28 @@ #!/bin/bash . $LKP_SRC/lib/env.sh -. $LKP_SRC/sbin/set-env.sh -# choose install function base on -# DISTRIBUTION +# choose install function base on DISTRIBUTION linux_dep() { -source /etc/os-release -case $ID in -ubuntu|debian) - export DEBIAN_FRONTEND=noninteractive - apt-get install -yqm ruby-git ruby-activesupport ruby-rest-client - ;; -openEuler|fedora|rhel|centos) - if type dnf > /dev/null 2>&1; then - dnf install -y --skip-broken ruby rubygems gcc gcc-c++ make ruby-devel git - else - yum install -y --skip-broken ruby rubygems gcc gcc-c++ make ruby-devel git - fi - sudo gem install -f git activesupport rest-client - ;; -*) - echo "$ID not support! please install dependencies manually." - ;; -esac + source /etc/os-release + case $ID in + ubuntu|debian) + export DEBIAN_FRONTEND=noninteractive + apt-get install -yqm ruby-git ruby-activesupport ruby-rest-client + ;; + openEuler|fedora|rhel|centos) + if type dnf > /dev/null 2>&1; then + dnf install -y --skip-broken ruby rubygems gcc gcc-c++ make ruby-devel git + else + yum install -y --skip-broken ruby rubygems gcc gcc-c++ make ruby-devel git + fi + sudo gem install -f git activesupport rest-client + ;; + *) + echo "$ID not support! please install dependencies manually." + ;; + esac } -- 2.23.0

On Mon, Dec 21, 2020 at 02:46:22PM +0800, Wei Jihui wrote:
all dependent functions is move to lib/env.sh, sbin/set-env.sh in not required.
Signed-off-by: Wei Jihui <weijihuiall@163.com> --- sbin/install-dependencies.sh | 40 +++++++++++++++++------------------- 1 file changed, 19 insertions(+), 21 deletions(-)
diff --git a/sbin/install-dependencies.sh b/sbin/install-dependencies.sh index 7605a29f..b4d3ad22 100755 --- a/sbin/install-dependencies.sh +++ b/sbin/install-dependencies.sh @@ -1,30 +1,28 @@
+ if type dnf > /dev/null 2>&1; then
no need to add 2>&1 if >/dev/null Thanks, Yong

On Mon, Dec 21, 2020 at 04:48:19PM +0800, Wang Yong wrote:
On Mon, Dec 21, 2020 at 02:46:22PM +0800, Wei Jihui wrote:
all dependent functions is move to lib/env.sh, sbin/set-env.sh in not required.
Signed-off-by: Wei Jihui <weijihuiall@163.com> --- sbin/install-dependencies.sh | 40 +++++++++++++++++------------------- 1 file changed, 19 insertions(+), 21 deletions(-)
diff --git a/sbin/install-dependencies.sh b/sbin/install-dependencies.sh index 7605a29f..b4d3ad22 100755 --- a/sbin/install-dependencies.sh +++ b/sbin/install-dependencies.sh @@ -1,30 +1,28 @@
+ if type dnf > /dev/null 2>&1; then
no need to add 2>&1 if >/dev/null
if: tyep dnf > /dev/null will return error "comand not found" so, i think it's better to take out "2>&1" !
Thanks, Yong

On Mon, Dec 21, 2020 at 10:37:25PM +0800, Zhang Dewan wrote:
On Mon, Dec 21, 2020 at 04:48:19PM +0800, Wang Yong wrote:
On Mon, Dec 21, 2020 at 02:46:22PM +0800, Wei Jihui wrote:
all dependent functions is move to lib/env.sh, sbin/set-env.sh in not required.
Signed-off-by: Wei Jihui <weijihuiall@163.com> --- sbin/install-dependencies.sh | 40 +++++++++++++++++------------------- 1 file changed, 19 insertions(+), 21 deletions(-)
diff --git a/sbin/install-dependencies.sh b/sbin/install-dependencies.sh index 7605a29f..b4d3ad22 100755 --- a/sbin/install-dependencies.sh +++ b/sbin/install-dependencies.sh @@ -1,30 +1,28 @@
+ if type dnf > /dev/null 2>&1; then
no need to add 2>&1 if >/dev/null
if: tyep dnf > /dev/null will return error "comand not found" so, i think it's better to take out "2>&1" !
$ type dnf > /dev/null bash: type: dnf:未找到 $ command -v dnf > /dev/null $ yes, it's different. Thanks, Yong
participants (3)
-
Wang Yong
-
Wei Jihui
-
Zhang Dewan