You were never here, you didn't see anything..

Gentoo Portage Direcotires


I think I missed it, or just overlooked the option, but portage can use directories for the package specific options. So rather than a single file like package.use you can create a directory package.use and create a file inside with the content for a specific pacakge. This makes sense to me as it would allow one to more easily see what is there without reading through a file and manage things more easily as you can simply add a file to enable something or remove it to disable it. But how to quickly move tot he directory structure of things…

Bash to the rescue of course. A quick one-liner for each one you already have a file for and you are off. Simply create a temp direcotry, run the command and, remove the file and move your directory in to its propper place. For example to mangle package.accept_keywords:

mkdir package.use_tmp
while read line; do echo "$line" > package.use_tmp/$(echo $line | awk '{ print $1 }' | cut -d "/" -f 2); done < package.use
rm package.use
mv package.use_tmp package.use

Line 1 creates the temporary directory. Line 2 reads the input file line by line and echos the line content out to a new file in the temporary directory. Line 3 removes the old file which is no longer needed. Line 4 moves the temporary directory in to place.

I edit and run this as needed for all the files I had. All done…

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This blog is kept spam free by WP-SpamFree.

Most who fail…

Most who fail have yet to really try!