View previous topic :: View next topic |
Author |
Message |
BradB Apprentice
Joined: 18 Jun 2002 Posts: 190 Location: Christchurch NZ
|
Posted: Tue Jan 07, 2003 11:17 am Post subject: Graphical etc-update |
|
|
OK, until recently I was very, very slack at keeping my /etc files up todate - mainly because I didn't know about 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
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
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
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 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 |
|
|
DArtagnan l33t
Joined: 30 Apr 2002 Posts: 942 Location: Israel, Jerusalem
|
Posted: Tue Jan 07, 2003 1:00 pm Post subject: |
|
|
going to try it _________________ All for one and one for All
--
MACPRO machine... |
|
Back to top |
|
|
cvk Guru
Joined: 06 Jan 2003 Posts: 314 Location: Our house, in the middle of our street
|
Posted: Thu Jan 09, 2003 7:08 pm Post subject: |
|
|
Looks good, thank you.
cvk |
|
Back to top |
|
|
elzbal Guru
Joined: 31 Aug 2002 Posts: 364 Location: Seattle, WA, USA
|
Posted: Thu Jan 09, 2003 7:28 pm Post subject: Re: Graphical etc-update |
|
|
BradB wrote: |
Oh, if you're like me & su to root from a console, you will probably need to run 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 |
|
|
pjp Administrator
Joined: 16 Apr 2002 Posts: 20067
|
Posted: Thu Jan 09, 2003 8:00 pm Post subject: Re: Graphical etc-update |
|
|
elzbal wrote: | It would be better to use
Code: | xhost +machinename
i.e.
xhost +bigbox |
| Also works. _________________ Quis separabit? Quo animo? |
|
Back to top |
|
|
steelrose Apprentice
Joined: 06 May 2002 Posts: 245 Location: Cyprus
|
Posted: Fri Jan 10, 2003 6:31 am Post subject: |
|
|
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 |
|
|
woodm Tux's lil' helper
Joined: 18 Jun 2002 Posts: 75
|
Posted: Fri Jan 10, 2003 7:28 am Post subject: Nice. Call |
|
|
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 |
|
|
BradB Apprentice
Joined: 18 Jun 2002 Posts: 190 Location: Christchurch NZ
|
Posted: Fri Jan 10, 2003 11:49 am Post subject: |
|
|
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 |
|
|
Houdini Apprentice
Joined: 14 Jun 2002 Posts: 224 Location: New Mexico Tech, Socorro, NM
|
Posted: Sun Jan 12, 2003 6:55 am Post subject: Re: Graphical etc-update |
|
|
elzbal wrote: | BradB wrote: |
Oh, if you're like me & su to root from a console, you will probably need to run 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.
Is the right thing to do. (As KanusPlusPlus said) _________________ ^]:wq |
|
Back to top |
|
|
eyevee99 Apprentice
Joined: 16 Apr 2002 Posts: 239
|
Posted: Mon Jan 13, 2003 8:54 am Post subject: Not happy Jan |
|
|
gtkdiff corrupted my make.conf.
it's gone. How can I get the default one back?
Cheers
Ryan |
|
Back to top |
|
|
zojas Veteran
Joined: 22 Apr 2002 Posts: 1138 Location: Phoenix, AZ
|
Posted: Thu Jan 16, 2003 6:44 pm Post subject: kompare |
|
|
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 |
|
|
ksclarke n00b
Joined: 22 Nov 2002 Posts: 9 Location: Pennington, NJ
|
Posted: Fri Jan 17, 2003 1:05 am Post subject: Re: Graphical etc-update |
|
|
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 |
|
|
zojas Veteran
Joined: 22 Apr 2002 Posts: 1138 Location: Phoenix, AZ
|
Posted: Fri Jan 17, 2003 3:04 am Post subject: |
|
|
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 |
|
|
TGL Bodhisattva
Joined: 02 Jun 2002 Posts: 1978 Location: Rennes, France
|
Posted: Fri Jan 17, 2003 10:50 am Post subject: |
|
|
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 |
|
|
zojas Veteran
Joined: 22 Apr 2002 Posts: 1138 Location: Phoenix, AZ
|
Posted: Fri Jan 17, 2003 1:05 pm Post subject: |
|
|
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 |
|
|
tod Developer
Joined: 17 Apr 2002 Posts: 136 Location: Ozarks, USA
|
Posted: Mon Jan 27, 2003 9:25 pm Post subject: Re: Graphical etc-update |
|
|
elzbal wrote: | BradB wrote: |
Oh, if you're like me & su to root from a console, you will probably need to run 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 |
|
|
rtn Guru
Joined: 15 Nov 2002 Posts: 427
|
Posted: Mon Jan 27, 2003 10:48 pm Post subject: |
|
|
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 |
|
|
JoeGreensticks n00b
Joined: 23 Jan 2003 Posts: 8
|
Posted: Wed Feb 05, 2003 4:21 pm Post subject: Great Tip! |
|
|
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 |
|
|
tecknojunky Veteran
Joined: 19 Oct 2002 Posts: 1937 Location: Montréal
|
Posted: Sat Feb 08, 2003 5:20 am Post subject: |
|
|
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 |
|
|
krogoth n00b
Joined: 15 Aug 2002 Posts: 38
|
Posted: Sat Feb 08, 2003 8:08 pm Post subject: |
|
|
Zojas:
Code: | kompare file1 file2 |
btw, anyone who hasn't tried kompare should - I really like the way it displays changes. |
|
Back to top |
|
|
Xenarion n00b
Joined: 16 Jan 2003 Posts: 54
|
Posted: Sat Feb 08, 2003 8:28 pm Post subject: |
|
|
what is diff? |
|
Back to top |
|
|
zojas Veteran
Joined: 22 Apr 2002 Posts: 1138 Location: Phoenix, AZ
|
Posted: Sat Feb 08, 2003 8:43 pm Post subject: |
|
|
if you run konqueror, try this:
or
or on the command line:
that describes it much better than I could. |
|
Back to top |
|
|
Uranus Guru
Joined: 07 May 2002 Posts: 438 Location: Portugal, Braga
|
Posted: Mon Feb 10, 2003 8:06 am Post subject: |
|
|
screenshot anyone? |
|
Back to top |
|
|
zojas Veteran
Joined: 22 Apr 2002 Posts: 1138 Location: Phoenix, AZ
|
Posted: Mon Feb 10, 2003 12:48 pm Post subject: |
|
|
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 |
|
|
[UK]Superdude Tux's lil' helper
Joined: 22 Jul 2002 Posts: 149 Location: Adelaide, Australia
|
Posted: Tue Feb 11, 2003 4:18 am Post subject: |
|
|
zojas wrote: | if you run konqueror, try this:
or
|
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 |
|
|
|