Skip to content

Instantly share code, notes, and snippets.

@ThatLurker
Created December 8, 2017 01:43
Show Gist options
  • Save ThatLurker/517fbd07655a90f29b6823eea8fab321 to your computer and use it in GitHub Desktop.
Save ThatLurker/517fbd07655a90f29b6823eea8fab321 to your computer and use it in GitHub Desktop.
Apt-fast quick-install script without sudo
#!/bin/bash
set -e
apt_fast_installation() {
if ! dpkg-query --show aria2 >/dev/null 2>&1; then
apt-get update
apt-get install -y aria2
fi
wget https://raw.githubusercontent.com/ilikenwf/apt-fast/master/apt-fast -O /usr/local/sbin/apt-fast
chmod +x /usr/local/sbin/apt-fast
if ! [[ -f /etc/apt-fast.conf ]]; then
wget https://raw.githubusercontent.com/ilikenwf/apt-fast/master/apt-fast.conf -O /etc/apt-fast.conf
fi
}
if [[ "$EUID" -eq 0 ]]; then
apt_fast_installation
else
type >/dev/null 2>&1 || { echo "sudo not installed, change into root context" >&2; exit 1; }
DECL="$(declare -f apt_fast_installation)"
bash -c "$DECL; apt_fast_installation"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment