1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
#!/bin/bash
#
# Copyright (C) 2023 Canonical Ltd.
# Author: Bryce Harrington <bryce@canonical.com>
set -efu
# Examine the package's deb for what it installs
commands=$(dpkg -L sg3-utils | grep /usr/bin)
exceptions=(
'/usr/bin/scsi_satl'
'/usr/bin/sg_dd'
'/usr/bin/sg_emc_trespass'
'/usr/bin/sg_map'
'/usr/bin/sg_rdac'
'/usr/bin/sg_scan'
'/usr/bin/sginfo'
)
ret=0
for cmd in ${commands}; do
if [ ! -f "${cmd}" ]; then
continue
fi
test -e "${cmd}"
if "${cmd}" --help > /dev/null 2>&1; then
echo "${cmd}: OK"
else
found=
for e in "${exceptions[@]}"; do
if [ "${e}" = "${cmd}" ]; then
found="yes"
fi
done
if [ "${found}" = "yes" ]; then
# This command is expected to emit a non-zero exit code for --help,
# so treat it as a non-error (just an inconsistency, thus XFAIL).
echo "${cmd}: XFAIL"
else
echo "${cmd}: ERROR: No --help option?"
ret=1
fi
fi
done
exit "${ret}"
|