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!

I want to read more…
No comments.
***

Cleaning Up: libtool: *.la not a valid archive

If you’ve used and built packages from source, chances are you’ve run into some derivation of this dreadful message:

libtool: link: `/usr/lib/libgnomevfs-2.la' is not a valid libtool archive

Unfortunately, there are a few potential causes ranging from broken packages to missing packages, but in general, they are the result of broken dependencies (missing packages are broken dependencies, after all!). Read on about some potential workarounds and solutions!

I want to read more…
No comments.
***
Page 1 of 212Next »