#!/usr/bin/env bash . /etc/portage/make.conf script="$0" function mylog() { logger -t "$script" "${*}" } mylog "testing if other instances are running" if [[ $(pgrep -f -c $(basename $0)) -gt 1 ]] ; then mylog "other instance still running" exit 1 fi mylog "start building packages" for atom in $(emerge -uDN --pretend --quiet world | grep ^'\[ebuild' | sed -e 's/.* \b\([a-z0-9\-]\+\/[\_A-Za-z\.0-9\-]\+\)\b.*/\1/g'); do PACKAGE_FILE="$PKGDIR/$atom.tbz2" if [[ ! -f "$PACKAGE_FILE" ]] then #build one by one. This takes more time, however it builds all possible packages. # echo "building $atom " emerge --quiet --keep-going -B "=${atom}" &> /dev/null if [[ -f "$PACKAGE_FILE" ]] then SUCCESS="$SUCCESS $atom" else FAILURE="$atom $FAILURE" fi fi done if [[ -n "${SUCCESS}" ]] then echo "Successfully build: ${SUCCESS}" mylog "Successfully build: ${SUCCESS}" fi if [[ -n "${FAILURE}" ]] then echo "Build Failures: ${FAILURE}" mylog "Build Failures: ${FAILURE}" fi