<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.orcaware.com/svn/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=TkeXwy</id>
	<title>SubversionWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.orcaware.com/svn/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=TkeXwy"/>
	<link rel="alternate" type="text/html" href="https://www.orcaware.com/svn/wiki/Special:Contributions/TkeXwy"/>
	<updated>2026-04-20T08:39:03Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://www.orcaware.com/svn/mediawiki/index.php?title=System_Configurations&amp;diff=1628</id>
		<title>System Configurations</title>
		<link rel="alternate" type="text/html" href="https://www.orcaware.com/svn/mediawiki/index.php?title=System_Configurations&amp;diff=1628"/>
		<updated>2007-07-14T17:03:08Z</updated>

		<summary type="html">&lt;p&gt;TkeXwy: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page is about &#039;&#039;&#039;how to&#039;&#039;&#039; manage configuration files (like &amp;lt;tt&amp;gt;/etc/*&amp;lt;/tt&amp;gt;) on your machine(s) using subversion.&lt;br /&gt;
&lt;br /&gt;
= Simple case =&lt;br /&gt;
&lt;br /&gt;
Let&#039;s start off simple.&lt;br /&gt;
I assume you are root, as you are the one modifying the configuration files.&lt;br /&gt;
You first create a repository:&lt;br /&gt;
 svnadmin create /svn/configs&lt;br /&gt;
&lt;br /&gt;
Then you can make your root directory a working copy of this (so far empty) repository:&lt;br /&gt;
 svn checkout file:///svn/configs /&lt;br /&gt;
&lt;br /&gt;
Now you can start adding things you want to keep under revision control.&lt;br /&gt;
When adding directories, make sure to use the &amp;lt;tt&amp;gt;-N&amp;lt;/tt&amp;gt; (= &amp;lt;tt&amp;gt;--non-recursive&amp;lt;/tt&amp;gt;) flag&lt;br /&gt;
to add only the directory itself and not all its contents.&lt;br /&gt;
And add directories before any files therein, although you may add both in the same command.&lt;br /&gt;
 svn add -N /etc /etc/fstab&lt;br /&gt;
&lt;br /&gt;
Now we want to have a look at what we modified so far.&lt;br /&gt;
A simple &amp;lt;tt&amp;gt;svn stat&amp;lt;/tt&amp;gt; will tell you all the things that are not under revision control so far.&lt;br /&gt;
When working with configuration files where you are not interested in many of them this is usually not what you want.&lt;br /&gt;
Using the &amp;lt;tt&amp;gt;-q&amp;lt;/tt&amp;gt; (= &amp;lt;tt&amp;gt;--quiet&amp;lt;/tt&amp;gt;) flag suppresses those unmanaged files.&lt;br /&gt;
 svn stat -q /&lt;br /&gt;
&lt;br /&gt;
Now we are ready to commit our configurations to the repository.&lt;br /&gt;
It is usually a good idea to add and commit files &#039;&#039;before&#039;&#039; you modify them for the first time.&lt;br /&gt;
This way you can always compare any revision of the file to its &amp;quot;virgin&amp;quot; form supplied by your distribution.&lt;br /&gt;
And always write informative messages so you can later figure out not only what was changed but also why you changed it.&lt;br /&gt;
Remember to set &amp;lt;tt&amp;gt;EDITOR&amp;lt;/tt&amp;gt; for the root account as well if you do not supply the comment from the command line.&lt;br /&gt;
 svn commit / -m &amp;quot;vanilla files&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You may want to have a list of all the files under version control.&lt;br /&gt;
Luckily you can combine the &amp;lt;tt&amp;gt;-q&amp;lt;/tt&amp;gt; flag with &amp;lt;tt&amp;gt;-v&amp;lt;/tt&amp;gt; (= &amp;lt;tt&amp;gt;--verbose&amp;lt;/tt&amp;gt;) to get just that:&lt;br /&gt;
 svn stat -qv /&lt;br /&gt;
&lt;br /&gt;
The basic work cycle probably is like this:&lt;br /&gt;
# if you modify file for the first time:&lt;br /&gt;
## add all parent dirs and the file itself&lt;br /&gt;
## commit&lt;br /&gt;
# edit the file&lt;br /&gt;
# check your modification works as expected, otherwise &amp;lt;tt&amp;gt;revert&amp;lt;/tt&amp;gt;&lt;br /&gt;
# list all modifications&lt;br /&gt;
# commit modifications, including message about the reason for this change&lt;br /&gt;
&lt;br /&gt;
= Basic concepts for multiple administrators &#039;&#039;or&#039;&#039; machines =&lt;br /&gt;
&lt;br /&gt;
Maybe you are not the only one administrating the machine.&lt;br /&gt;
Assume there are several people who can become root and tweak the config files.&lt;br /&gt;
You would then want to know who changed what.&lt;br /&gt;
If you are accessing the repository using the &amp;lt;tt&amp;gt;file://&amp;lt;/tt&amp;gt; scheme you can simply provide&lt;br /&gt;
&amp;lt;tt&amp;gt;--username &amp;lt;/tt&amp;gt;&#039;&#039;yourName&#039;&#039; to provide this name for the record.&lt;br /&gt;
It does not even have to correspond to an existing system account.&lt;br /&gt;
 svn --username john commit /&lt;br /&gt;
&lt;br /&gt;
Maybe you decide to manage the configuration files for several machines in a single repository.&lt;br /&gt;
For the moment I&#039;ll consider the machines rather independent from one another,&lt;br /&gt;
so that you manage them in completely distinct trees of your repository.&lt;br /&gt;
Having them in the same repository still helps when diffing them,&lt;br /&gt;
applying changesets from one machine to another and so on,&lt;br /&gt;
so it&#039;s preferable to rather have subtrees in a single repository than different repositories.&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s create a directory for a single machine in the above repository.&lt;br /&gt;
Note that we create dir directly in the repository, not in any checked out working copy.&lt;br /&gt;
 svn mkdir file:///svn/configs/macchina&lt;br /&gt;
&lt;br /&gt;
If you start off like this, you can simply check out the empty directory to the root directory of your machine,&lt;br /&gt;
instead of checking out the repository root as described above.&lt;br /&gt;
In case you started like described above and only later thought about adding other machines,&lt;br /&gt;
you&#039;ll need to move your existing contents to the new location:&lt;br /&gt;
 svn move file:///svn/configs/etc file:///svn/configs/macchina/etc&lt;br /&gt;
 svn switch file:///svn/configs/macchina /&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Make sure&#039;&#039;&#039; to first move the contents in the repository and only then switch your working copy,&lt;br /&gt;
because otherwise you might switch to an empty tree and all your versioned files would be deleted.&lt;br /&gt;
&lt;br /&gt;
You can then create additinal directories for other machines and check them out to their root directory.&lt;br /&gt;
Let&#039;s suppose you are working on a machine called &amp;lt;tt&amp;gt;maschine&amp;lt;/tt&amp;gt;. You could do the following:&lt;br /&gt;
 svn mkdir ssh svn://root@macchina/svn/configs/maschine&lt;br /&gt;
 svn checkout ssh svn://root@macchina/svn/configs/maschine /&lt;br /&gt;
&lt;br /&gt;
= Advanced tricks for multiple administrators &#039;&#039;and&#039;&#039; machines =&lt;br /&gt;
&lt;br /&gt;
Note that the trick for logging the user by passing &amp;lt;tt&amp;gt;--username&amp;lt;/tt&amp;gt;&lt;br /&gt;
to each command only works reasonably well with the &amp;lt;tt&amp;gt;file://&amp;lt;/tt&amp;gt; scheme.&lt;br /&gt;
It won&#039;t work with ssh access to another machine.&lt;br /&gt;
And it is easy enough to forget to provide your name.&lt;br /&gt;
We can solve all this and more by (ab)using the svn facility for defining tunnel applications.&lt;br /&gt;
&lt;br /&gt;
On every machine where you want to manage the configuration using svn,&lt;br /&gt;
first create the following file named &amp;lt;tt&amp;gt;/usr/local/bin/svn sysadmin&amp;lt;/tt&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 # Taken from http://www.orcaware.com/svn/wiki/System_Configurations&lt;br /&gt;
 if &amp;lt;nowiki&amp;gt;[[ -z $SYSADMIN ]]&amp;lt;/nowiki&amp;gt;; then&lt;br /&gt;
   SYSADMIN=$(&lt;br /&gt;
     read -p &amp;quot;Your (non-root) login name: &amp;quot; NAME &amp;lt;/dev/tty &amp;gt;/dev/tty&lt;/div&gt;</summary>
		<author><name>TkeXwy</name></author>
	</entry>
</feed>