profile: rework profile.bashrc

some minor housekeeping
add in kernel module signing because that's how portage handles it :-(
This commit is contained in:
Rick Farina (Zero_Chaos) 2020-05-14 17:22:24 -04:00
parent 547d71627b
commit 3b645d30a9
No known key found for this signature in database
GPG key ID: A29433C0AA431DDC

View file

@ -1,6 +1,4 @@
if [[ $CATEGORY/$PN == sys-boot/os-prober ]] ; then FEATURES=${FEATURES/multilib-strict/} ; fi
if [[ $CATEGORY/$P == x11-drivers/nvidia-drivers-396.24 ]] ; then FEATURES=${FEATURES/multilib-strict/} ; fi
#local CORES="$(grep -c ^proc /proc/cpuinfo)"
local CORES="$(nproc)"
if [[ "${CORES}" -eq "0" ]] ; then CORES="1" ; fi
echo ${MAKEOPTS} | grep -q -e -j || export MAKEOPTS="-j${CORES} -l${CORES}"
@ -10,8 +8,8 @@ echo ${MAKEOPTS} | grep -q -e -j || export MAKEOPTS="-j${CORES} -l${CORES}"
#let's speed up the cracker's default cflags a bit. this bloats the binaries but speeds improve
if [[ $CATEGORY/$PN == net-wireless/aircrack-ng ]]; then
export CFLAGS=${CFLAGS/-Os/-O3}
export CXXFLAGS=${CXXFLAGS/-Os/-O3}
export CFLAGS=${CFLAGS/-Os/-O3}
export CXXFLAGS=${CXXFLAGS/-Os/-O3}
fi
if [[ $CATEGORY/$PN == app-crypt/asleap ]]; then export CFLAGS=${CFLAGS/-Os/-O3}; fi
if [[ $CATEGORY/$PN == app-crypt/hashcat ]]; then export CFLAGS=${CFLAGS/-Os/-O3}; fi
@ -20,4 +18,29 @@ if [[ $CATEGORY/$PN == app-crypt/johntheripper-jumbo ]]; then export CFLAGS=${CF
if [[ $CATEGORY/$PN == net-wireless/cowpatty ]]; then export CFLAGS=${CFLAGS/-Os/-O3}; fi
#bug #676640
if [[ $CATEGORY/$PN == sci-libs/scipy ]]; then export MAKEOPTS="-j1"; fi
if [[ $CATEGORY/$P == sci-libs/scipy-1.1.0 ]]; then export MAKEOPTS="-j1"; fi
#Sign kernel modules, stolen unmodified on 20200514 from:
#https://wiki.gentoo.org/wiki/Signed_kernel_module_support
function pre_pkg_preinst() {
# This hook signs any out-of-tree kernel modules.
if [[ -z "${MODULE_NAMES}" ]]; then
# The package does not seem to install any kernel modules.
return
fi
# Get the signature algorithm used by the kernel.
local module_sig_hash="$(grep -Po '(?<=CONFIG_MODULE_SIG_HASH=").*(?=")' /usr/src/linux/.config)"
# Get the key file used by the kernel.
local module_sig_key="$(grep -Po '(?<=CONFIG_MODULE_SIG_KEY=").*(?=")' /usr/src/linux/.config)"
module_sig_key="${module_sig_key:-certs/signing_key.pem}"
# Path to the key file or PKCS11 URI
if [[ "${module_sig_key#pkcs11:}" == "${module_sig_key}" && "${module_sig_key#/}" == "${module_sig_key}" ]]; then
local key_path="/usr/src/linux/${module_sig_key}"
else
local key_path="${module_sig_key}"
fi
# Certificate path
local cert_path=/usr/src/linux/certs/signing_key.x509
# Sign all installed modules before merging.
find "${D%/}/${INSDESTTREE#/}/" -name "*.ko" -exec /usr/src/linux/scripts/sign-file "${module_sig_hash}" "${key_path}" "${cert_path}" '{}' \;
}