diff options
Diffstat (limited to 'automated/linux/smoke/smoke.sh')
-rwxr-xr-x | automated/linux/smoke/smoke.sh | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/automated/linux/smoke/smoke.sh b/automated/linux/smoke/smoke.sh index 4482595..32f71b0 100755 --- a/automated/linux/smoke/smoke.sh +++ b/automated/linux/smoke/smoke.sh @@ -1,32 +1,35 @@ #!/bin/sh +# shellcheck disable=SC1091 . ../../lib/sh-test-lib OUTPUT="$(pwd)/output" RESULT_FILE="${OUTPUT}/result.txt" +export RESULT_FILE usage() { echo "Usage: $0 [-s <true|false>]" 1>&2 exit 1 } -while getopts "s:" o; do +while getopts "s:h" o; do case "$o" in s) SKIP_INSTALL="${OPTARG}" ;; - *) usage ;; + h|*) usage ;; esac done install() { dist_name + # shellcheck disable=SC2154 case "${dist}" in - Debian|Ubuntu) pkgs="lsb-release" ;; - Fedora|CentOS) pkgs="redhat-lsb-core" ;; + Debian|Ubuntu) install_deps "lsb-release" "${SKIP_INSTALL}";; + Fedora|CentOS) install_deps "redhat-lsb-core" "${SKIP_INSTALL}";; + Unknown) warn_msg "Unsupported distro: package install skipped" ;; esac - - install_deps "${pkgs}" "${SKIP_INSTALL}" } run() { + # shellcheck disable=SC2039 local test="$1" test_case_id="$(echo "${test}" | awk '{print $1}')" echo @@ -36,6 +39,7 @@ run() { } # Test run. +! check_root && error_msg "Please run this script as root." [ -d "${OUTPUT}" ] && mv "${OUTPUT}" "${OUTPUT}_$(date +%Y%m%d%H%M%S)" mkdir -p "${OUTPUT}" |