Skip to content

Instantly share code, notes, and snippets.

@mickhan
Forked from pterk/redis-ve
Created January 31, 2013 04:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mickhan/4679996 to your computer and use it in GitHub Desktop.
Save mickhan/4679996 to your computer and use it in GitHub Desktop.
#!/bin/bash
VERSION="2.6.2"
ARCHIVE=redis-${VERSION}.tar.gz
if [ -z "${VIRTUAL_ENV}" ]; then
echo "Please activate a virtualenv first";
exit
fi
pushd /tmp/
if [ ! -f redis-${VERSION}.tar.gz ]
then
wget http://redis.googlecode.com/files/${ARCHIVE}
fi
DIRNAME=`tar tzf ${ARCHIVE} 2>/dev/null | head -n 1`
tar xzf ${ARCHIVE}
pushd ${DIRNAME}
# make / make install w/ prefix
make PREFIX=${VIRTUAL_ENV}
make PREFIX=${VIRTUAL_ENV} install
mkdir -p ${VIRTUAL_ENV}/etc/
mkdir -p ${VIRTUAL_ENV}/run/
sed -i 's/daemonize no/daemonize yes/' redis.conf
# prepare VIRTUAL_ENV-path for sed (escape / with \/)
VIRTUAL_ENV_ESC="${VIRTUAL_ENV//\//\\/}"
sed -i "s/\/var\/run/${VIRTUAL_ENV_ESC}\/run/" redis.conf
sed -i "s/dir \.\//dir ${VIRTUAL_ENV_ESC}\/run\//" redis.conf
cp redis.conf ${VIRTUAL_ENV}/etc/
popd
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment