Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Discussion & Documentation Documentation, Tips & Tricks
  • Search

Graphical etc-update

Unofficial documentation for various parts of Gentoo Linux. Note: This is not a support forum.
Post Reply
Advanced search
48 posts
  • 1
  • 2
  • Next
Author
Message
BradB
Apprentice
Apprentice
User avatar
Posts: 190
Joined: Tue Jun 18, 2002 2:54 am
Location: Christchurch NZ

Graphical etc-update

  • Quote

Post by BradB » Tue Jan 07, 2003 11:17 am

OK, until recently I was very, very slack at keeping my /etc files up todate - mainly because I didn't know about

Code: Select all

etc-update
I started using etc-update, but found the console diffs hard to follow. A bit of scrounging around found the file

Code: Select all

/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: Select all

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: Select all

pager="less"
it needs to go to

Code: Select all

#pager="less"
pager=""
Then you need to change the diff_command, mine looks like

Code: Select all

diff_command="gtkdiff -g 1600x1000 %file1 %file2"
I like to use my whole resolution for width, so I specify the geometry with

Code: Select all

 -g 1600x1000 
Change these values so gtkdiff looks nice on the screen.

For the merge command I have

Code: Select all

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: Select all

 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.
Top
DArtagnan
l33t
l33t
User avatar
Posts: 942
Joined: Tue Apr 30, 2002 11:23 am
Location: Israel, Jerusalem
Contact:
Contact DArtagnan
Website

  • Quote

Post by DArtagnan » Tue Jan 07, 2003 1:00 pm

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

MACPRO machine...
Top
cvk
Guru
Guru
User avatar
Posts: 314
Joined: Mon Jan 06, 2003 11:07 am
Location: Our house, in the middle of our street

  • Quote

Post by cvk » Thu Jan 09, 2003 7:08 pm

Looks good, thank you.

cvk
Top
elzbal
Guru
Guru
User avatar
Posts: 364
Joined: Sat Aug 31, 2002 2:42 am
Location: Seattle, WA, USA
Contact:
Contact elzbal
Website

Re: Graphical etc-update

  • Quote

Post by elzbal » Thu Jan 09, 2003 7:28 pm

BradB wrote: Oh, if you're like me & su to root from a console, you will probably need to run

Code: Select all

 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: Select all

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!
Top
pjp
Administrator
Administrator
User avatar
Posts: 20708
Joined: Tue Apr 16, 2002 10:35 pm

Re: Graphical etc-update

  • Quote

Post by pjp » Thu Jan 09, 2003 8:00 pm

elzbal wrote:It would be better to use

Code: Select all

xhost +machinename
i.e.
xhost +bigbox

Code: Select all

xhost +localhost
Also works.
Quis separabit? Quo animo?
Top
steelrose
Apprentice
Apprentice
User avatar
Posts: 245
Joined: Mon May 06, 2002 5:28 pm
Location: Cyprus

  • Quote

Post by steelrose » Fri Jan 10, 2003 6:31 am

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
Top
woodm
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 75
Joined: Tue Jun 18, 2002 3:14 am

Nice. Call

  • Quote

Post by woodm » Fri Jan 10, 2003 7:28 am

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.
Top
BradB
Apprentice
Apprentice
User avatar
Posts: 190
Joined: Tue Jun 18, 2002 2:54 am
Location: Christchurch NZ

  • Quote

Post by BradB » Fri Jan 10, 2003 11:49 am

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
Top
Houdini
Apprentice
Apprentice
User avatar
Posts: 224
Joined: Fri Jun 14, 2002 4:59 am
Location: New Mexico Tech, Socorro, NM

Re: Graphical etc-update

  • Quote

Post by Houdini » Sun Jan 12, 2003 6:55 am

elzbal wrote:
BradB wrote: Oh, if you're like me & su to root from a console, you will probably need to run

Code: Select all

 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: Select all

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: Select all

xhost +localhost
Is the right thing to do. (As KanusPlusPlus said)
^]:wq
Top
eyevee99
Apprentice
Apprentice
Posts: 239
Joined: Tue Apr 16, 2002 1:06 am

Not happy Jan

  • Quote

Post by eyevee99 » Mon Jan 13, 2003 8:54 am

gtkdiff corrupted my make.conf.

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

Cheers
Ryan
Top
zojas
Veteran
Veteran
User avatar
Posts: 1136
Joined: Mon Apr 22, 2002 11:29 pm
Location: Phoenix, AZ
Contact:
Contact zojas
Website

kompare

  • Quote

Post by zojas » Thu Jan 16, 2003 6:44 pm

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
Top
ksclarke
n00b
n00b
Posts: 9
Joined: Fri Nov 22, 2002 6:35 pm
Location: Pennington, NJ
Contact:
Contact ksclarke
Website

Re: Graphical etc-update

  • Quote

Post by ksclarke » Fri Jan 17, 2003 1:05 am

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.
Top
zojas
Veteran
Veteran
User avatar
Posts: 1136
Joined: Mon Apr 22, 2002 11:29 pm
Location: Phoenix, AZ
Contact:
Contact zojas
Website

  • Quote

Post by zojas » Fri Jan 17, 2003 3:04 am

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

Code: Select all

diff_command="gvim -d %file1 %file2"
Top
TGL
Bodhisattva
Bodhisattva
Posts: 1978
Joined: Sun Jun 02, 2002 12:13 pm
Location: Rennes, France

  • Quote

Post by TGL » Fri Jan 17, 2003 10:50 am

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: Select all

if [ i dont know what ] then gvimdiff %file1 %file2 ; else vimdiff %file1 %file2 
But I'm really hopeless at bashing... Any idea ?
Top
zojas
Veteran
Veteran
User avatar
Posts: 1136
Joined: Mon Apr 22, 2002 11:29 pm
Location: Phoenix, AZ
Contact:
Contact zojas
Website

  • Quote

Post by zojas » Fri Jan 17, 2003 1:05 pm

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: Select all

if [ -n "$DISPLAY" ]; then
  gvimdiff %file1 %file2
else
  vimdiff %file1 %file2
fi
Top
tod
Developer
Developer
User avatar
Posts: 136
Joined: Wed Apr 17, 2002 9:41 pm
Location: Ozarks, USA
Contact:
Contact tod
Website

Re: Graphical etc-update

  • Quote

Post by tod » Mon Jan 27, 2003 9:25 pm

elzbal wrote:
BradB wrote: Oh, if you're like me & su to root from a console, you will probably need to run

Code: Select all

 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: Select all

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 ... html#ss7.2
Top
rtn
Guru
Guru
Posts: 427
Joined: Fri Nov 15, 2002 6:57 pm

  • Quote

Post by rtn » Mon Jan 27, 2003 10:48 pm

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: Select all

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: Select all

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
Top
JoeGreensticks
n00b
n00b
User avatar
Posts: 8
Joined: Thu Jan 23, 2003 7:13 pm

Great Tip!

  • Quote

Post by JoeGreensticks » Wed Feb 05, 2003 4:21 pm

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.
Top
tecknojunky
Veteran
Veteran
User avatar
Posts: 1937
Joined: Sat Oct 19, 2002 6:50 am
Location: Montréal
Contact:
Contact tecknojunky
Website

  • Quote

Post by tecknojunky » Sat Feb 08, 2003 5:20 am

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.
Top
krogoth
n00b
n00b
Posts: 38
Joined: Thu Aug 15, 2002 7:57 pm

  • Quote

Post by krogoth » Sat Feb 08, 2003 8:08 pm

Zojas:

Code: Select all

kompare file1 file2
btw, anyone who hasn't tried kompare should - I really like the way it displays changes.
Top
Xenarion
n00b
n00b
Posts: 54
Joined: Thu Jan 16, 2003 7:58 pm

  • Quote

Post by Xenarion » Sat Feb 08, 2003 8:28 pm

what is diff?
Top
zojas
Veteran
Veteran
User avatar
Posts: 1136
Joined: Mon Apr 22, 2002 11:29 pm
Location: Phoenix, AZ
Contact:
Contact zojas
Website

  • Quote

Post by zojas » Sat Feb 08, 2003 8:43 pm

if you run konqueror, try this:

Code: Select all

man:diff
or

Code: Select all

info:diff
or on the command line:

Code: Select all

man diff
that describes it much better than I could.
Top
Uranus
Guru
Guru
Posts: 438
Joined: Tue May 07, 2002 5:49 pm
Location: Portugal, Braga
Contact:
Contact Uranus
Website

  • Quote

Post by Uranus » Mon Feb 10, 2003 8:06 am

screenshot anyone?
Top
zojas
Veteran
Veteran
User avatar
Posts: 1136
Joined: Mon Apr 22, 2002 11:29 pm
Location: Phoenix, AZ
Contact:
Contact zojas
Website

  • Quote

Post by zojas » Mon Feb 10, 2003 12:48 pm

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 ... update.jpg
Top
[UK]Superdude
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 149
Joined: Mon Jul 22, 2002 10:34 am
Location: Adelaide, Australia

  • Quote

Post by [UK]Superdude » Tue Feb 11, 2003 4:18 am

zojas wrote:if you run konqueror, try this:

Code: Select all

man:diff
or

Code: Select all

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 :)
Top
Post Reply

48 posts
  • 1
  • 2
  • Next

Return to “Documentation, Tips & Tricks”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Authors
Gentoo is a trademark of the Gentoo Foundation, Inc. and of Förderverein Gentoo e.V.
The contents of this document, unless otherwise expressly stated, are licensed under the CC-BY-SA-4.0 license.
The Gentoo Name and Logo Usage Guidelines apply.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy