melawy-archiso-config/airootfs/usr/local/bin/all-cores

28 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
#set -e
##################################################################################################################
# Author : Valeria Fadeeva
# Website : https://valeria.fadeeva.me
# Website : https://fadeeva.me
# Website : https://melawy.ru
##################################################################################################################
#
# DO NOT JUST RUN THIS. EXAMINE AND JUDGE. RUN AT YOUR OWN RISK.
#
##################################################################################################################
numberofcores=$(grep -c ^processor /proc/cpuinfo)
if [ $numberofcores -gt 1 ]
then
echo "You have " $numberofcores" cores."
echo "Changing the makeflags for "$numberofcores" cores."
sudo sed -i 's/#MAKEFLAGS="-j2"/MAKEFLAGS="-j'$(($numberofcores+1))'"/g' /etc/makepkg.conf;
echo "Changing the compression settings for "$numberofcores" cores."
sudo sed -i 's/COMPRESSXZ=(xz -c -z -)/COMPRESSXZ=(xz -c -z - --threads=0)/g' /etc/makepkg.conf
sudo sed -i 's/COMPRESSZST=(zstd -c -z -q -)/COMPRESSZST=(zstd -c -z -q - --threads=0)/g' /etc/makepkg.conf
sudo sed -i "s/PKGEXT='.pkg.tar.xz'/PKGEXT='.pkg.tar.zst'/g" /etc/makepkg.conf
else
echo "No change."
fi