inspec/omnibus/omnibus-test.sh

40 lines
1 KiB
Bash
Raw Normal View History

#!/bin/bash
set -eo pipefail
channel="${CHANNEL:-unstable}"
product="${PRODUCT:-inspec}"
version="${VERSION:-latest}"
echo "--- Installing $channel $product $version"
package_file="$(/opt/omnibus-toolchain/bin/install-omnibus-product -c "$channel" -P "$product" -v "$version" | tail -n 1)"
echo "--- Verifying omnibus package is signed"
/opt/omnibus-toolchain/bin/check-omnibus-package-signed "$package_file"
sudo rm -f "$package_file"
echo "--- Verifying ownership of package files"
export INSTALL_DIR=/opt/inspec
NONROOT_FILES="$(find "$INSTALL_DIR" ! -user 0 -print)"
if [[ "$NONROOT_FILES" == "" ]]; then
echo "Packages files are owned by root. Continuing verification."
else
echo "Exiting with an error because the following files are not owned by root:"
echo "$NONROOT_FILES"
exit 1
fi
echo "--- Running verification for $channel $product $version"
export CHEF_LICENSE="accept-no-persist"
project_root="$(pwd)"
export project_root
cd test/artifact
PATH=/opt/inspec/bin:/opt/inspec/embedded/bin:$PATH
export PATH
rake