2017-11-16 08:12:46 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-12-06 16:06:59 +00:00
|
|
|
uid=$(id -u $USER)
|
|
|
|
|
|
|
|
if [ ${uid} -lt 100 ]
|
|
|
|
then
|
|
|
|
echo "Usage of system users isn't allowed (${uid})."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ! $(pwd) == /home/* ]]
|
|
|
|
then
|
|
|
|
echo "Only run it from any '/home/*' folder, not '$(pwd)'."
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
USERNAME=$(whoami | sed -e 's/@.*$//')
|
|
|
|
HOME=/home/$USERNAME
|
|
|
|
HOSTNAME=oe
|
2017-11-16 08:12:46 +00:00
|
|
|
|
2017-11-16 12:26:17 +00:00
|
|
|
# Determine parallel build capabilities.
|
|
|
|
parallel_build="$(nproc >&1)"
|
|
|
|
|
|
|
|
if [ ${parallel_build} -gt 20 ]
|
|
|
|
then
|
|
|
|
BB_NUMBER_THREADS=20
|
2017-12-06 16:06:59 +00:00
|
|
|
PARALLEL_MAKE="-j 20"
|
2017-11-16 12:26:17 +00:00
|
|
|
else
|
|
|
|
BB_NUMBER_THREADS=${parallel_build}
|
2017-12-06 16:06:59 +00:00
|
|
|
PARALLEL_MAKE="-j "${parallel_build}
|
2017-11-16 12:26:17 +00:00
|
|
|
fi
|
|
|
|
|
2017-12-06 16:06:59 +00:00
|
|
|
BB_ENV_EXTRAWHITE="BB_NUMBER_THREADS PARALLEL_MAKE BB_NUMBER_PARSE_THREADS"
|
|
|
|
|
2017-11-16 12:26:17 +00:00
|
|
|
export BB_NUMBER_THREADS
|
|
|
|
export PARALLEL_MAKE
|
2017-12-06 16:06:59 +00:00
|
|
|
export BB_ENV_EXTRAWHITE
|
|
|
|
export HOME
|
|
|
|
export HOSTNAME
|
2017-11-16 08:12:46 +00:00
|
|
|
|
2017-12-06 16:06:59 +00:00
|
|
|
exec "$@"
|