From b9fedb6868306a6e3145b7ee851ea3a84353df9c Mon Sep 17 00:00:00 2001 From: "guillaume.lambert" Date: Tue, 10 May 2022 22:04:23 +0200 Subject: Stop bashing functest scripts Though bash is a good interactive user shell and apart portability concerns, many UN*X systems and GNU+Linux distributions now prefers Almquist or Kornshell variants for scripting in order to improve the system performance and maintenability. https://wiki.ubuntu.com/DashAsBinSh https://mywiki.wooledge.org/Bashism https://en.wikipedia.org/wiki/Almquist_shell Signed-off-by: guillaume.lambert Change-Id: I32c5490f9eab54e6cac594f3eac1e392edf8b272 --- functest/ci/add_proxy.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'functest/ci/add_proxy.sh') diff --git a/functest/ci/add_proxy.sh b/functest/ci/add_proxy.sh index 082141073..9d7db22e4 100644 --- a/functest/ci/add_proxy.sh +++ b/functest/ci/add_proxy.sh @@ -1,8 +1,9 @@ -#!/bin/bash +#!/bin/sh set -e -pushd "${1:-/home/opnfv/functest/images}" > /dev/null +initdir=$(pwd) +cd "${1:-/home/opnfv/functest/images}" http_proxy_host=${http_proxy_host:-proxy} http_proxy_port=${http_proxy_port:-8080} @@ -89,7 +90,7 @@ for image in $images; do fi guestmount -a "${image}" -i --rw "${tmpdir}" add_proxy "${tmpdir}/etc/environment" - if [[ ${image} == "ubuntu"* ]]; then + if expr "$image" : 'ubuntu' ; then add_proxy_apt "${tmpdir}/etc/apt/apt.conf" add_proxy_juju_env "${tmpdir}/etc/juju-proxy.conf" add_proxy_juju_systemd "${tmpdir}/etc/juju-proxy-systemd.conf" @@ -133,5 +134,5 @@ else fi rmdir "${tmpdir}" -popd > /dev/null +cd initdir -- cgit 1.2.3-korg