LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-22-2012, 06:26 PM   #1
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 211Reputation: 211Reputation: 211
Versioning in /etc


I often want to see what changes I've made in /etc, because I've forgotten.

I suppose one thing you could do is initialize a git repository in /etc after installing the OS.

In apt-based OSs, is there a command to show the modifications one has made against files, compared to what is in the repository?

Something like:
Code:
dpkg-diff-against-repo /path/to/file
Or any other method of accomplishing this (other than the Git idea -- it's too late for me on this system.)
 
Old 02-22-2012, 08:28 PM   #2
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
I don't believe there is any built-in function for that, no. The accepted method here is, like you said, run some kind of version control software against /etc (git, CVS, etc).

I suppose if you really wanted to see what had changed, you could manually unpack a package and look at the files it contains.
 
Old 02-22-2012, 08:54 PM   #3
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
Quote:
Originally Posted by jhwilliams
Or any other method of accomplishing this (other than the Git idea -- it's too late for me on this system.)
Nope, it's not too late. Though, my solution will entail a decent bit of work

1) Install VirtualBox, VMWare, KVM or whatever virtual machine software you like.
2) Install your distro+version on the virtual machine
3) Install all the same packages on your real machine into your virtual machine. See this other thread for how to handle that efficiently.
4) Tar your virtual machine's /etc directory
5) Move the tarball to your physical machine through whatever method you like (e.g. shared folders, usb pendrive, email)
6) Un-tar the virtual machine's etc directory in some temporary location
7) import the virtual machine's etc into whatever version control system you like
8) verify the import by checking out the files in another location
9) do a recursive copy (e.g. "cp -a" ) from you production /etc on top of the just-checked-out version
10) commit your "changes"

At that point, you should have something very, very close to what you were originally after... just without any step-wise revision history.

Then you need to decide whether you want your production /etc directory to be tied into your version control, or if you want to mess with the files elsewhere and "publish" changes to /etc.

If your /etc is going to tied into your repository, you'll likely need to boot off a live CD and do the checkout into your /etc, but make a backup copy just in case.

Last edited by Dark_Helmet; 02-22-2012 at 08:58 PM.
 
Old 02-23-2012, 10:58 AM   #4
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Original Poster
Rep: Reputation: 211Reputation: 211Reputation: 211
Hey guys,

Thanks for the responses. They got me thinking. One could implement a dpkg-repo-diff command like this:

1. Accept 0..n paths on command line.
2. for each item, get the package it came from. Expand the package and diff the contents against the path given.


That is, (in pseudo code (three minutes here, not looking to flesh out, just an overview.))

Code:
#!/bin/bash
# dpkg-repo-diff [pathspec ...]

paths="$@"
for path in $paths; do
    # Figure out what package it came from
    pkg_owner=$(dpkg -S $path | awk '{ print $1 }')
    
    # get and unpack the package
    # TODO

    # diff the two items
    diff $path /path/to/unpacked/copy    
done
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Versioning software madsovenielsen Programming 3 10-02-2010 08:19 PM
versioning in linux fizeelinux Linux - Newbie 13 02-10-2009 05:49 AM
File versioning ssilayaraja Linux - Software 2 03-17-2008 09:23 AM
libstdc++ versioning vani Linux - Software 4 12-06-2005 12:33 PM
Module Versioning!!!???? Creator Linux - Newbie 9 01-07-2002 05:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration