Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Simple way to manage config changes system wide
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Insanity5902
Veteran
Veteran


Joined: 23 Jan 2004
Posts: 1228
Location: Fort Worth, Texas

PostPosted: Thu Dec 07, 2006 10:24 pm    Post subject: Simple way to manage config changes system wide Reply with quote

Brief Synopsis:
An easy way to make config changes effective system wide, and still easy to maintain.

Introduction:
I have always edited my /etc configuration files as root in /etc to effect my local user. This way it keeps the cruft (. folders) in my home dir to a minimum. One example is setting the background color in vim, I would put this in my /etc/vim/vimrc and then every user on the system would benefit from this.

The plus side of this is that all my configurations are for all users, the bad part is, moving the changes from machine to machine, or re-installing the system means going through /etc to remember which files I changed and then going through the files to get the changes out of them.

I have come up with a two part solution that work great together, at least they do for me so far.

Part I:
This part of this my solution was to start keeping a separate file for my custom changes. In the case of vim, I know have a /etc/vim/vimrc and a /etc/vim/vimrc.local. The vimrc.local file is referenced inside the vimrc file. This serves two purposes 1) It is now extremely easy to see the changes I have made, 2) Any updates to the system are now a none issue in most cases, I can just let the vim ebuild overwrite the /etc/vim/vimrc with the new defaults, and all my changes still remain intact. 3) Copy to another system is easy, just copy over the vimrc.local and add the single line to source it and that is it.

While this works great for the upkeep of the system. If you ever re-install you are going to have to go into the /etc and pull out all of the individual .local files. Also, you still have to log in as root to change this, or at least use sudo to make any edits. In comes Part 2

Part II:
So now we have all our local changes in a separate file for easy upkeep, but I am still having to go through and pull off the information and edit it has root. Sort of a pain, but there is an easy fix.

In my main user of the system ( and in my case, the only active non-root user) I create a .etc in my home dir. I then copied all the files ending in a .local inside this folder (easily found with find /etc -name "*.local" ). Then as root go into your /etc and replace all the .local files with a symlink to the actual file located in your newly created .etc. And that is it.

Conclusion:
So what has all this done. Several things
  1. All config changes are still system wide
  2. All config files are not effected by program updates
  3. Changes to any config file can be easily identified and therefore duplicated
  4. Your main user can now make changes to these files without switch to root, and changes are made system wide
  5. Backup and Portability are extreme simple, no since all changes are in one spot, and even more so in you home dir you whenever you backup your home, you have a backup of you config files. And since the config name uses the same name as the original it is easy to figure out which files you need to go edit to re-add the source to.


Notes / Comments:
  • this hasn't been widely tested, but I don't see why it shouldn't work for any application
  • Make sure you create backups of all your files before you start moving and deleting them, just in case you type a command that doesn't come out as expected.
  • The only config that I haven't been able to mimick easily system wide is the xinit, I used to start my WM from the one in /etc, but there are still a few apps (SLiM comes to mind) that still looks for .xinitrc to do its work
  • The only downside to putting it in your home dir on a multi user system, is all users would need read permission for that dir. You could move it elsewhere and give read/write permission if you don't feel comfortable given all the users on your system access to see your home dir.


Also I just came up with this, I haven't seen anything like it on the forums before. If you have any criticism or ideas, please share.
_________________
GibbonsR.net | OpenLaptops.org

Join the adopt an unanswered post initiative today
Back to top
View user's profile Send private message
DocReedSolomon
Guru
Guru


Joined: 28 Aug 2006
Posts: 419

PostPosted: Thu Dec 07, 2006 11:39 pm    Post subject: Reply with quote

ever heared about /etc/skel ?
Back to top
View user's profile Send private message
Insanity5902
Veteran
Veteran


Joined: 23 Jan 2004
Posts: 1228
Location: Fort Worth, Texas

PostPosted: Fri Dec 08, 2006 4:02 am    Post subject: Reply with quote

Yes I have have, my understanding /etc/skel is the default files to be put in a users home dir?
_________________
GibbonsR.net | OpenLaptops.org

Join the adopt an unanswered post initiative today
Back to top
View user's profile Send private message
synss
Apprentice
Apprentice


Joined: 08 Mar 2006
Posts: 280
Location: Dijon (F) > Berlin > Tokyo > Nürnberg (D)

PostPosted: Fri Dec 08, 2006 9:35 am    Post subject: Reply with quote

I also link /etc/local and /usr/local to $HOME/local so that my wrappers a.s.o. are easily edited, and I have a /etc/local/shell directory in which I have put my "bashrc", "zshrc", "aliases" and a "common" (POSIX) file, these are sourced by .zshrc (actually only sources /etc/local/shell/zshrc, which sources the rest, it is much easier to do than to explain it seems) Something similar to the default /etc/bash/bashrc gentoo provides, but I don't like it and prefer to write my own.
_________________
Compress portage tree
Elog viewer
Autodetect swap
Back to top
View user's profile Send private message
DocReedSolomon
Guru
Guru


Joined: 28 Aug 2006
Posts: 419

PostPosted: Fri Dec 08, 2006 9:41 am    Post subject: Reply with quote

Insanity5902 wrote:
Yes I have have, my understanding /etc/skel is the default files to be put in a users home dir?

yes. so if you put the configurations in there, the are copied to the users $HOME if you add a users. i post this because you mentioned:
Quote:

the bad part is, moving the changes from machine to machine, or re-installing the system means going through /etc to remember which files I changed and then going through the files to get the changes out of them.

you would not have that problem if you keep everything in /etc/skel..
for sure you have to back that one up somewhere.
Back to top
View user's profile Send private message
tkdfighter
Apprentice
Apprentice


Joined: 14 May 2004
Posts: 271
Location: Bludenz, Austria

PostPosted: Sun Dec 10, 2006 12:42 pm    Post subject: Reply with quote

Why not insert the config files you changed into Subversion or CVS? Then you could version changes, roll back if necessary and when you make a new install, you would just have to check out on the first machine. You would still need to be root to edit files though, but I prefer it that way anyways.
Back to top
View user's profile Send private message
Insanity5902
Veteran
Veteran


Joined: 23 Jan 2004
Posts: 1228
Location: Fort Worth, Texas

PostPosted: Sun Dec 10, 2006 4:11 pm    Post subject: Reply with quote

That's actually a really good idea, I didn't think of that. I am just started to collect a variety of machines (different archs, etc) and have been trying to find why to easily keep up with my changes.

Thanks ... time to rethink and rework this guide :)
_________________
GibbonsR.net | OpenLaptops.org

Join the adopt an unanswered post initiative today
Back to top
View user's profile Send private message
tkdfighter
Apprentice
Apprentice


Joined: 14 May 2004
Posts: 271
Location: Bludenz, Austria

PostPosted: Sun Dec 10, 2006 9:27 pm    Post subject: Reply with quote

Yeah, I've been thinking over this for quite a while now, I've just been too lazy to implement it :oops: Well, winter break is coming up, so maybe I'll get 'round to it then.
I'd really like to hear some more thoughts and opinions about this though.
Back to top
View user's profile Send private message
fengsui
n00b
n00b


Joined: 18 Dec 2006
Posts: 1

PostPosted: Mon Dec 18, 2006 7:58 am    Post subject: Reply with quote

tkdfighter wrote:
Yeah, I've been thinking over this for quite a while now, I've just been too lazy to implement it :oops: Well, winter break is coming up, so maybe I'll get 'round to it then.
I'd really like to hear some more thoughts and opinions about this though.
Back to top
View user's profile Send private message
PiRmD
n00b
n00b


Joined: 22 Apr 2005
Posts: 49
Location: Daya Bay NPS-Shenzhen-China

PostPosted: Thu Dec 21, 2006 4:59 pm    Post subject: Reply with quote

I'm managing such config files using svn.
Have a look here :
- http://kitenet.net/~joey/svnhome.html
- http://toykeeper.net/tutorials/svnhome

HTH
Back to top
View user's profile Send private message
tkdfighter
Apprentice
Apprentice


Joined: 14 May 2004
Posts: 271
Location: Bludenz, Austria

PostPosted: Sat Dec 23, 2006 12:03 pm    Post subject: Reply with quote

Very impressive, PiRmD! But isn't it a pain to maintain and add files all the time? I mean, everytime you (or a program) create(s) a new file, you have to manually add it to SVN, right?
Back to top
View user's profile Send private message
PiRmD
n00b
n00b


Joined: 22 Apr 2005
Posts: 49
Location: Daya Bay NPS-Shenzhen-China

PostPosted: Tue Dec 26, 2006 7:59 pm    Post subject: Reply with quote

yes it requires a bit more work but using svn is really easy, and most of the functionalities you need to implement a "home/etc" under svn are really basic. In fact, you can develop some script to help you in this task.

I appreciate this approach mostly because it provides :
- archiving !
- a mean to reconstruct past version and correct errors
- I also like the idea to have a kind of log of my modifications
- I can easily track the files I have modified (thus it requires you to first record them in your svn repository)

Unfortunately I lack of time to fine tune this approach (and develop some useful script to assist me, notably managing permission is a not so direct if you plan to use it for your /etc).
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum