Skip to content

Instantly share code, notes, and snippets.

@thegcat
Created October 31, 2011 21:34
Show Gist options
  • Save thegcat/1329025 to your computer and use it in GitHub Desktop.
Save thegcat/1329025 to your computer and use it in GitHub Desktop.
This installs grack and a fastcgi handler for it on your uberspace.
#!/bin/sh
UBERSPACE_RUBY_1_8_PATH="/package/host/localhost/ruby-1.8.7-p352/bin/ruby"
UBERSPACE_USER_HTTP_HOST="http://`id -un`.`hostname`"
FCGI_SCRIPT_PATH="fcgi-bin/git.fcgi"
FCGI_SCRIPT_FS_PATH="${HOME}/${FCGI_SCRIPT_PATH}"
FCGI_SCRIPT_URL="${UBERSPACE_USER_HTTP_HOST}/${FCGI_SCRIPT_PATH}"
GRACK_PATH="${HOME}/.grack"
GRACK_LIB_PATH="${GRACK_PATH}/lib"
GRACK_REPOS_PATH="${GRACK_PATH}/repositories"
GRACK_CLONE_URL="git://github.com/schacon/grack.git"
if [ -f ${FCGI_SCRIPT_PATH} ] ; then
echo "You already have a git.fcgi in your ~/fcgi-bin. Nothing to do here."
exit 1
fi
if [ -d ${GRACK_PATH} ] ; then
echo "You already have a ~/.grack directory. Nothing to do here."
exit 2
fi
git clone ${GRACK_CLONE_URL} ${GRACK_PATH}
mkdir ${GRACK_REPOS_PATH}
cat > ${FCGI_SCRIPT_PATH} <<EOF
#!${UBERSPACE_RUBY_1_8_PATH}
\$LOAD_PATH.unshift '${GRACK_LIB_PATH}'
require 'rubygems'
require 'rack'
require 'git_http'
config = {
:project_root => '${GRACK_REPOS_PATH}',
:upload_pack => true,
:receive_pack => false,
}
Rack::Handler::FastCGI.run(GitHttp::App.new(config))
EOF
chmod 755 ${FCGI_SCRIPT_PATH}
echo "You have now installed grack to your uberspace"
echo
echo "You can now create (or clone) bare repositories in"
echo "${GRACK_REPOS_PATH}"
echo "those will be made available under"
echo "${FCGI_SCRIPT_URL}"
echo
echo "Please note that repositories published that way are world-readable!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment