Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
SCRIPT: fing-emerge.sh fast unstable/masked/keyword emerges
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
likewhoa
l33t
l33t


Joined: 04 Oct 2006
Posts: 731
Location: Brooklyn, New York

PostPosted: Wed Oct 11, 2006 10:59 pm    Post subject: SCRIPT: fing-emerge.sh fast unstable/masked/keyword emerges Reply with quote

What this script will do is automate the emerge process of packages that are masked by package.mask and packages with missing keywords.

Code:

#!/bin/bash

until [ $z ]; do
        emerge $1 1>>data
        package="$(sed -n 4p data|cut -d ' ' -f2|tr -d '[:space:]')"
        pmasked="$(sed -n 4p data|cut -d ' ' -f5|tr -d ')[:space:]')"
        x="$(echo ${package}|tr -d '[:digit:].[:digit:].[:digit:][:space:]'|wc -c)"
        ((x-=1))
        y="$(echo ${package}|cut -b 0-${x})"
        if [ $pmasked = "package.mask" ]; then
               echo "${package} masked, unmasking now.."
               echo "=${package}">>/etc/portage/package.unmask
        else   
               echo "${package} masked by keyword, unmasking now.."
               echo "${y} -*">>/etc/portage/package.keywords
        fi
        cat /dev/null >data
        if [ "$(emerge $1 -pv)" ]; then z="0"; rm -v data; emerge $1 -av; fi
done



example:

# emerge gnome-2.16.1 while automating unmasked of dependency packages.
./fing-emerge.sh =gnome-base/gnome-2.16.1
Back to top
View user's profile Send private message
Aonoa
Guru
Guru


Joined: 23 May 2002
Posts: 574
Location: Oslo, Norway

PostPosted: Sat Oct 21, 2006 10:38 pm    Post subject: Reply with quote

Thanks a lot for this script. I just modified it slightly because it didn't work on some packages I tried, like quake3. And some packages required an entry in both package.unmask and package.keywords. One thing I'd still like to fix is that it currently emerges only the first "unstable" package seen, on line 4(sed -n 4p...) after a "emerge -av package". Like quake3 some packages have several different unstable versions, that would appear on line 5 and later. So, right now this script emerges the cvs 9999 version of quake3 and not the usual 1.34 version.

Code:
#!/bin/bash

until [ $z ]; do
   emerge $1 1>>data
      package="$(sed -n 4p data|cut -d ' ' -f2|tr -d '[:space:]'|sed -n -e 's/\-[0-9].*.//p')"
      pmasked="$(sed -n 4p data|cut -d ' ' -f5|tr -d ')[:space:]')"
   case $pmasked in
      package.mask,)
      echo "${package} masked by package.mask and keyword, unmasking now.."
      echo "${package}">>/etc/portage/package.unmask
      echo "${package}">>/etc/portage/package.keywords
      ;;
      package.mask)
      echo "${package} masked by package.mask, unmasking now.."
      echo "${package}">>/etc/portage/package.unmask
      ;;
      missing)
      echo "${package} masked by missing keyword, unmasking now.."
      echo "${package} -*">>/etc/portage/package.keywords
      ;;
      ~x86)
      echo "${package} masked by keyword, unmasking now.."
      echo "${package}">>/etc/portage/package.keywords
      ;;
   esac
   cat /dev/null >data
   if [ "$(emerge $1 -pv)" ]; then z="0"; rm -v data; emerge $1 -av; fi
done

_________________
Dive into Gentoo Linux and emerge into a new world
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum