Skip to content

Instantly share code, notes, and snippets.

@dopey
Last active September 25, 2015 21:16
Show Gist options
  • Save dopey/29d25140ece4932f481a to your computer and use it in GitHub Desktop.
Save dopey/29d25140ece4932f481a to your computer and use it in GitHub Desktop.
#!/bin/sh
VERSION="0.7.2"
BUILD="betable2"
COMMIT=$1
output=${1-"88e4c98"}
set -e -x
DIRNAME="$(cd "$(dirname "$0")" && pwd)"
ORIGPWD="$(pwd)"
cd "$(mktemp -d)"
trap "rm -rf \"$PWD\"" EXIT INT QUIT TERM
# Clone and checkout appropriate version of tablesnap
git clone "https://github.com/betable/tablesnap.git"
cd tablesnap
git checkout -b "$VERSION" "$COMMIT"
mkdir "rootfs"
mkdir "rootfs/usr"
mkdir "rootfs/usr/local"
mkdir "rootfs/usr/local/bin"
mkdir "rootfs/usr/share"
mkdir "rootfs/usr/share/pyshared"
mkdir "rootfs/etc"
mkdir "rootfs/etc/init.d"
mkdir "rootfs/etc/default"
cp "./debian/tablesnap.init" "./rootfs/etc/init.d/tablesnap"
chmod 755 "./rootfs/etc/init.d/tablesnap"
cp "./debian/tablesnap.default" "./rootfs/etc/default/tablesnap"
cp "./tablesnap" "./tablechop" "./tableslurp" "./rootfs/usr/local/bin/"
rm -f "$ORIGPWD/tablesnap_${VERSION}-${BUILD}_amd64.deb"
fakeroot fpm -C "rootfs" \
-m "Max Furman <[email protected]>" \
-n "tablesnap" -v "$VERSION-$BUILD" \
-p "$ORIGPWD/tablesnap_${VERSION}-${BUILD}_amd64.deb" \
-s "dir" -t "deb" \
-d "python" -d "python-support >= 0.90.0" -d "python2.7" \
-d "python-pyinotify" -d "python-boto" -d "python-dateutil" \
--description "Uses inotify to monitor Cassandra SSTables and upload them to S3" \
"usr" "etc"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment