Skip to content

Instantly share code, notes, and snippets.

@lofidevops
Last active August 29, 2015 13:57
Show Gist options
  • Save lofidevops/9368592 to your computer and use it in GitHub Desktop.
Save lofidevops/9368592 to your computer and use it in GitHub Desktop.
Install RabbitVCS source branch
#! /bin/bash
# CC0 To the extent possible under law, the person who associated CC0
# with this work has waived all copyright and related or neighboring
# rights to this work. https://creativecommons.org/publicdomain/zero/1.0/
# Required folders (must exist beforehand):
# * Source code and script folders (see export statements below)
# * Nautilus 3: ~/.local/share/nautilus/python-extensions
# * CLI: /usr/bin (always exists)
# * GEdit: ~/.local/share/gedit/plugins
# Out of scope for this script:
# * Setting up folders above
# * Keeping source code up-to-date
# Set customisable folder paths:
# Source code, cloned from GitHub
export SOURCE_FOLDER=~/Code/rabbitvcs
# User scripts location for RabbitVCS CLI (must be in .bashrc or equivalent)
export SCRIPT_FOLDER=~/Code/scripts
if [ "$1" = "--help" ] || [ -z $1 ] || [ "$2" ];
then
# if "--help" is called, or too many or too few parameters given, display help
echo "Install specified branch of RabbitVCS with Nautilus, Gedit and CLI clients."
echo "(Assumes prerequisites are installed and target branch and folders exist.)"
echo "Usage: install-rabbitvcs-branch <branch-name>"
else
( # parentheses so that we return to original folder
# install all prerequisites, even the obvious ones
# (package names as used in Ubuntu 13.10)
# (also triggers prompt for sudo password as soon as possible)
sudo apt-get install gedit git hicolor-icon-theme ipython meld subversion python python-configobj python-dbus python-dulwich python-gobject python-gobject-2 python-gtk2 python-gtkspell python-nautilus python-simplejson python-support python-svn -qq && (
# kill existing Nautilus and RabbitVCS processes (if they exist)
pgrep -f nautilus && nautilus -q
pgrep -f service.py && xargs kill
# checkout requested branch
cd $SOURCE_FOLDER && git checkout $1 && (
# (re)install RabbitVCS library
sudo python setup.py check && sudo python setup.py install && (
# (re)install RabbitVCS clients
echo "Installing RabbitVCS clients..."
cp clients/nautilus-3.0/RabbitVCS.py ~/.local/share/nautilus/python-extensions
cp clients/gedit/rabbitvcs-plugin.py ~/.local/share/gedit/plugins
cp clients/gedit/rabbitvcs-gedit3.plugin ~/.local/share/gedit/plugins
cp clients/cli/rabbitvcs $SCRIPT_FOLDER
echo "done."
)
)
)
)
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment