forked from binpash/pash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
distro-deps.sh
executable file
·99 lines (92 loc) · 3.36 KB
/
distro-deps.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/env bash
cd $(dirname $0)
PASH_TOP=${PASH_TOP:-$(git rev-parse --show-toplevel)}
. "$PASH_TOP/scripts/utils.sh"
if [[ $(uname) == 'Darwin' ]]; then
echo 'Currently pash can run only on Linux'
exit 1
fi
read_cmd_args $@
cd $PASH_TOP
# if we aren't running in docker, use sudo to install packages
if ! ( isDockerBuildkit || isDocker || isDockerContainer )
then
export SUDO="sudo"
fi
if type lsb_release >/dev/null 2>&1 ; then
distro=$(lsb_release -i -s)
elif [ -e /etc/os-release ] ; then
distro=$(awk -F= '$1 == "ID" {print $2}' /etc/os-release)
fi
# convert to lowercase
distro=$(printf '%s\n' "$distro" | LC_ALL=C tr '[:upper:]' '[:lower:]')
# compile the list of the shared required packages
pkgs="bc curl git graphviz python3 sudo wget"
# now do different things depending on distro
case "$distro" in
ubuntu*)
pkgs="$pkgs bsdmainutils libffi-dev locales locales-all netcat-openbsd pkg-config python3-pip python3-setuptools python3-testresources wamerican-insane"
if [[ "$show_deps" == 1 ]]; then
echo "$pkgs" | sort
exit 0
fi
echo "Running preparation apt install:"
echo "|-- running apt update..."
$SUDO apt update
echo "|-- running apt install..."
$SUDO apt install -y $pkgs
if [[ "$optimized_agg_flag" == 1 ]]; then
echo "|-- installing g++-10..."
$SUDO apt install software-properties-common -y
$SUDO add-apt-repository ppa:ubuntu-toolchain-r/test -y
$SUDO apt install g++-10 -y
$SUDO update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 100
$SUDO update-alternatives --set g++ /usr/bin/g++-10
fi
;;
debian*)
pkgs="$pkgs bsdmainutils libffi-dev locales locales-all netcat-openbsd pkg-config procps python3-pip python3-setuptools python3-testresources wamerican-insane"
if [[ "$show_deps" == 1 ]]; then
echo "$pkgs" | sort
exit 0
fi
echo "Running preparation apt install:"
echo "|-- running apt update..."
$SUDO apt-get update
echo "|-- running apt install..."
$SUDO apt-get install -y $pkgs
;;
fedora*)
pkgs="$pkgs autoconf diffutils gcc-c++ glibc-langpack-en hostname libjpeg-devel make nc pip procps python-devel python3-pip python3-setuptools python3-setuptools python3-testresources zlib-devel"
if [[ "$show_deps" == 1 ]]; then
echo "$pkgs" | sort
exit 0
fi
echo "|-- running dnf install...."
$SUDO dnf install -y $pkgs
;;
arch*)
pkgs="$pkgs autoconf inetutils libffi make openbsd-netcat pkg-config python-pip"
if [[ "$show_deps" == 1 ]]; then
echo "$pkgs" | sort
exit 0
fi
echo "Updating mirrors"
$SUDO pacman -Sy
echo "|-- running pacman install...."
yes | $SUDO pacman -S $pkgs
;;
freebsd*)
pkgs="$pkgs autoconf gmake gsed libffi py38-pip"
if [[ "$show_deps" == 1 ]]; then
echo "$pkgs" | sort
exit 0
fi
echo "Updating mirrors"
$SUDO pkg update
echo "|-- running pkg install...."
# TODO add python3-testresources dep
yes | $SUDO pkg install $pkgs
;;
*) echo "unknown distro: '$distro'" ; exit 1 ;;
esac