views:

278

answers:

2

The Story

After cleaning up my Dreamhost shared server's home folder from all the cruft accumulated over time, I decided to start afresh and compile/reinstall Python. All tutorials and snippets I found seemed overly simplistic, assuming (or ignoring) a bunch of dependencies needed by Python to compile all modules correctly. So, starting from http://andrew.io/weblog/2010/02/installing-python-2-6-virtualenv-and-virtualenvwrapper-on-dreamhost/ (so far the best guide I found), I decided to write a set-and-forget Bash script to automate this painful process, including along the way a bunch of other things I am planning to use.

The Script

I am hosting the script on http://bitbucket.org/tmslnz/python-dreamhost-batch/src/

The TODOs

So far it runs fine, and does all it needs to do in about 900 seconds, giving me at the end of the process a fully functional Python / Mercurial / etc... setup without even needing to log out and back in.

I though this might be of use for others too, but there are a few things that I think it's missing and I am not quite sure how to go for it, what's the best way to do it, or if this just doesn't make any sense at all.

  • Check for errors and break
  • Check for minor version bumps of the packages and give warnings
  • Check for known dependencies
  • Use arguments to install only some of the packages instead of commenting out lines
  • Organise the code in a manner that's easy to update
  • Optionally make the installers and compiling silent, with error logging to file
  • failproof .bashrc modification to prevent breaking ssh logins and having to log back via FTP to fix it

EDIT: The implied question is: can anyone, more bashful than me, offer general advice on the worthiness of the above points or highlight any problems they see with this approach? (see my answer to Ry4an's comment below)

The Gist

I am no UNIX or Bash or compiler expert, and this has been built iteratively, by trial and error. It is somehow going towards apt-get (well, 1% of it...), but since Dreamhost and others obviously cannot give root access on shared servers, this looks to me like a potentially very useful workaround; particularly so with some community work involved.

+1  A: 

Honestly, I would just build packages with a name prefix for all of the pieces and have them install under /opt so that they're out of the way. That way it only takes the download time and a bit of install time to do.

Ignacio Vazquez-Abrams
That is in fact what the script does. I am not asking how to install here. Rather how to improve a script to be safely used by people who want Python or Mercurial (amongst others) without having to backtrack all the dependencies and obscure variables like `export EPREFIX=` needed to get this stuff to work just right. Wish it was as simple as you make it sound...
tmslnz
+1  A: 

One way to streamline this would be to make it work with one of: capistrano/fabric, puppet/chef, jhbuild, or buildout+minitage (and a lot of cmmi tasks). There are some opportunities for factoring in common code, especially with something more high-level than bash. You will run into bootstrapping issues, however, so maybe leave good enough alone.

If you want to look into userland package managers, there is autopackage (bootstraps well), nix (quickstart), and stow (simple but helps with isolation).

Tobu