Skip to content

Instantly share code, notes, and snippets.

@jonaslejon
Last active February 3, 2017 06:46
Show Gist options
  • Save jonaslejon/b90c0eedece47bf910be to your computer and use it in GitHub Desktop.
Save jonaslejon/b90c0eedece47bf910be to your computer and use it in GitHub Desktop.
Tarsnap install
#!/bin/sh
#
# Author: Jonas Lejon <jonas.gist@triop.se>
# 2014-05-30 For Ubuntu
#
# Usage:
# ./tarsnap-install.sh <tarsnap-email>
#
if [ -z "$1" ]
then
echo "No argument supplied"
exit 1
fi
sudo apt-get install -y curl libssl-dev zlib1g-dev e2fslibs-dev build-essential
curl https://www.tarsnap.com/download/tarsnap-autoconf-1.0.37.tgz -o tarsnap-autoconf-1.0.37.tgz
curl https://www.tarsnap.com/download/tarsnap-sigs-1.0.37.asc -o tarsnap-sigs-1.0.37.asc
curl https://www.tarsnap.com/tarsnap-signing-key.asc -o tarsnap-signing-key.asc
gpg --import tarsnap-signing-key.asc
gpg --decrypt tarsnap-sigs-1.0.37.asc
echo - "SHA256: "
sha256sum tarsnap-autoconf-1.0.37.tgz
echo
read -p "Do the SHA256 checksum match above? (y/n) " RESP
if [ "$RESP" = "n" ]; then
exit 2
fi
tar xvfz tarsnap-autoconf-1.0.37.tgz
cd tarsnap-autoconf-1.0.37
./configure
make
sudo make install
sudo mkdir /usr/local/tarsnap-cache
sudo tarsnap-keygen --keyfile /root/tarsnap.key --user $1 --machine `hostname`
sudo chmod 600 /root/tarsnap.key
sudo cp /usr/local/etc/tarsnap.conf.sample /usr/local/etc/tarsnap.conf
## Append some extras to the conf
echo "exclude access.log" | sudo tee -a /usr/local/etc/tarsnap.conf
echo "exclude error.log" | sudo tee -a /usr/local/etc/tarsnap.conf
echo "humanize-numbers" | sudo tee -a /usr/local/etc/tarsnap.conf
echo "Don't forget to take a copy of /root/tarsnap.key and store it somewhere really safe!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment