University Marketing & Communications

July 24, 2012

Homestash

By Chris Heiland

This was originally posted on Chris Heiland’s staff blog while he was a member of the Web Team. Chris migrated this post to the Web Team blog before he left because we thought the content still had value to the UW community.


I have accounts for several systems and I always have problems keeping my home environment up to date. I’ll create a script on one place and end up wanting to use it several more places. I’ll find a line to add to my .bashrc and end up missing it when I log into another system. I was inspired a few months ago by a tool that solved this problem, basically it used git as the foundation and kept your home directory in sync. I can’t remember exactly what it was called, and if I find it I will give credit.

However, it was too complex for what I needed so I went another route. The system I ended up with is called Homestash. The system works by hosting all the content centrally, I’m using github but you could setup a bare repository anywhere, and then upon login syncing up. I even have a shell script to setup Homestash on a new system, which means adding a host is painless. The core of the system I keep in a directory called ~/.homestash/ and then use symlinks to hook everything together.

This has the added advantage of having everything in one place. While I keep as much as possible in generic files that are system independent, I have host specific stuff I can implement on a per server basis. This keeps the bulk of the stuff available while keeping some weird stuff local to the machine it’s on. I keep the name of the file the same and then put the name of the host in the actual directory. Basically my file structure looks like this:

.bash_aliases -> .homestash/.bash_aliases
.bashrc -> .homestash/.bashrc
.gitconfig -> .homestash/.gitconfig
.gitignore -> .homestash/.gitignore
.homestash
.host_bashrc -> .homestash/tang_bashrc # Host specific file
.profile -> .homestash/.profile
.screenrc -> .homestash/.screenrc
.vimrc -> .homestash/.vimrc

I still am working on improving what I have in the files themselves, but the actual system is working very well. The only thing I haven’t solved quite yet is I have a `git pull` executing every time I open a shell or login to a system, this doesn’t work with a program I used extensively on the mac called DTerm. I may find a good solution for this in the future but for now I am just running this manually.