Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Graphical etc-update
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
BradB
Apprentice
Apprentice


Joined: 18 Jun 2002
Posts: 190
Location: Christchurch NZ

PostPosted: Tue Jan 07, 2003 11:17 am    Post subject: Graphical etc-update Reply with quote

OK, until recently I was very, very slack at keeping my /etc files up todate - mainly because I didn't know about
Code:
etc-update
I started using etc-update, but found the console diffs hard to follow. A bit of scrounging around found the file
Code:
/etc/etc-update.conf
If you take a look at it you'll find there are some provisions for changing the commands for diff and merge, there are event lines you can uncomment to enable vim diffing.

I'm not all that great with vim, so I thought I'd try to use a graphical diff - namely gtkdiff.
You'll need to emerge it :)
Code:

emerge gtkdiff

I think xxdiff would probably do, but I haven't had more than a cursory look - so I won't comment.

The first change is the line
Code:
pager="less"
it needs to go to
Code:

#pager="less"
pager=""


Then you need to change the diff_command, mine looks like
Code:

diff_command="gtkdiff -g 1600x1000 %file1 %file2"

I like to use my whole resolution for width, so I specify the geometry with
Code:
 -g 1600x1000

Change these values so gtkdiff looks nice on the screen.

For the merge command I have
Code:

merge_command="gtkdiff -g 1600x1000 -o %merged %orig %new"


The merge command displays 3 panes, with the merged pane displayed in the top half - the program is simple to control so I won't go over it. The only gotcha is that after you are happy with the merge, you must save the merged file - simply right-click on the top pane and select output file.

This works fine for me - my only problem is that gtkdiff will display 3 panes after it has been used in merge mode, even when it is in diff mode. If anybody knows how to force 2 panes only in diff mode (via commandline, not via the GUI) please let me know.

If I get motivated enough I may trawl through the code & add options to force 2 pane and auto-save.

Oh, if you're like me & su to root from a console, you will probably need to run
Code:
 xhost +
with your regular user. There are security issues here I'd expect, but I don't know about them - help here would be good.

Any feedback would be great.

Cheers
Brad


Last edited by BradB on Tue Jan 07, 2003 7:52 pm; edited 1 time in total
Back to top
View user's profile Send private message
DArtagnan
l33t
l33t


Joined: 30 Apr 2002
Posts: 942
Location: Israel, Jerusalem

PostPosted: Tue Jan 07, 2003 1:00 pm    Post subject: Reply with quote

going to try it :-)
_________________
All for one and one for All
--

MACPRO machine...
Back to top
View user's profile Send private message
cvk
Guru
Guru


Joined: 06 Jan 2003
Posts: 314
Location: Our house, in the middle of our street

PostPosted: Thu Jan 09, 2003 7:08 pm    Post subject: Reply with quote

Looks good, thank you.

cvk
Back to top
View user's profile Send private message
elzbal
Guru
Guru


Joined: 31 Aug 2002
Posts: 364
Location: Seattle, WA, USA

PostPosted: Thu Jan 09, 2003 7:28 pm    Post subject: Re: Graphical etc-update Reply with quote

BradB wrote:

Oh, if you're like me & su to root from a console, you will probably need to run
Code:
 xhost +
with your regular user. There are security issues here I'd expect, but I don't know about them - help here would be good.


One issue is that remote users can throw up their own windows on your box or (I think) randomly change your X settings. It would be better to use
Code:
xhost +machinename
i.e.
xhost +bigbox
so that only people logged in to your box can connect to it.

Thanks for the tip! That's what makes this forum so great!
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20067

PostPosted: Thu Jan 09, 2003 8:00 pm    Post subject: Re: Graphical etc-update Reply with quote

elzbal wrote:
It would be better to use
Code:
xhost +machinename
i.e.
xhost +bigbox
Code:
xhost +localhost
Also works.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
steelrose
Apprentice
Apprentice


Joined: 06 May 2002
Posts: 245
Location: Cyprus

PostPosted: Fri Jan 10, 2003 6:31 am    Post subject: Reply with quote

BradB:i like your idea a lot so i followed your instructions.when i run etc-update i get the output in no-gui.when i run gtkdiff i get nothing.how do i run this?
_________________
Hey.I am new to Linux and i will ask some stupid questions sometimes so please don't get angry with me and help
Back to top
View user's profile Send private message
woodm
Tux's lil' helper
Tux's lil' helper


Joined: 18 Jun 2002
Posts: 75

PostPosted: Fri Jan 10, 2003 7:28 am    Post subject: Nice. Call Reply with quote

Hey, is there a good package to install/reinstall to test out the new merging?

I don't want anything big or important.


This is a GREAT idea. And I'm really glad you published it. I happen to be deeply in love with vim, so I will go that way, but that doesn't detract from my thank you in anyway.
_________________
There are thousands of types of people in this world:
The type that seperates people into two groups,
and the thousands of other types.
Back to top
View user's profile Send private message
BradB
Apprentice
Apprentice


Joined: 18 Jun 2002
Posts: 190
Location: Christchurch NZ

PostPosted: Fri Jan 10, 2003 11:49 am    Post subject: Reply with quote

SteelRose - how do you mean you geet no output in gtkdiff? Does the app even start when you run it from the console? You need to modify the file /etc/etc-update.conf to tell etc-update to use gtkdiff

Woodm - I don't know, I hadn't updated for ages and had about 30 files that needed doing :) It's good motivation for finding a better way, thanks for the positive feedback.

Cheers
Brad
Back to top
View user's profile Send private message
Houdini
Apprentice
Apprentice


Joined: 14 Jun 2002
Posts: 224
Location: New Mexico Tech, Socorro, NM

PostPosted: Sun Jan 12, 2003 6:55 am    Post subject: Re: Graphical etc-update Reply with quote

elzbal wrote:
BradB wrote:

Oh, if you're like me & su to root from a console, you will probably need to run
Code:
 xhost +
with your regular user. There are security issues here I'd expect, but I don't know about them - help here would be good.


One issue is that remote users can throw up their own windows on your box or (I think) randomly change your X settings. It would be better to use
Code:
xhost +machinename
i.e.
xhost +bigbox
so that only people logged in to your box can connect to it.

Thanks for the tip! That's what makes this forum so great!


Actually, the worry is that remote users can read your keypresses, doing things like grabbing passwords. A program to do such a thing is trivial to write.

Code:
xhost +localhost

Is the right thing to do. (As KanusPlusPlus said)
_________________
^]:wq
Back to top
View user's profile Send private message
eyevee99
Apprentice
Apprentice


Joined: 16 Apr 2002
Posts: 239

PostPosted: Mon Jan 13, 2003 8:54 am    Post subject: Not happy Jan Reply with quote

gtkdiff corrupted my make.conf.

it's gone. How can I get the default one back?

Cheers
Ryan
Back to top
View user's profile Send private message
zojas
Veteran
Veteran


Joined: 22 Apr 2002
Posts: 1138
Location: Phoenix, AZ

PostPosted: Thu Jan 16, 2003 6:44 pm    Post subject: kompare Reply with quote

a program called kompare was just pointed out to me. it lets you interactively (&graphically) merge the two files. now someone needs to figure out how to use it with etc-update. kompare is in kde-base/kdesdk
Back to top
View user's profile Send private message
ksclarke
n00b
n00b


Joined: 22 Nov 2002
Posts: 9
Location: Pennington, NJ

PostPosted: Fri Jan 17, 2003 1:05 am    Post subject: Re: Graphical etc-update Reply with quote

This is a GREAT idea... THANKS! The terminal etc-update has been my least favorite thing about Gentoo so far (though I like the concept of protecting them it's been a bit of a pain for some). Now I have nothing to complain about... just need to find something to test it out on. Suggestions anyone for a package to test it on?

Thanks, Kevin
_________________
There are two kinds of people in this world: those who believe there are two kinds of people and those who know better.
Back to top
View user's profile Send private message
zojas
Veteran
Veteran


Joined: 22 Apr 2002
Posts: 1138
Location: Phoenix, AZ

PostPosted: Fri Jan 17, 2003 3:04 am    Post subject: Reply with quote

another way would be to use gvim for the diff_command in /etc/etc-update.conf:

Code:
diff_command="gvim -d %file1 %file2"
Back to top
View user's profile Send private message
TGL
Bodhisattva
Bodhisattva


Joined: 02 Jun 2002
Posts: 1978
Location: Rennes, France

PostPosted: Fri Jan 17, 2003 10:50 am    Post subject: Reply with quote

I would like to add a test to know if the commande has been launch from a linux console or from an X terminal, something like that:
Code:
if [ i dont know what ] then gvimdiff %file1 %file2 ; else vimdiff %file1 %file2

But I'm really hopeless at bashing... Any idea ?
Back to top
View user's profile Send private message
zojas
Veteran
Veteran


Joined: 22 Apr 2002
Posts: 1138
Location: Phoenix, AZ

PostPosted: Fri Jan 17, 2003 1:05 pm    Post subject: Reply with quote

well, etc-update.conf isn't a bash script. it's just sourced by the etc-update bash script. so you would need to hack that. I think you can only set variables in /etc/etc-update.conf.

but you should be able to just use gvimdiff. if it can't open your X display, it will fall back to vimdiff. Isn't there a note in the etc-update.conf file that says not to use vimdiff?

if it were a script though, here's the syntax you're looking for:

Code:
if [ -n "$DISPLAY" ]; then
  gvimdiff %file1 %file2
else
  vimdiff %file1 %file2
fi
Back to top
View user's profile Send private message
tod
Developer
Developer


Joined: 17 Apr 2002
Posts: 136
Location: Ozarks, USA

PostPosted: Mon Jan 27, 2003 9:25 pm    Post subject: Re: Graphical etc-update Reply with quote

elzbal wrote:
BradB wrote:

Oh, if you're like me & su to root from a console, you will probably need to run
Code:
 xhost +
with your regular user. There are security issues here I'd expect, but I don't know about them - help here would be good.


One issue is that remote users can throw up their own windows on your box or (I think) randomly change your X settings. It would be better to use
Code:
xhost +machinename
i.e.
xhost +bigbox
so that only people logged in to your box can connect to it.

Thanks for the tip! That's what makes this forum so great!


A better way than xhost is detailed in the Remote X Apps Mini-Howto at http://www.tldp.org/HOWTO/mini/Remote-X-Apps-7.html#ss7.2
Back to top
View user's profile Send private message
rtn
Guru
Guru


Joined: 15 Nov 2002
Posts: 427

PostPosted: Mon Jan 27, 2003 10:48 pm    Post subject: Reply with quote

TGL wrote:
I would like to add a test to know if the commande has been launch from a linux console or from an X terminal, something like that:
Code:
if [ i dont know what ] then gvimdiff %file1 %file2 ; else vimdiff %file1 %file2

But I'm really hopeless at bashing... Any idea ?




You could check the output from `tty` and go from there. I use it in my
.bash_profile to find out if I'm on the first virtual console to automagically
fire up X for me. Just need to take this example one step further...


Code:
if [ `tty` = "/dev/vc/1" ]; then
        echo ""
        echo "Starting X in 2 seconds (type Control-C to interrupt)"
        sleep 2
        echo ""
        startx > .Xoutput 2> .Xerrorlog
        clear           # get rid of annoying cursor rectangle
        logout          # logout after leaving windows system
fi


--rtn
Back to top
View user's profile Send private message
JoeGreensticks
n00b
n00b


Joined: 23 Jan 2003
Posts: 8

PostPosted: Wed Feb 05, 2003 4:21 pm    Post subject: Great Tip! Reply with quote

I just wanted to say that these types of ideas and discussions are why Gentoo is now my Linux of choice. This is a great tip that I used very successfully this morning with 25+ files.
Back to top
View user's profile Send private message
tecknojunky
Veteran
Veteran


Joined: 19 Oct 2002
Posts: 1937
Location: Montréal

PostPosted: Sat Feb 08, 2003 5:20 am    Post subject: Reply with quote

Thanks for this great tip.

I was a little at lost first, with gvimdiff, but this showed me all I needed to do.

As for controling file names and such, I simply import the diffs into the original file and save as is, overwriting the old one.

The dialog menu if kind of nice but it's only half done. Not much gain from it, but it will be nice when they complete it.
_________________
(7 of 9) Installing star-trek/species-8.4.7.2::talax.
Back to top
View user's profile Send private message
krogoth
n00b
n00b


Joined: 15 Aug 2002
Posts: 38

PostPosted: Sat Feb 08, 2003 8:08 pm    Post subject: Reply with quote

Zojas:

Code:
kompare file1 file2


btw, anyone who hasn't tried kompare should - I really like the way it displays changes.
Back to top
View user's profile Send private message
Xenarion
n00b
n00b


Joined: 16 Jan 2003
Posts: 54

PostPosted: Sat Feb 08, 2003 8:28 pm    Post subject: Reply with quote

what is diff?
Back to top
View user's profile Send private message
zojas
Veteran
Veteran


Joined: 22 Apr 2002
Posts: 1138
Location: Phoenix, AZ

PostPosted: Sat Feb 08, 2003 8:43 pm    Post subject: Reply with quote

if you run konqueror, try this:
Code:
man:diff

or
Code:
info:diff

or on the command line:
Code:
man diff

that describes it much better than I could.
Back to top
View user's profile Send private message
Uranus
Guru
Guru


Joined: 07 May 2002
Posts: 438
Location: Portugal, Braga

PostPosted: Mon Feb 10, 2003 8:06 am    Post subject: Reply with quote

screenshot anyone?
Back to top
View user's profile Send private message
zojas
Veteran
Veteran


Joined: 22 Apr 2002
Posts: 1138
Location: Phoenix, AZ

PostPosted: Mon Feb 10, 2003 12:48 pm    Post subject: Reply with quote

I have a screenshot of running gvimdiff through etc-update over ssh to my pentium II from my ibook in Mac OS X (it dual boots with gentoo I just happened to be running OS X when I took the screenshot)

http://www.desertsol.com/~kevin/screens/030117_etc-update.jpg
Back to top
View user's profile Send private message
[UK]Superdude
Tux's lil' helper
Tux's lil' helper


Joined: 22 Jul 2002
Posts: 149
Location: Adelaide, Australia

PostPosted: Tue Feb 11, 2003 4:18 am    Post subject: Reply with quote

zojas wrote:
if you run konqueror, try this:
Code:
man:diff

or
Code:
info:diff



I never knew you could do that in konq.

I guess if you can learn something new each day its been a good day :)
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
Goto page 1, 2  Next
Page 1 of 2

 
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