#!/bin/sh
# This script tries twice to emerge all necessary packages for e17
# and lets you know which packages failed.
_EBUILDS="eet dev-db/edb evas ecore embryo imlib2 edje e etk epeg \
media-libs/epsilon esmart entrance emotion ewl engrave examine \
entropy e_utils e_modules entice exhibit"
. /sbin/functions.sh
_FAIL_FLAG="0"
_FAIL_LIST=""
function mount_tmpfs(){
mount -t tmpfs tmpfs /var/tmp/portage -o size=${1}M && einfo "mounting ramdisk of size ${1}MB on /var/tmp/portage";
if [[ -z $( mount | grep /var/tmp/portage ) ]]; then einfo "mounting of tmpfs failed... continuing with ordinary emerge"; fi
}
function umount_tmpfs(){
if [[ ! -z $( mount | grep /var/tmp/portage ) ]];
then umount /var/tmp/portage && einfo "unmounting tmpfs"
fi
}
function compile(){
emerge ${1} && einfo "${1} successfully emerged" && _FAIL_FLAG="1";
}
#mount tmpfs on /var/tmp/portage ##the value passed to mount_tmpfs is the size of the tmpfs
mount_tmpfs 500 ; if you have big RAM, you can uncomment this line. It makes emerge faster.
if [ "$1" == "debug" ]; then
DEBUG="USE=\"$USE debug\" FEATURES=\"$FEATURES nostrip\""
fi
for package in $_EBUILDS;
do _FAIL_FLAG=0
compile $package
if [ "$_FAIL_FLAG" == "0" ];
then einfo "emerge of $package failed... retrying once"
sleep 3;
compile $package
if [ "$_FAIL_FLAG" == "0" ];
then einfo "emerge of $package failed again... bailing out";
_FAIL_LIST="$_FAIL_LIST $package";
fi;
fi
sleep 3;
done
#unmount tmpfs
umount_tmpfs;
echo ""
if [ -z $_FAIL_LIST ];
then einfo "All packages successfully emerged";
else einfo "All but the following packages have been emerged: $_FAIL_LIST";
fi
exit 0;