#!/bin/bash ARCH=`emerge --info | awk -F\" '$1~/^ACCEPT_KEYWORDS=$/{print $2}'` #Get name and category for PKG in `eix --format '()/()' $@ | grep -ve '^$\|^Found [0-9]*\ matches$\|^\[[0-9]*\]'`; do CATEGORY=`echo ${PKG} | cut -d"/" -f1` NAME=`echo ${PKG} | cut -d"/" -f2` #Get the latest version of the package that is masked with ~ARCH #and grab major version and minor version but no subversions VERSION=`ACCEPT_KEYWORDS="~${ARCH}" eix --format '()' -C ${CATEGORY} -e ${NAME} | grep -ve '^$\|^Found [0-9]* matches$\|^\[[0-9]*\]' | awk -F'.' '{OFS=".";print $1,$2}' | sed -e 's/\~//'` #Ask whether it should be added to package.keywords - Yes is default echo Do you wish to add \'=${PKG}-${VERSION}*\ ~${ARCH}\' to package.keywords? \(Yes/no\) read RESULT #If confirmed add it to package.keywords if [ -z "${RESULT}" ] || [ "${RESULT}" = "Yes" ] || [ "${RESULT}" = "yes" ] || [ "${RESULT}" = "Y" ] || [ "${RESULT}" = "y" ]; then echo Adding \'=${PKG}-${VERSION}*\ ~${ARCH}\' to package\.keywords echo =${PKG}-${VERSION}*\ ~${ARCH} >> /etc/portage/package.keywords fi echo done exit 0