Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to install aqua via powershell oneliner #578

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

airtonix
Copy link

@airtonix airtonix commented Jan 4, 2024

fixes #577
fixes aquaproj/aqua#2403

Allows installing aqua with either of two formats:

iwr https://raw.githubusercontent.com/aquaproj/aqua-installer/master/aqua-installer.ps1 | iex

or for specific version

& ([scriptblock]::Create((iwr https://raw.githubusercontent.com/aquaproj/aqua-installer/master/aqua-installer.ps1))) -param1 v2.2.0

@suzuki-shunsuke
Copy link
Member

Thank you for your contribution!

@suzuki-shunsuke
Copy link
Member

We'd like to do the same thing with aqua-installer for security.
aqua-installer does the checksum verification, verify checksum files and SLSA provenance.
aqua-installer achieves these things by

  1. install a specific version of aqua for bootstrapping

bootstrap_version=v2.16.4
checksums="34ad1e7f88e6fcc13f3bed2e7470ab570c4440aaa441e1b545cc514c571e9a2f aqua_darwin_arm64.tar.gz
468c6c51f37196e6c21a096498eb4d3f7ba5cea3593b44af89087f571c207bc9 aqua_windows_amd64.tar.gz
6c2b6165000f3f2c5f04bbb52c8fe97b686cfbaa80493d866ad6770400b1773e aqua_linux_arm64.tar.gz
7457ea4870f953de17c68fe8f86b3243c14890aa94a05e713d3c22ef401968b2 aqua_linux_amd64.tar.gz
c49f010e7e731ed62e7289169162001413f319cb593250a525aae26ee4551c3f aqua_darwin_amd64.tar.gz
dcbc4c160827187504994a8f2ec4b5b7944a05da48b011de7a6cade9becd14e5 aqua_windows_arm64.tar.gz"
filename=aqua_${OS}_${ARCH}.tar.gz
URL=https://github.com/aquaproj/aqua/releases/download/$bootstrap_version/$filename
tempdir=$(mktemp -d)
echo "[INFO] Installing aqua $bootstrap_version for bootstrapping..." >&2
echo "[INFO] Downloading $URL ..." >&2
if command -v curl > /dev/null 2>&1; then
curl --fail -L "$URL" -o "$tempdir/$filename"
elif command -v wget > /dev/null 2>&1; then
wget -P "$tempdir" "$URL"
else
echo "[ERROR] Neither curl nor wget is found. Please install either curl or wget to download aqua" >&2
exit 1
fi
cd "$tempdir"
echo "[INFO] Verifying checksum of aqua $bootstrap_version ..." >&2
if command -v sha256sum > /dev/null 2>&1; then
echo "$checksums" | grep "$filename" | sha256sum -c
elif command -v shasum > /dev/null 2>&1; then
echo "$checksums" | grep "$filename" | shasum -a 256 -c
else
echo "[WARN] Skipped checksum verification of aqua $bootstrap_version because both sha256sum and shasum commands aren't found" >&2
fi

  1. install aqua by aqua update-aqua command. aqua update-aqua does the checksum verification, verify checksum files and SLSA provenance

if [ -n "${version:-}" ]; then
echo "[INFO] $tempdir/aqua update-aqua $version" >&2
./aqua update-aqua "$version"
else
echo "[INFO] $tempdir/aqua update-aqua" >&2
./aqua update-aqua
fi

@suzuki-shunsuke
Copy link
Member

Oh, I remembered aqua update-aqua has a known issue on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow installing from powershell via web Provide a PowerShell script to install aqua
2 participants