Skip to content

Instantly share code, notes, and snippets.

@goncalomb
Created October 4, 2020 21:32
Show Gist options
  • Save goncalomb/e9ad3b3537323e7670ea7aaace7f6b2c to your computer and use it in GitHub Desktop.
Save goncalomb/e9ad3b3537323e7670ea7aaace7f6b2c to your computer and use it in GitHub Desktop.
Compile and Install SnapRAID on Linux (tested on Mint and Raspberry Pi OS). Requires make, gcc and friends...
#!/bin/bash
set -ex
mkdir -p snapraid
cd snapraid
REL_JSON=$(curl -sS "https://api.github.com/repos/amadvance/snapraid/releases/latest" | grep browser_download_url)
if [[ ! "$REL_JSON" =~ \"browser_download_url\":\ \"https:\/\/github.com\/[^\"]+\/releases\/download\/v([^\"]+)\/(snapraid-[^\"]+.tar.gz)\" ]]; then
echo "failed to find release"
exit 1
fi
REL_VERSION=${BASH_REMATCH[1]}
REL_FILE=${BASH_REMATCH[2]}
[ -f "$REL_FILE" ] || curl -#ROL "https://github.com/amadvance/snapraid/releases/download/v$REL_VERSION/$REL_FILE"
[ -d "snapraid-$REL_VERSION" ] || tar -xzf "$REL_FILE"
cd "snapraid-$REL_VERSION"
[ -f Makefile ] || ./configure
make
sudo make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment