Last active
February 20, 2023 20:28
-
-
Save charlieporth1/898875e0a2572e0a88bb7507701cdeb8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
apt_out_file=/etc/apt/sources.list.d/apt-fast.list | |
export CPU_CORE_COUNT=`cat /proc/stat | grep cpu | grep -E 'cpu[0-9]+' | wc -l` | |
export DEBIAN_FRONTEND=noninteractive | |
export OS_ID=$(cat /etc/os-release | grep -E ^ID= | awk -F= '{print $2}' | awk '{print $1=$1}') | |
if [[ $OS_ID = ubuntu ]]; then | |
export VERSION_CODENAME=$(cat /etc/os-release | grep VERSION_CODENAME | awk -F= '{print $2}' | awk '{print $1=$1}') | |
else | |
export VERSION_CODENAME=focal | |
export OS_ID=ubuntu | |
fi | |
echo """ # Generate Date: `date` | |
deb http://ppa.launchpad.net/apt-fast/stable/ubuntu $VERSION_CODENAME main | |
deb-src http://ppa.launchpad.net/apt-fast/stable/ubuntu $VERSION_CODENAME main | |
""" | tee $apt_out_file | |
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B | |
apt-get update | |
DEBIAN_FRONTEND=noninteractive apt-get install -y apt-fast | |
echo debconf apt-fast/maxdownloads string $(( $CPU_CORE_COUNT * 2 )) | debconf-set-selections | |
echo debconf apt-fast/dlflag boolean true | debconf-set-selections | |
echo debconf apt-fast/aptmanager string apt | debconf-set-selections |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment