About my shell config
Par jd le jeudi, mars 3 2005, 17:53 - Naquadah Network - Lien permanent
Since several weeks I wonder something about my zsh configuration and I cannot find a good solution. Maybe you, my faithful reader, you have an idea !
Let me explain.
I have a function called scpzshconf which copy my zsh configuration files on a remote host using tar c | ssh remotehost tar x -. So when I change my configuration on my workstation, I have to do scpzshconf to many hosts. I would like to have something (a zsh function for example) which would be able to check which zsh configuration files are running on remote host and compare it with the version I am running localy. If remote version is older than local one, then it should scpzshconf from local host to remote host. (Just remember that sometimes I am using connections that are NATed).
Example:
local % cat ~/.zsh/configversion 2 local % ssh remote remote % cat ~/.zsh/configversion 1
And then it should copy zsh configuration from local to remote.
Any idea how to handle this ?
Commentaires
Assuming you use an ssh-agent or don't mind typing your password multiple times I'd use something like this (I'm a bash guy myself, so you'd have to convert the syntax, but I'm sure there's nothing in here that can't be done witz zsh)
host=remote localVersion=$(cat ~/.zsh/configversion) remoteVersion=$(ssh $host cat ~/.zsh/configversion) if $localVersion -gt $remoteVersion ; then
fi
I'm usualy using ssh-agent, but the problem with that solution if I use it, for an example, in a ssh() function overriding /usr/bin/ssh call from my prompt, it will do twice ssh connection to the remote host, (one to check version and one to really connect) and I don't like this.
Thanks anyway !
ssh -M will reuse the connections, when that version of ssh reaches debian.... You could also use darcs to version control your home directory and then push your changes whenever your config changes.
Version control system?
svn, cvs and so forth.. don't reinvent the wheel =)
Use Unison -- a variation on the rsync theme, which knows which version changed. http://www.cis.upenn.edu/~bcpierce/unison/. It's packaged for woody, too.
Unison. http://www.cis.upenn.edu/~bcpierce/unison/
It is like rsync, but works both ways. You can plug in merge programs for different types, so you could do something with diffs.
rdist. It's nice and simple and it works very well for me. I send my config files and my bin directory everywhere using it.
Fil des commentaires de ce billet