You are not logged in.
Some time ago, I started to get annoyed at the bothersome task of copying configuration files between my desktop, laptop, and remote environments. First of all, copying the configs typically involved a lot of repetitive scp's. The second annoyance is a little worse: some of my dotfiles need a few special settings that are localized to one environment (e.g. just to my server), but I can't source some "local" config from the main one.
Of course, the answer was to come up with some ridiculous solution and today, I bring you:
What on earth is it? It's a way of managing configuration files across multiple environments. You can upload your configs to a remote repository and then download them from each of your environments. Furthermore, when you grab them from the remote area, you can do a diff against your existing file to keep your localized changes.
Right now, dotman only supports transfer via SFTP (through Paramiko), but it's possible to add more protocols later. The code is still a bit messy and needs some rewriting to properly handle exceptions, but as it stands, you can do quite a bit. Take a look at the instructions on the above page to see how things work.
I've seen several different solutions to this kind of problem: some people use rsync and others use revision control systems. I considered trying these out, but my "if you want something done right, do it yourself" mentality took hold and wouldn't let go. So, some may consider dotman to be totally superfluous (and I might agree), but maybe others will get some use out if it.
Frankly, I wanted better diffing capabilities. I really wanted something like Gentoo's powerful etc-update, but for now, vimdiff will have to do.
Examples:
comp1 $ dotman commit bashrc
-> ~/.bashrc gets uploaded to the remote repo
comp2 $ dotman grab bashrc
-> the remote bashrc gets pulled and vimdiff opens up, comparing your old config with the new one from the server (a copy of the old version gets stored to a backup directory)
Honestly, it's that simple.
-- jwc
http://jwcxz.com/ | blog
dotman - manage your dotfiles across multiple environments
icsy - an alarm for powernappers
Offline
First of all, copying the configs typically involved a lot of repetitive scp's. The second annoyance is a little worse: some of my dotfiles need a few special settings that are localized to one environment (e.g. just to my server)
I have often thought there had to be a better way of doing this but it's one of those things I have never really worked out. I once tried to keep a single bashrc for three machines with a whole bunch of tests in it depending on hostname bit it never really worked out.
I will definitely check this out.
Offline
You rock, I'll be checking this out tomorrow at work
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
EDIT: found my problem. I was missing the : between my hostname and the path to my repo...
Next problem though -- I run SSH on a non-standard port... How can I specify the port?
Last edited by fukawi2 (2009-08-27 02:26:11)
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Ah, shoot... I thought I built that into the regex; I must have been dreaming. I'll have to mess with it a bit until I get that working. Until then, you can look at the __sftpinit() function and set the port in self.ssh.connect(). I think it'd be something like:
self.ssh.connect(self.repo['host'], portnum, username=...);
-- jwc
http://jwcxz.com/ | blog
dotman - manage your dotfiles across multiple environments
icsy - an alarm for powernappers
Offline
Nah-uh, I ain't hacking Python... I have a personal hate on for Python and avoid writing in it at all costs Happy for others to write in it though, but it does my head in.
I'll be patient and wait
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Fair enough. I've fixed the issue (and also added the ability for usernames to be optional). I'm just updating the documentation and the new package will be ready in just a few minutes.
Edit: done! Now, you can use the following syntaxes (or some combination thereof):
sftp://host.tld/dir1/dir2
sftp://user@host.tld/dir1/dir2
sftp://user:pass@host.tld/dir1/dir2
sftp://host.tld:22/dir1/dir2
sftp://host.tld:22:/dir1/dir2
If the user is not specified, dotman will try to use getpass.getuser() to get your username.
When I get a chance, I'll add a second protocol for local file operations (i.e. just copying files).
Last edited by jwcxz (2009-08-27 03:37:22)
-- jwc
http://jwcxz.com/ | blog
dotman - manage your dotfiles across multiple environments
icsy - an alarm for powernappers
Offline
Working much better, thanks
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline