Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.