CVS homedir

Joey shows you how to keep track of everything with CVS.
______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

good, i like here

Anonymous's picture

Hello everybody :)

Re: CVS homedir

Anonymous's picture

I've read a lot of comments to rsync this and try that. And that's all good... if you run everything on linux. What isn't mentioned here is this. What happens when you plop down on a Winblows box? That disk with a basic command line CVS (or flash drive if you wanna be creative) can be a life saver, or if you've installed a web interface for your CVS to restore some file you've been working on and want to show to a friend, prospective employer, or windows user who wants to know what you can do with linux (and you won't have to install cygwin on their machine). Also, don't forget that not many tools have the web-usage of CVS. I've yet to see (correct me if I'm wrong, and I could be) rsync have any online tool that allows you to edit that important "report" you have to turn in when you are on the road without your laptop. With CVS and web interface installed, and having some innovative cron scripts, you can update the file, and update an auto-email script from any i-net kiosk. Your home/office machine can then CVSup (on the hour), and another cron can check for your auto-email file, and send off the e-mail via your home account, even rotate the CVS password if you are paranoid about kiosk security. All without making any direct connection to the machine doing the work.

Nothing says "Linux is King!" like Yet-Another-GPL-MS-Can't-FUD.

While I do agree with the right tool for the right job, using 50 tools for 50 slightly different jobs is both the great extensibility of linux (God knows I couldn't live without rsync... and yes, it's best to tunnel it), and yet the downfall to date of linux for the home user. Here's a tool that you can easily use on linux, windows, or the web to syncronize everything in one fell swoop. I don't wanna start a Gimp v. Photoshop debate here, but CVS on a website certainly benefits from importing on a windows boxes and linux boxes depending on user preference. No doubt the same can be said of one's desktop, especially for those with 500 icons on their desktop would could use a little organization. ;)

I could really go on about the possible uses of this that I now realize, that all of those tools listed "could" do, but not in one package (excluding VNC that is... but come on, heh). But, I digress...

Great article. It's so awesome to see long time linux people get the "Ahhhh!" effect like when they booted their first distro.

Re: CVS homedir

Anonymous's picture

You can use a program called Unison. Which works on linux/unix/windows.

http://www.cis.upenn.edu/~bcpierce/unison/

Works really well. I synchronise my laptop with my main PC with my server with my remotely (shared hosting) server, and not forgetting my uni filestore.

It works both direction. It can do all those ssh stuff and i think it uses the same technology as rsync.

I'm gonna use rdiff or subversion to keep an incremental backup in server side, so my laptop/PC won't have to deal with it, it will run the rdiff after i synchonise with the server.

Great :)

Re: CVS homedir

Anonymous's picture

What about using a distributed filesystem solution (DFS) such as AFS or CODA? CODA is made for detached operations - though I'm not sure you can limit which files get replicated where (ie: on machines you don't trust). Less hassle.

Subversion is growing quite nicely, as a good replacement of CVS.

Re: CVS homedir

Anonymous's picture

There's rsync for Windows, *****.

Re: CVS homedir

Anonymous's picture

Well, you talk about CVS, and it's very clever of your mind to have thought about it. I like these minds that dare launching unusual concepts or links for the fun and for the curiosity.

But, I've heard about rdiff-backup. It's just a tool for people who wants to backup things incrementally, based on librsync. It's currently still under development. Why rdiff-backup ? Because, as you told it, CVS does � not� manage everything elengantly such as dirs or binary files. The conceptor of rdiff-backup wants to do his best for that problem. I suppose rationnaly you won't try it, not because you should be stupid but because you used so much energy to learn CVS very deeply and it should be quite a non sense to trash what you've learned with it (we have not more than 24 hours a day, have we ?). But what think the other guys about this alternate solution ?

(comments ?)

Re: CVS homedir

Anonymous's picture

I've also been doing this for a few years now, and it works very well for me.

Rather than run my own CVS server, I am a key contributor to tigris.org (an open source software engineering community). Key contributors can host personal private projects there. So, my life is organized in CVS, my own personal bugzilla, and several mailing lists with archives. I am not using subversion yet, but I expect tigris.org to be the first public project hosting site to offer subversion as a standard feature when it is ready for that.

Re: CVS homedir

Anonymous's picture

Try CVSup to update your tree.
(Instead of cvs checkout)

It's 10-100 times faster.

Re: CVS homedir

Anonymous's picture

Is it me or is everyone here ignorant of the fact that cvs does not backup and restore symbolic links ?

I made this mistake once while backing up /etc directory and then had to hand restore all links in rc?.d/ directories.

Other than this small inconvenience, binary handling is also not that good.

Re: CVS homedir

Anonymous's picture

I've been doing this for years (ain't I cool?), including config's in /etc--though I don't add everything, just the replicable stuff and that which I don't wanna lose. Yeah, CVS is farfrumperfekt, but it's better than copying things piecemeal. But in /etc especially, I was tripping on files which were specific to a particular host.

So I developed a system of naming those files according to the specific hostname, as:

http.conf@www

Then I wrote a script that creates symlinks to files bearing the local hostname (http.conf --> http.conf@www). It will prompt for each new file, and if the file already exists (without the @www), it will even show a diff and let me choose which one to use.

This seems better to me than trying to maintain separate branches in CVS.

If anyone wants my amazing link-o-matic script, email me:

jasonATvancleveDOTcom

--Jason

Re: CVS homedir

Anonymous's picture

The issue of Symlinks is actually a general problem for storing directory trees in CVS. Sometimes the symlinks are important information that needs to be preserved just like regular files. Auto creating them with a script is one option, another that I might suggest is using a small Apache Ant Build file and the task to persist the symlink information in a properties file (which CAN be version controled). The only drag is that you need to regularly run the build to record the links or the info is outdated, but you could cron that.

I currently use this task to maintain a website that makes heavy use of symlinks. This does of course require an additional tool... Apache ant 1.6+ but you don't have to maintain the script or conform to conventions about how you name your links.

Re: CVS homedir

Anonymous's picture

I use rsync!

Re: CVS homedir

Anonymous's picture

It's been a while since I read an equally silly article. If you need versioning for your files, use Plone. http://www.plone.org

It has that and a host of other features, it allows you to have all your files available through a web browser and it makes back ups much easier. Why? Plone keeps versioning of your files, but because it is a database system system on top of the Zope appliatication server, when it comes to doing a backup, you only have to worry about a single file to backup: the plone database that contains all your other writing and files.

I love when people overengineer their solutions such as you just did. It is so funny that I can hardly type this.

Re: CVS homedir

Anonymous's picture

Hey, I just tried this and it is indeed very cool. Wow, how come I have never heard of this?

To the defense of the poster, the author himself mentions that cvs has problems with dirs or binary files. Even worse, it does not back up symbolic links.

Re: CVS homedir

Anonymous's picture

A troll, surely. Your suggested alternative is to install Python, then Zope, and then Plone? A web-based solution that will be considerably harder to automate than CVS? A solution that is targetted at content management rather than simple file versioning? Sorry, you must be using a different definition of "overengineer" to the rest of us.

Re: CVS homedir

Anonymous's picture

No I wasn't trolling. It takes 20 seconds to install it. Python is included with most distributions. After that, just intall your plone rpm and start the process.

It is much more powerful, and much easier to user. Of course, you would never now because you would rather call me a troll.

And because it is all accessible through a web browser, you can leave a computer running at home and have access to all the files. Not to mention that you can annotate your files, provide meta key works for them...

Even if you just want to synchronize, then run plone on two separate computers and rsync one single file, the Data.fs store.

Actually, it's a completely

Anonymous's picture

Actually, it's a completely inappropriate tool for the job. Just because it has version control does not make it suited to versioning your home directory. A number of the "features" you cite is exactly the opposite of a feature the author uses and needs.

Re: CVS homedir

Anonymous's picture

Plone? That had to be a troll.

Excellent article, Joey. I've read it over and over since I first found it about six months ago. In fact, I'm planning to make it required reading for all my CVS users once I think they can handle it.

And, directly as a result of your article, I've been keeping my Cygwin/Win2000 $home directory in CVS for many months now. I love it!

Re: CVS homedir

Anonymous's picture

Ever hear of rsync? This situation is exactly what it's made for. CVS is overkill here.

rsync will mirror your directories to multiple machines, do incremental mirrors (only update new files or files that have changed), and can make the mirrors identical, i.e. delete files from the server that you have deleted locally (optional parameter).

Also, if you want to go on the server and look at the mirrored files, they exist exactly as they do on your laptop or workstation--not tied up in a CVS archive. Another thing is that you can use it to mirror between machines, such as your workstation and laptop, without having to go through a CVS checkout.

Now, you won't get histories and tagging, but so what? If I have something I want to track changes on (code, documents), then I put it into CVS. The right tool for the right job.

Re: CVS homedir

Anonymous's picture

Rsync, particularly with the "--link-dest" feature of new versions, is great for backups.

Quick explanation: in addition to a source and destination locations, you can specify a third "link_dest" location. If a file in the dest would be identical to one in the link_dest rsync does a hard link to the link_dest copy instead of wasting disk space on a new copy of old data . The cool use is to have ones previous backup be the link_dest for the new backup. The result is that each incremental backup is complete, but unchanged files are shared between consecutive backups, only changed files need new data space.

I also specify some files not to backup, and the result is that since I put on Redhat 9 I have a complete, online, incremental backups of my entire machine. When I eventually upgrade to a new distribution I will be able to revert to RH 9 if I need to. Or, simply grab the stuff I need.

Mix software raid 0 with rsync backups to a different (normally readonly) partition, and one can have convenient impressive reliability in a single box. Take advantage of rsync's ability to operate efficiently and securely over a network and off-site backups are easy too.

Also, the script to do the backups can be little and the result easy to use without any special software.

-kb, the Kent who is maintaining a computer on the other coast with the help of this tool.

raid 0?

Anonymous's picture

Just so people aren't confused - raid 0 is strictly for speed, and does not protect your data from a hard drive failure. Raid 1, 5, and other configurations will offer less speed advantage, but will protect you from a single drive failure. I'm sure the previous poster just made a typo.

