Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save george-aidonidis/3c1d28b1f18331422a10b5751595738d to your computer and use it in GitHub Desktop.
Save george-aidonidis/3c1d28b1f18331422a10b5751595738d to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
##################################################################################################################
# Author : Erik Dubois
# Website : https://www.erikdubois.be
# Website : https://www.arcolinux.info
# Website : https://www.arcolinux.com
# Website : https://www.arcolinuxd.com
# Website : https://www.arcolinuxb.com
# Website : https://www.arcolinuxiso.com
# Website : https://www.arcolinuxforum.com
##################################################################################################################
#
# DO NOT JUST RUN THIS. EXAMINE AND JUDGE. RUN AT YOUR OWN RISK.
#
##################################################################################################################
numberofcores=$(grep -c ^processor /proc/cpuinfo)
case $numberofcores in
16)
echo "You have " $numberofcores" cores."
echo "Changing the makeflags for "$numberofcores" cores."
sudo sed -i 's/#MAKEFLAGS="-j2"/MAKEFLAGS="-j17"/g' /etc/makepkg.conf
echo "Changing the compression settings for "$numberofcores" cores."
sudo sed -i 's/COMPRESSXZ=(xz -c -z -)/COMPRESSXZ=(xz -c -T 16 -z -)/g' /etc/makepkg.conf
;;
8)
echo "You have " $numberofcores" cores."
echo "Changing the makeflags for "$numberofcores" cores."
sudo sed -i 's/#MAKEFLAGS="-j2"/MAKEFLAGS="-j9"/g' /etc/makepkg.conf
echo "Changing the compression settings for "$numberofcores" cores."
sudo sed -i 's/COMPRESSXZ=(xz -c -z -)/COMPRESSXZ=(xz -c -T 8 -z -)/g' /etc/makepkg.conf
;;
6)
echo "You have " $numberofcores" cores."
echo "Changing the makeflags for "$numberofcores" cores."
sudo sed -i 's/#MAKEFLAGS="-j2"/MAKEFLAGS="-j7"/g' /etc/makepkg.conf
echo "Changing the compression settings for "$numberofcores" cores."
sudo sed -i 's/COMPRESSXZ=(xz -c -z -)/COMPRESSXZ=(xz -c -T 6 -z -)/g' /etc/makepkg.conf
;;
4)
echo "You have " $numberofcores" cores."
echo "Changing the makeflags for "$numberofcores" cores."
sudo sed -i 's/#MAKEFLAGS="-j2"/MAKEFLAGS="-j5"/g' /etc/makepkg.conf
echo "Changing the compression settings for "$numberofcores" cores."
sudo sed -i 's/COMPRESSXZ=(xz -c -z -)/COMPRESSXZ=(xz -c -T 4 -z -)/g' /etc/makepkg.conf
;;
2)
echo "You have " $numberofcores" cores."
echo "Changing the makeflags for "$numberofcores" cores."
sudo sed -i 's/#MAKEFLAGS="-j2"/MAKEFLAGS="-j3"/g' /etc/makepkg.conf
echo "Changing the compression settings for "$numberofcores" cores."
sudo sed -i 's/COMPRESSXZ=(xz -c -z -)/COMPRESSXZ=(xz -c -T 2 -z -)/g' /etc/makepkg.conf
;;
*)
echo "We do not know how many cores you have."
echo "Do it manually."
;;
esac
echo "################################################################"
echo "### All cores will be used during building and compression ####"
echo "################################################################"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment