Gnome Sudo in Gentoo

Having gotten used to the sudo-like interface presented in Ubuntu for most user-facing operations that require root access, the sudden lack of such convenience in Gentoo was grating. Fortunately, the solution is fairly easy, even if it isn’t mentioned anywhere that can be found by a cursory Google search. (I’m sure there’s an entry on the Gentoo forums, but let’s face it–for most people, if Google can’t find it, it doesn’t exist.)

The solution: Run gconf-editor, browse to apps/gksu, and then tick sudo-mode. That’s it!

Slightly longer answer: After wasting about 5 minutes searching for the answer, I found the solution in the man page for gksu which pointed to the gconf setting above.

You may have also noticed from this post that I’ve mentioned Gentoo for the first time in a while. There are a few reasons for this–which I’ll save for future posts–but it’s largely because of various irritations I’ve found with running Ubuntu for a while. Don’t worry, I’ll make an honest effort to share my rationale with you.

No comments.
***

Fun with find

A friend of mine was asking how to append a string to files contained in a directory structure of unknown depth. I dug around a little bit and found this gem.

Eric has been having several difficult issues building KDE 4-point-something on Funtoo (a Gentoo fork) and it occurred to him that it might be possible to add a specific use flag to every IUSE contained within the build. Unfortunately, due to the nature of the package directory structure, it would prove tiresome attempting to append the same string to each file. Besides, that’s what scripting is all about, isn’t it?

Here’s one possible solution:

find . -type f -name 'IUSE' -exec sh -c 'echo "exceptions" >> {}' \;

For a more secure solution, use -execdir:

find . -type f -name 'IUSE' -execdir sh -c 'echo "exceptions" >> {}' \;

If that syntax frightens you, for loop constructs are also a possibility:

for file in `find . -type f -name 'IUSE'` ; do echo "exceptions" >> $i ; done

If you know of others, share them!

No comments.
***

OpenRC Upgrade

I run Gentoo on my desktop. It lives on a separate drive, and I use it from time to time whenever I have Linux-related work to do. Recently, though, the install has been feeling its age and certain things have required extensive changes to the base system (specifically new versions of device-mapper).

This post is a warning to anyone wishing to switch to baselayout-2:

MAKE SURE YOUR SYSTEM IS UPDATED BEFORE MIGRATING! Read more…

No comments.
***