Script gentoo use flags

From Alessandro's Wiki
Revision as of 17:44, 14 April 2011 by Porcelinux (talk | contribs) (moved USE flags to Script gentoo use flags: too generic name)

Use flags are words representing parts of software that can be compiled with or without those pieces


script uses

it's a tiny dirty bash script very useful to know the meaning of a use flag (and check his existance) from terminal


#!/bin/bash
# by porcelinux82
source /etc/make.conf
USEfiles="/usr/portage/profiles/use.desc /usr/portage/profiles/use.local.desc"
if ! [ "x$1" == "x" ]
then
        USES="$1"
else
        USES=$USE
fi

# to store the cleaned uses 
 newuses=""
for thisusefile in $USEfiles
do
echo "according: `basename $thisusefile` 
..."
        for thisuse in $USES
        do
                desc=""
                ABSflag=`echo $thisuse|sed -e s/-//`
                # echo ">> Use Flag [ $a ] " 
                if ( `grep -q ^$ABSflag $thisusefile` )
                then
                        [ "$ABSflag" == "$thisuse"  ] || desc="NOT> "
                        desc="$desc "`grep "^$ABSflag" $thisusefile`
                        newuses="$newuses $thisuse"
                else
                        desc="!$ABSflag --> Use flag NOT FOUND !"
                fi
                echo $desc

        done
echo "newuses:  $newuses"
done