~apt-fast/apt-fast/apt-fast-ro

« back to all changes in this revision

Viewing changes to quick-install.sh

  • Committer: Dominique Lasserre
  • Date: 2017-11-20 19:59:26 UTC
  • Revision ID: git-v1:ca9d8015977e08034f7391ca6b41eec54a92cd7a
quick-install.sh improvements, closes #112

 * Don't run apt-get update/installation if aria is already installed.
 * Allow execution as root (without sudo).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/bash
2
 
sudo apt-get update
3
 
sudo apt-get install -y aria2
4
 
if ! [[ -f /usr/local/sbin/apt-fast ]]; then
5
 
  sudo wget https://raw.githubusercontent.com/ilikenwf/apt-fast/master/apt-fast -O /usr/local/sbin/apt-fast
6
 
  sudo chmod +x /usr/local/sbin/apt-fast
7
 
  sudo wget https://raw.githubusercontent.com/ilikenwf/apt-fast/master/apt-fast.conf -O /etc/apt-fast.conf
 
2
set -e
 
3
 
 
4
apt_fast_installation() {
 
5
  if ! dpkg-query --show aria2 >/dev/null 2>&1; then
 
6
    sudo apt-get update
 
7
    sudo apt-get install -y aria2
 
8
  fi
 
9
 
 
10
  wget https://raw.githubusercontent.com/ilikenwf/apt-fast/master/apt-fast -O /usr/local/sbin/apt-fast
 
11
  chmod +x /usr/local/sbin/apt-fast
 
12
  if ! [[ -f /etc/apt-fast.conf ]]; then
 
13
    wget https://raw.githubusercontent.com/ilikenwf/apt-fast/master/apt-fast.conf -O /etc/apt-fast.conf
 
14
  fi
 
15
}
 
16
 
 
17
 
 
18
if [[ "$EUID" -eq 0 ]]; then
 
19
  apt_fast_installation
 
20
else
 
21
  type sudo >/dev/null 2>&1 || { echo "sudo not installed, change into root context" >&2; exit 1; }
 
22
 
 
23
  DECL="$(declare -f apt_fast_installation)"
 
24
  sudo bash -c "$DECL; apt_fast_installation"
8
25
fi