scripts/apt-fast
2015-11-20 10:03:42 +01:00

29 lines
1.3 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
#apt-fast by Matt Parnell http://www.mattparnell.com , this thing is FOSS
#please feel free to suggest improvments to admin@mattparnell.com
# Use this just like apt-get for faster package downloading. Make sure to have axel installed
#If the first user entered variable string contains apt-get, and the second string entered is either install or dist-upgrade
if echo "$1" | grep -q "[upgrade]" || echo$2| grep -q "[install]" || echo "$2" | grep -q "[full-upgrade]"; then
echo “Working…”;
#Go into the directory apt-get normally puts downloaded packages
cd /var/cache/apt/archives/;
#Have apt-get print the information, including the URIs to the packages
apt-get -y --print-uris $1 $2 $3 $4 > debs.list;
#Strip out the URIs, and download the packages with Axel for speediness
egrep -o -e "(ht|f)tp://[^\']+" debs.list | xargs -l1 axel -a;
#Perform the users reqested action via aptitude
aptitude -y $1 $2 $3 $4;
echo "Done! Make sure and check to see that the packages all were installed properly. If a package is erred, run sudo apt-get autoclean and try installing it again without the use of this <script>.";
elif echo "$1" | grep -q "[*]"; then
aptitude $1;
else
echo "Sorry, but you appear to be entering invalid options. You must use apt-get and one of apt-gets options in order to use this <script>.";
fi