Skip to content

Instantly share code, notes, and snippets.

@omaraboumrad
Created September 3, 2013 22:44
Show Gist options
  • Save omaraboumrad/6430617 to your computer and use it in GitHub Desktop.
Save omaraboumrad/6430617 to your computer and use it in GitHub Desktop.
sily little vagrant bootstrapper
#! /usr/bin/python
import os
def cmd(txt):
print '>>> {} <<<'.format(txt)
return os.system(txt) >> 8
def test(what):
return cmd(what) == 0
def run(what):
run_once = 'apt-get update'
for available, install in what:
if not test(available):
if run_once:
cmd(run_once)
run_once = ''
cmd(install)
# Test
run([
('which bzr', 'apt-get install -y bzr'),
('which pip', 'apt-get install -y python-pip'),
('which virtualenv', 'apt-get install -y python-virtualenv virtualenvwrapper'),
('which pyflakes pylint autopep8', 'pip install pyflakes pylint autopep8')
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment