# shellcheck shell=bash # Scenarios set what the runner and items read # shellcheck disable=SC2034 DESCRIPTION="install.sh piped into bash, as curl | bash runs it, then update" TIER=quick scenario() { step "Install the working copy, with jq missing" sudo apt-get remove -y jq > /dev/null 2>&1 export FEDERATED_CONNECTOR_SOURCE="$CONNECTOR" bash < "$CONNECTOR/install.sh" > "$HOME/install.log" 2>&1 check_eq "install.sh succeeds" 0 $? check "it installed jq again" pkg_installed jq check "configure is linked in ~/.local/bin" test -L "$HOME/.local/bin/configure" check "update is linked in ~/.local/bin" test -L "$HOME/.local/bin/update" check "the install is in place" test -x "$HOME/.local/share/federated-connector/connector/configure" check_eq "it records the version" local "$(cat "$HOME/.local/share/federated-connector/connector/.version")" check "configure is on PATH in a new bash" bash -ic 'command -v configure' < /dev/null check "it didn't ask to run configure without a terminal" grep -q "In a new terminal, run: configure" "$HOME/install.log" check "it wrote a log" compgen -G "$HOME/.local/state/federated-connector/install-*.log" step "update" check "update --version" "$HOME/.local/bin/update" --version "$HOME/.local/bin/update" > "$HOME/update.log" 2>&1 check_eq "update succeeds" 0 $? check "no staging folders are left" bash -c '! compgen -G "$HOME/.local/share/federated-connector/.connector-*"' check_eq "the PATH block is in ~/.bashrc once" 1 "$(grep -c '>>> Federated Connector commands >>>' "$HOME/.bashrc")" check "the installed configure runs" "$HOME/.local/bin/configure" --help }