2019-12-31 14:28:42 -01:00
|
|
|
#!/bin/bash
|
2020-04-21 12:33:42 +00:00
|
|
|
set -o pipefail
|
2019-12-31 14:28:42 -01:00
|
|
|
|
2020-04-20 22:40:54 +00:00
|
|
|
[[ ${EXECUTED_IN_CHROOT} != true ]] \
|
2019-12-31 14:28:42 -01:00
|
|
|
&& { echo "This script must not be executed directly!" >&2; exit 1; }
|
|
|
|
|
2020-01-02 21:28:16 -01:00
|
|
|
# Source the systems profile
|
2019-12-31 14:28:42 -01:00
|
|
|
source /etc/profile
|
|
|
|
|
2020-01-02 22:29:17 -01:00
|
|
|
# Set safe umask
|
|
|
|
umask 0077
|
|
|
|
|
2020-01-02 21:28:16 -01:00
|
|
|
# Export nproc variables
|
|
|
|
export NPROC="$(nproc || echo 2)"
|
2020-04-20 22:40:54 +00:00
|
|
|
export NPROC_ONE="$((NPROC + 1))"
|
2019-12-31 14:28:42 -01:00
|
|
|
|
2020-01-02 21:28:16 -01:00
|
|
|
# Set default makeflags and emerge flags for parallel emerges
|
|
|
|
export MAKEFLAGS="-j$NPROC"
|
|
|
|
export EMERGE_DEFAULT_OPTS="--jobs=$NPROC_ONE --load-average=$NPROC"
|
|
|
|
|
|
|
|
# Execute the requested command
|
2019-12-31 14:28:42 -01:00
|
|
|
exec "$@"
|