2019-12-31 14:28:42 -01:00
|
|
|
#!/bin/bash
|
2021-04-26 21:48:30 +00:00
|
|
|
set -uo pipefail
|
|
|
|
|
2019-12-31 14:28:42 -01:00
|
|
|
|
2020-04-23 15:05:44 +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
|
|
|
|
|
2021-04-19 18:33:47 +00:00
|
|
|
# Export variables (used to determine processor count by some applications)
|
2020-01-02 21:28:16 -01:00
|
|
|
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"
|
|
|
|
|
2021-05-02 13:29:21 +00:00
|
|
|
# Unset critical variables
|
|
|
|
unset key
|
|
|
|
|
2020-01-02 21:28:16 -01:00
|
|
|
# Execute the requested command
|
2019-12-31 14:28:42 -01:00
|
|
|
exec "$@"
|