diff options
Diffstat (limited to '')
| -rwxr-xr-x | scripts/deploy.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/deploy.sh b/scripts/deploy.sh index b18d462..63bd31c 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh | |||
| @@ -95,6 +95,20 @@ origin=$(printf '%s' "$URL" | sed -E 's#^(https?://[^/]+).*#\1#') | |||
| 95 | grep -oE '[0-9a-f]{64} [A-Za-z0-9._-]+' "$tmp/page.html" > "$tmp/sums" || true | 95 | grep -oE '[0-9a-f]{64} [A-Za-z0-9._-]+' "$tmp/page.html" > "$tmp/sums" || true |
| 96 | [ -s "$tmp/sums" ] || die "no SHA-256 lines on the page (is index.php being served?)" | 96 | [ -s "$tmp/sums" ] || die "no SHA-256 lines on the page (is index.php being served?)" |
| 97 | 97 | ||
| 98 | for script in install.sh install.ps1; do | ||
| 99 | grep -qE "href=\"[^\"]*/$script\"" "$tmp/page.html" \ | ||
| 100 | || die "$script is not linked from the page" | ||
| 101 | curl -fsSL --max-time 30 "$origin/$script" -o "$tmp/$script" \ | ||
| 102 | || die "could not fetch $script" | ||
| 103 | cmp -s "web/$script" "$tmp/$script" \ | ||
| 104 | || die "$script served from the site differs from the local file" | ||
| 105 | done | ||
| 106 | |||
| 107 | curl -fsSL --max-time 30 "$origin/latest.php" -o "$tmp/latest.txt" \ | ||
| 108 | || die "could not fetch latest.php" | ||
| 109 | newest=$(awk '$1 == "version" { print $2; exit }' "$tmp/latest.txt") | ||
| 110 | [ -n "$newest" ] || die "latest.php has no version line" | ||
| 111 | |||
| 98 | failed=0 | 112 | failed=0 |
| 99 | verified=0 | 113 | verified=0 |
| 100 | for local in "${artifacts[@]}"; do | 114 | for local in "${artifacts[@]}"; do |
| @@ -132,6 +146,16 @@ for local in "${artifacts[@]}"; do | |||
| 132 | continue | 146 | continue |
| 133 | fi | 147 | fi |
| 134 | 148 | ||
| 149 | version=$(printf '%s' "$file" | sed -E 's/^zagan-bet-[a-z]+-([0-9]+\.[0-9]+\.[0-9]+)-.*/\1/') | ||
| 150 | if [ "$version" = "$newest" ]; then | ||
| 151 | latest_hash=$(awk -v kind="$kind" -v name="$file" '$1 == kind && $5 == name { print $6 }' "$tmp/latest.txt") | ||
| 152 | if [ "$latest_hash" != "$local_hash" ]; then | ||
| 153 | echo " $file: latest.php shows ${latest_hash:-nothing}, local is $local_hash" | ||
| 154 | failed=1 | ||
| 155 | continue | ||
| 156 | fi | ||
| 157 | fi | ||
| 158 | |||
| 135 | echo " $file: ok" | 159 | echo " $file: ok" |
| 136 | verified=$((verified + 1)) | 160 | verified=$((verified + 1)) |
| 137 | done | 161 | done |
