#!/bin/bash #I combined a few scripts for bastebin purposes. flags="$(/usr/bin/emerge --info 2>/dev/null | /bin/sed -ne '/^USE=/{s/^USE=\"\([^"]\+\)\"$/\1/;p}')" cleanflags=`echo "${flags}" | tr ' ' '\012' | sort | egrep -v "(^mmx$)|(^3dnow$)|(^3dnowext$)|(^sse$)|(^sse2$)" | tr '\012' ' ' ` echo "${cleanflags}" > /cfg/use.list #now ssh use.list somewhere and do the following on the other box cat /proc/cpuinfo | grep flags | grep mmx > /dev/null 2>&1 && mmx="mmx" cat /proc/cpuinfo | grep flags | grep 3dnow > /dev/null 2>&1 && threednow="3dnow 3dnowext" cat /proc/cpuinfo | grep flags | grep sse > /dev/null 2>&1 && sse="sse" cat /proc/cpuinfo | grep flags | grep sse2 > /dev/null 2>&1 && sse2="sse2" flags=`cat /cfg/use.list` fullflags="-* $flags$mmx $threednow $sse $sse2" flags=`echo "$fullflags" |tr ' ' '\012' | sort | tr '\012' ' '` echo "$flags" #echo USE="\"${flags}\"" >> /etc/make.conf #use http://funkmunch.net/~triffid/console-tools/Gentoo-Specific/adduseflags for inserting "$flags" instead of the above method or you will end up with multiple USE vars in make.conf