[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: How can I add a number of files scattered over the directory tree?

From: Thomas Harold <tgh_at_tgharold.com>
Date: 2006-10-27 04:25:05 CEST

Jim Lynch wrote:
> I've a number of realted files I'd like to use svn to maintain but they
> are located in widely scattered places, like /etc/
> /usr/local/lib/cgi-bin, /usr/local/etc, etc. I know I could keep copies
> of them in a single file but I'd like to be able to checkout them to
> their proper place, or is that a bad idea?
> I could also put thim in a single directory or small tree and use make
> and install to move them.

I'm assuming that you're trying to version /etc and other hand-edited
(or user-changed) files. We do it on our servers as well, just not sure
if our way is the best way.

First, we have a central SVN server that uses SSH for authentication
with public keys. We create a "sys-machinename" account there, create a
new repository (/var/svn/sys-machinename), create a group called
svn-sys-machinename and give it rights to the folder. That's the
administrative end for us. Having individual repositories for each
system keeps things easy for us, although there are arguments to be made
for using a single repository for multiple systems.

Next, I go the machine that is going to be versioned, go to the root
folder and do a "svn co" against the empty repository.

# cd /
# svn co svn+ssh://sys-machname@svn.example.com/var/svn/sys-machname /

Because this repository (or URL) is empty, it does no damage to the
machine. (But we also have 2 backup systems in place. An rsync
snapshot that runs daily as a lazy admin versioning system and a more
official backup system that is designed for bare-metal backup and restore.)

Then I start adding folders.

# svn add -N usr
# svn add -N usr/local
# svn add -N usr/local/sbin
# svn add -N usr/local/sbin/*
# svn ci -m "added local scripts in usr/local/sbin"
# svn add -N usr/src
# svn add -N usr/src/linux
# svn add -N usr/src/linux/.config
# svn ci -m "current kernel configuration"
# svn add etc
# svn ci -m "base /etc snapshot"
# mount /boot
# svn add boot
# svn ci -m "contents of boot partition"
(rinse repeat as needed)

It's basically an in-place import into a new repository. The existing
folders become working copies. I never plan on checking these files out
to another system (other then to my laptop for reference). Then,
whenever I make a change to a configuration file, I go and do the
adds/deletes and commit the changes to the repository with a comment.

My rule of thumb is that anything that will be hand-created or isn't
part of a base distro configuration needs to be versioned. We don't
bother the add the whole /usr/src/linux tree (for example) because we
can always download the sources again. It's the .config file that we
need to keep track of.

To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Oct 27 04:25:59 2006

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.