|
4 | 4 | # This script: |
5 | 5 | # 1. Detects your OS (Linux or Darwin) and CPU arch (amd64 or arm64). |
6 | 6 | # 2. Resolves the latest prosa release from GitHub (or honors PROSA_VERSION). |
7 | | -# 3. Downloads each selected binary plus checksums.txt directly from |
8 | | -# the release page (no tar.gz intermediate). |
9 | | -# 4. Verifies each binary's sha256 before writing anything to disk. |
| 7 | +# 3. Downloads the per-platform release tarball plus checksums.txt. |
| 8 | +# 4. Verifies the release tarball sha256 before writing anything to disk. |
10 | 9 | # 5. Installs the prosa binary (and optionally prosa-server / prosa-panel) |
11 | 10 | # into $INSTALL_DIR (default ~/.local/bin). |
12 | 11 | # |
@@ -126,21 +125,32 @@ main() { |
126 | 125 | # shellcheck disable=SC2064 # expand $tmp at trap-registration time |
127 | 126 | trap "rm -rf '$tmp'" EXIT INT TERM |
128 | 127 |
|
| 128 | + require_cmd tar |
129 | 129 | curl -fsSL -o "$tmp/checksums.txt" "$base/checksums.txt" |
130 | 130 |
|
131 | 131 | mkdir -p "$INSTALL_DIR" |
132 | | - for bin in $INSTALL_BINS; do |
133 | | - asset="${bin}_${semver}_${OS}_${ARCH}" |
134 | | - info "downloading $asset ..." |
135 | | - curl -fsSL -o "$tmp/$asset" "$base/$asset" |
136 | 132 |
|
137 | | - expected=$(awk -v f="$asset" '$2 == f { print $1 }' "$tmp/checksums.txt") |
138 | | - if [ -z "$expected" ]; then |
139 | | - err "could not find $asset in checksums.txt" |
| 133 | + asset="prosa_${semver}_${OS}_${ARCH}.tar.gz" |
| 134 | + info "downloading $asset ..." |
| 135 | + curl -fsSL -o "$tmp/$asset" "$base/$asset" |
| 136 | + |
| 137 | + expected=$(awk -v f="$asset" '$2 == f { print $1 }' "$tmp/checksums.txt") |
| 138 | + if [ -z "$expected" ]; then |
| 139 | + err "could not find $asset in checksums.txt" |
| 140 | + fi |
| 141 | + sha256_verify "$tmp/$asset" "$expected" |
| 142 | + |
| 143 | + unpack="$tmp/unpacked" |
| 144 | + mkdir -p "$unpack" |
| 145 | + tar -xzf "$tmp/$asset" -C "$unpack" |
| 146 | + |
| 147 | + for bin in $INSTALL_BINS; do |
| 148 | + src="$unpack/$bin" |
| 149 | + if [ ! -f "$src" ]; then |
| 150 | + err "could not find $bin in $asset" |
140 | 151 | fi |
141 | | - sha256_verify "$tmp/$asset" "$expected" |
142 | 152 |
|
143 | | - install -m 0755 "$tmp/$asset" "$INSTALL_DIR/$bin" |
| 153 | + install -m 0755 "$src" "$INSTALL_DIR/$bin" |
144 | 154 | info "installed $bin -> $INSTALL_DIR/$bin" |
145 | 155 | done |
146 | 156 |
|
|
0 commit comments