I'm disappointed that the article didn't discuss how the author overcame directory, binary, and symlink problems inherit in CVS.

Re: CVS homedir

Anonymous's picture

i couldn't agree more!
right tool, right job. cvs == overkill for most homedir stuffs

Re: CVS homedir

Anonymous's picture

CVS uses SSH. Rsync uses the dreaded, insecure R commands. Nuff sed.

Re: CVS homedir

Anonymous's picture

In /etc/profile for my machines I have

RSYNC_RSH=ssh
export RSYNC_RSH

r* isn't even installed and yet I use rsync constantly.

Re: CVS homedir

Anonymous's picture

rsync is built to be able to use ssh as well. Read the docs:
http://samba.anu.edu.au/ftp/rsync/rsync.html

Re: CVS homedir

Anonymous's picture

Having also had the backup, replication and home directory but bite me too, I must say that I have a different solution to this problem.

Granted, I don't get history for my files, but that hasn't been my main concern so much as easy backup and syncronization between many machines.

The tool is is unison. It is a truely wonderful peice of software. I use it to sync various accounts to subdirectories of my home directory on my server and syncronize home between multiple server.

Re: CVS homedir

Anonymous's picture

I "solved" the problem of needing different dot files on different machines by creating a branch in CVS. So I can check out the "home" branch on my home machine, and the "work" branch on the work machine, etc.

You have to worry about merging changes between the different machines branches now, but you don't need to worry about how to make the same config file work in a bunch of (slightly?) different environments.

Re: CVS homedir

Anonymous's picture

I realize it was probably tongue-in-cheek, but you might want to avoid:

cvs commit ; sudo rm -rf /.

in favour of
cvs commit && sudo rm -rf /.

there _are_ reasons why the first command could fail, after all.

Re: CVS homedir

Anonymous's picture

yeah, and if you've non cvs'd dir hardlinked your fvcked.

Re: CVS homedir

Anonymous's picture

Have you used unison? No version control, but it keeps your files synchronized between machines quite well.

Re: CVS homedir

Anonymous's picture

Excellent article! This was truly innovative thinking and really got me excited to try it out. Please keep up publishing new and exciting articles like this for the future! I wonder if there are decent GUI's for subversion or other CVS-like apps that might make doing things like this super easy? This might be a very nice way to do "hands-off" enterprise desktop installs. The uses of this are only limited by the mind. :)

Subversion GUI

Anonymous's picture

He wants a subversion GUI,

Anonymous's picture

He wants a subversion GUI, not an IDE :)

On Qt/KDE, eSvn is a good solution, especially when used along with Kompare. Cervisia is also probably quite good. Finally, KDESVN is probably set to be the best option, but I don't think it's there yet. Meld will probably be part of any GNOME solution. For SVN, I just use the shell for commits, adds, removes, renames, but with kwrite set as my $EDITOR, and piping svn diff into kompare.

doing this for years too...

Anonymous's picture

i agree, this is a great idea - though i don't do all that he does. i only put my bashrc, vimrc, et al in CVS. then, i do an update whenever and have new login files which work on most unixes and versions of the common utils. if i add a nice new alias, it'll eventually get propagated.

i do think thowing huge photoshop files into CVS might be a bad idea. and what about mac osx's "bundles", like .app? you'd have to recursively add/import each file for a program manually - would be weird.

Re: doing this for years too...

Anonymous's picture

Ditto. I'm using subversion, though.

Bahhh!

Anonymous's picture

I keep track of everything by using assembler. I can back up and version control between boxes in seconds instead of the hours it takes you, and I'm still using 286 and 386 boxes.

And if you can't code in assembler, you're a wimp!

Re: CVS homedir

Anonymous's picture

I suppose I should mention that these days I keep most of my home directory in subversion. I have not gotten around to writing a successor to this article yet, but it works even better than cvs, and that's probably the most common question people ask me about this article these days.

-- Joey Hess

Re: CVS homedir

Anonymous's picture

This is actually a really really good idea. As an advocate and user of CVS, I dont know why I hadnt thought of this before...... its perfect for homedir stuff (esp. dotfiles like .Xresources and such).

Looks like I'll be implementing a CVS server on my network when I move into my new place. :)

Re: CVS homedir

Anonymous's picture

Great article! At least, I'm off to try and reorganize my homedir so I'll be able to use version control on it.

Speaking of version control, what about using Subversion? If I understand it correctly, it's mostly command-line compatible with cvs, but supports versioning of directories.

Re: CVS homedir

Anonymous's picture

Moreover, it allows you to move files and directories in an easy way.

Re: CVS homedir

mpersico's picture

When I tell people about this, they invariably respond, ``You're crazy!''

Hey Joey, they're the ones that are crazy. I use CVS for all locally grown utilities, /etc/profile.d files, /etc/conf files, etc. (no pun intended). Building a new system is as easy as
o Install from scratch
o Restore cvs repository
o cvs checkout everything
o run MyInstall, a script that walks the sandbox looking for install.ini files and does copies and whatever else is needed. This is homegrown.
o Restart xinetd and off we go.
Keep up the good work

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState