refactor: more portable wget usage

This commit is contained in:
decentral1se 2022-01-01 21:33:50 +01:00
parent 0b17292219
commit 575485ec7a
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
2 changed files with 7 additions and 7 deletions

View File

@ -121,11 +121,11 @@ the testing efforts!
Flags: []cli.Flag{internal.RCFlag},
Action: func(c *cli.Context) error {
mainURL := "https://install.abra.coopcloud.tech"
cmd := exec.Command("bash", "-c", fmt.Sprintf("curl -s %s | bash", mainURL))
cmd := exec.Command("bash", "-c", fmt.Sprintf("wget -q -O- %s | bash", mainURL))
if internal.RC {
releaseCandidateURL := "https://git.coopcloud.tech/coop-cloud/abra/raw/branch/main/scripts/installer/installer"
cmd = exec.Command("bash", "-c", fmt.Sprintf("curl -s %s | bash -s -- --rc", releaseCandidateURL))
cmd = exec.Command("bash", "-c", fmt.Sprintf("wget -q -O- %s | bash -s -- --rc", releaseCandidateURL))
}
logrus.Debugf("attempting to run %s", cmd)

View File

@ -37,8 +37,8 @@ function print_checksum_error {
function install_abra_release {
mkdir -p "$HOME/.local/bin"
if ! type "curl" > /dev/null 2>&1; then
echo "'curl' is not installed, cannot proceed..."
if ! type "wget" > /dev/null 2>&1; then
echo "'wget' is not installed, cannot proceed..."
echo "perhaps try installing manually via the releases URL?"
echo "https://git.coopcloud.tech/coop-cloud/abra/releases"
exit 1
@ -50,15 +50,15 @@ function install_abra_release {
sed_command_rel='s/.*"assets":\[\{[^]]*"name":"'$FILENAME'"[^}]*"browser_download_url":"([^"]*)".*\].*/\1/p'
sed_command_checksums='s/.*"assets":\[\{[^\]*"name":"checksums.txt"[^}]*"browser_download_url":"([^"]*)".*\].*/\1/p'
json=$(curl -s $ABRA_RELEASE_URL)
json=$(wget -q -O- $ABRA_RELEASE_URL)
release_url=$(echo $json | sed -En $sed_command_rel)
checksums_url=$(echo $json | sed -En $sed_command_checksums)
checksums=$(curl -s $checksums_url)
checksums=$(wget -q -0- $checksums_url)
checksum=$(echo "$checksums" | grep "$FILENAME" - | sed -En 's/([0-9a-f]{64})\s+'"$FILENAME"'.*/\1/p')
echo "downloading $ABRA_VERSION $PLATFORM binary release for abra..."
curl --progress-bar "$release_url" --output "$HOME/.local/bin/.abra-download"
wget -q --show-progress "$release_url" -O "$HOME/.local/bin/.abra-download"
localsum=$(sha256sum $HOME/.local/bin/.abra-download | sed -En 's/([0-9a-f]{64})\s+.*/\1/p')
echo "checking if checksums match..."
if [[ "$localsum" != "$checksum" ]]; then