HMBR


unmask.sh
#!/bin/bash
#
#@author: Hélder Máximo Botter Ribas <helderribas at gmail.com>
#
# modified version of hmbr script with some ideias from bbj script
#
#

source /sbin/functions.sh

if [[ "`whoami`" != "root" ]]; then
        eerror "Root Privilegies Required"
        exit 1
fi

if [[ -z "$1" ]]; then
        ewarn "Use: ./$0 <package>"
        exit 2
fi

p_mask(){
        ebegin "Unmasking $pacote"
        echo "=$pacote" >>/etc/portage/package.unmask
        eend
}

p_key(){
        ebegin "Putting Keyword ~* for $pacote"
        echo "=$pacote ~*" >>/etc/portage/package.keywords
        eend

}

p_miss_key(){
        ebegin "Putting Keyword -* for $pacote"
        echo "${pacote/-[0-9]*} -*" >>/etc/portage/package.keywords
        eend

}

einfo "Looking for masked packages"
while true ;
do
        verificacao=`emerge -p $@  | grep masked\ by:\ ~ | tail -n 1`
        pacote=`echo $verificacao| cut -d" " -f2`
        if [[ -n $pacote ]]; then
                if [[ $verificacao == *package.mask* ]]; then
                        p_mask
                fi
                if [[ $verificacao == *keyword* ]]; then
                        if [[ $verificacao == *missing* ]]; then
                                p_miss_key
                        else
                                p_key
                        fi
                fi
                else
                        break
        fi

done
exit 0
Advertisements

Leave a Comment so far
Leave a comment



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s



%d bloggers like this: