Skip to content

Commit 705ba2f

Browse files
committed
Update install.sh
1 parent c0a373e commit 705ba2f

1 file changed

Lines changed: 22 additions & 20 deletions

File tree

vix-site/public/install.sh

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@ if [ -t 2 ] && [ "${NO_COLOR:-}" = "" ]; then
3636
C_RED="$(printf '\033[31m')"
3737
C_GREEN="$(printf '\033[32m')"
3838
C_YELLOW="$(printf '\033[33m')"
39+
C_CYAN="$(printf '\033[36m')"
3940
C_DIM="$(printf '\033[2m')"
4041
else
4142
C_RESET=""
4243
C_BOLD=""
4344
C_RED=""
4445
C_GREEN=""
4546
C_YELLOW=""
47+
C_CYAN=""
4648
C_DIM=""
4749
fi
4850

@@ -397,34 +399,30 @@ verify_checksum() {
397399
fi
398400

399401
expected="$(
400-
awk '
401-
{
402-
for (i = 1; i <= NF; i++) {
403-
if (
404-
length($i) == 64 &&
405-
$i !~ /[^0-9a-fA-F]/
406-
) {
407-
print tolower($i)
408-
exit
409-
}
410-
}
411-
}
412-
' "$sha_file"
402+
sed -n 's/^\([0-9a-fA-F]\{64\}\).*/\1/p' "$sha_file" |
403+
head -n 1 |
404+
tr 'A-F' 'a-f'
413405
)"
414406

415407
[ -n "$expected" ] || die "invalid sha256 file"
416408

417409
if have sha256sum; then
418-
actual="$(sha256sum "$archive" | awk '{print tolower($1)}')"
410+
actual="$(
411+
sha256sum "$archive" |
412+
awk '{print $1}' |
413+
tr 'A-F' 'a-f'
414+
)"
419415
else
420-
actual="$(shasum -a 256 "$archive" | awk '{print tolower($1)}')"
416+
actual="$(
417+
shasum -a 256 "$archive" |
418+
awk '{print $1}' |
419+
tr 'A-F' 'a-f'
420+
)"
421421
fi
422422

423423
[ -n "$actual" ] || die "could not calculate archive sha256"
424-
425424
[ "$expected" = "$actual" ] || die "sha256 mismatch"
426425
}
427-
428426
verify_signature() {
429427
archive="$1"
430428
sig_file="$2"
@@ -574,15 +572,19 @@ TMP_DIR="$(mktemp -d 2>/dev/null || mktemp -d -t vix)"
574572

575573
trap cleanup EXIT HUP INT TERM
576574

577-
printf " ▲ %sVix.cpp%s %sinstaller%s\n" \
575+
printf " %s▲%s %s%sVix.cpp%s installer\n" \
576+
"$C_CYAN" \
577+
"$C_RESET" \
578578
"$C_BOLD" \
579+
"$C_GREEN" \
579580
"$C_RESET" \
581+
>&2
582+
583+
printf " %s------------------------------------%s\n" \
580584
"$C_DIM" \
581585
"$C_RESET" \
582586
>&2
583587

584-
printf " ------------------------------------\n" >&2
585-
586588
TAG="$(resolve_version)"
587589
BASE_URL="https://github.com/${VIX_REPO}/releases/download/${TAG}"
588590

0 commit comments

Comments
 (0)