Code: Select all
#!/bin/bash
function wc_l {
local count
declare -i count=0
while read line; do
count+=1
done
echo $count
}
echo -n "Computing the number of packages in portage... "
declare -i PACKAGES=$(eix --nocolor --compact --pure-packages --only-names | wc_l)
echo "$PACKAGES"
declare -i count=0
function count_f {
printf '\rRegenerating Porage Cache: %5i/%i' $count $PACKAGES
count+=1
}
count_f
emerge --regen | \
while read line; do
[[ "$line" =~ ^Processing\ .*/.* ]] && count_f
done
echoCode: Select all
Computing the number of packages in portage... 14724
Regenerating Porage Cache: 1942/14724If anyone knows a better/faster/alternative way of counting the number of packages in portage + in overlays, I'd very much like to know.

