base_role/overlay/Linux/usr/local/sbin/box_gentoo_emerge.bash

54 lines
1.4 KiB
Bash
Raw Permalink Normal View History

2024-01-06 01:38:28 +00:00
#!/bin/bash
# -*- mode: sh; fill-column: 75; tab-width: 8; coding: utf-8-unix -*-
prog=$( basename $0 .bash )
ROLE=base
2024-01-09 15:39:19 +00:00
PYVER=3
2024-01-06 01:38:28 +00:00
LOG_DIR=/usr/local/var/logs/portage
[ -d $LOG_DIR ] || mkdir -p $LOG_DIR
declare -a ARGS
if [ "$#" -eq 1 ] ; then
ARGS=( "$1" )
LOG=$( basename $1 ).log
elif [ "$#" -eq 0 ] ; then
ARGS="@world"
LOG=world.log
elif false && [ -f world.lib ] ; then # ?
ARGS="$( grep -v '^#' world.lib )"
LOG=world.log
else
ARGS=("$@")
LOG=world.log
fi
if mount | grep -q ' on /mnt/tmp' ; then
export TMPDIR=/mnt/tmp
# else
# echo "WARN: /mnt/tmp not mounted"
fi
# --changed-deps --deep --update
LARGS="-vb --changed-use --with-bdeps=y --changed-deps-report"
LARGS="$LARGS --backtrack=30 --ignore-built-slot-operator-deps=y --keep-going"
# Skips the packages specified on the command-line that have already been installed.
LARGS="$LARGS --noreplace"
# LARGS="$LARGS --exclude "
LOG=$LOG_DIR/$LOG
export PYTHONPATH=
2024-01-09 15:39:19 +00:00
echo INFO: emerge $LARGS $ARGS |tee -a $LOG >&2
nice python$PYVER $( which emerge ) $LARGS $ARGS >> $LOG 2>&1
retval=$?
[ $retval -ne 0 ] && echo ERROR: $retval $LOG && tail $LOG && exit $retval
2024-01-06 01:38:28 +00:00
if grep ImportError $LOG ; then
2024-01-09 15:39:19 +00:00
echo ERROR: ImportError $LOG && exit 10
2024-01-06 01:38:28 +00:00
elif grep ParseError $LOG ; then
2024-01-09 15:39:19 +00:00
echo ERROR: ParseError $LOG && exit 11
2024-01-06 01:38:28 +00:00
elif grep 'Your current profile is invalid' $LOG ; then
2024-01-09 15:39:19 +00:00
echo ERROR: Your current profile is invalid $LOG && exit 12
2024-01-06 01:38:28 +00:00
fi
exit 0