redis / redis-io

Application running http://redis.io

Home Page:http://redis.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No easy way to checksum https://download.redis.io/

TheLastProject opened this issue · comments

https://download.redis.io/ has a link to http://download.redis.io/redis-stable.tar.gz so that one can always grab the latest stable Redis version easily. There is however, no easy way to checksum this download.

As https://redis.io/download#how-to-verify-files-for-integrity states, "the generic redis-stable.tar.gz tarball does not match any hash because it is modified to untar to the redis-stable directory."

This means that, to download the latest stable version with checksum, one has to do the following:

  1. Download http://download.redis.io/redis-stable/src/version.h
  2. Parse the version number out of this file
  3. Download http://download.redis.io/releases/redis-$VERSION.tar.gz instead of the generic stable.tar.gz
  4. Compare the redis-$VERSION.tar.gz to https://raw.githubusercontent.com/redis/redis-hashes/master/README

It would be very convenient if there could be a http://download.redis.io/redis-stable.tar.gz.SHA256SUM file that would always contain the SHASUM of this stable .tar.gz, or even just a http://download.redis.io/stable file containing only the version number so that one doesn't need to parse a header file for it.

Let's save the next person who needs this some effort:

#!/bin/bash

# Exit when any command fails
set -e

# Get latest Redis version
REDIS_VERSION="$(curl https://download.redis.io/redis-stable/src/version.h 2>/dev/null | sed -n 's/#define REDIS_VERSION "\(.*\)"/\1/p')"

# Reformat CHECKSUMS into a format that makes shasum happy
curl https://raw.githubusercontent.com/redis/redis-hashes/master/README 2>/dev/null | sed '/^#/d' | sed '/^$/d' | awk '{ print $4, "", $2}' > CHECKSUMS

# Download latest Redis version
wget -O "redis-${REDIS_VERSION}.tar.gz" "http://download.redis.io/releases/redis-${REDIS_VERSION}.tar.gz"

# Check checksum
shasum --ignore-missing -a 256 -c CHECKSUMS

Hello @TheLastProject

Thanks for making this request and presenting it in such a clear way that even I could grok it - that's excellent feedback. I've added the SHA256SUM file for the current stable and edited the HTML at download.redis.io. I've also submitted a PR to have it updated in future releases accordingly.

P.S. loving your bash-fu

SHA256SUM reference was also added to https://redis.io/downloads via 07b19da

@TheLastProject is there anything else you can think of for making life simpler in this context, or can this issue be closed?

This is perfect, really. Thanks for the quick and great fix. The issue can be closed :)