Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- set -eu
- ARCHDIR=/var/cache/apt/archives
- ARCHLIST=${ARCHDIR}/apt-fast_$$.list
- # Test if aria2 is installed
- if [ ! -x /usr/bin/aria2c ]; then
- echo "aria2 is not installed, perform installation? (y/n)"
- read ops
- case ${ops,,} in
- y) if apt-get install aria2 -y; then
- echo "aria2 installed"
- else
- echo "Unable to install the aria2. Are you sudo?"
- exit
- fi ;;
- n)
- echo "Aborting script"
- exit 1
- ;;
- esac
- fi
- # If the user entered arguments contain upgrade, install, or dist-upgrade
- if echo "$@" | grep -Eqw "(dist-)?upgrade|(re)?install"; then
- echo "Working..."
- # Have apt-get print the information, including the URI's to the packages
- apt-get -y --print-uris $@ |
- grep -Po "(ht|f)tps?://[^\']+" >${ARCHLIST} &&
- aria2c -c -i ${ARCHLIST} -d ${ARCHDIR} ||
- echo "No files to download"
- fi
- # Perform the user's requested action via apt-get
- apt-get $@
- echo -e "\nDone! Verify that all packages were installed successfully. If errors are found, run apt-get clean as root and try again using apt-get directly.\n"
- # Clean up
- apt clean
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement