Created
September 18, 2024 18:58
-
-
Save artman41/08b5d3ccd3fad54743595ee112c9f9ba to your computer and use it in GitHub Desktop.
Installs an erlang ubuntu installation without clashing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ARCH=$(dpkg --print-architecture); | |
| PACKAGES_URL="https://packages.erlang-solutions.com/ubuntu/pool/"; | |
| function usage() { | |
| { | |
| echo "Usage:"; | |
| echo "- $0 list"; | |
| echo "- $0 install \$otp_version"; | |
| } >&2; | |
| } | |
| function validate_var() { | |
| if [[ -n "$1" ]]; then | |
| return; | |
| fi; | |
| test -n "$2" && echo "$2" >&2; | |
| if [[ -z "$NO_USAGE" ]]; then | |
| usage; | |
| fi; | |
| exit 1; | |
| } | |
| function grab_versions() { | |
| local package; | |
| local version; | |
| local release; | |
| local versions; declare -A versions; | |
| local releases=( | |
| [lucid]=10 | |
| [maverick]=10 | |
| [natty]=11 | |
| [oneiric]=11 | |
| [precise]=12 | |
| [quantal]=12 | |
| [raring]=13 | |
| [saucy]=13 | |
| [trusty]=14 | |
| [utopic]=14 | |
| [vivid]=15 | |
| [wily]=15 | |
| [xenial]=16 | |
| [yakkety]=16 | |
| [zesty]=17 | |
| [artful]=17 | |
| [bionic]=18 | |
| [cosmic]=18 | |
| [disco]=19 | |
| [eoan]=19 | |
| [focal]=20 | |
| [groovy]=20 | |
| [hirsute]=21 | |
| [impish]=21 | |
| [jammy]=22 | |
| [kinetic]=22 | |
| [lunar]=23 | |
| [mantic]=23 | |
| [noble]=24 | |
| ) | |
| function process_package() { | |
| # esl-erlang_14.b.2-1~debian~wheezy_amd64.deb | |
| sed 's|esl-erlang_\(.*\)-.*~.*~\(.*\)_.*|\1 \2|g;s|esl-erlang_\(.*\)~.*~\(.*\)_.*|\1 \2|g'; | |
| } | |
| while read -r package; do | |
| # esl-erlang_15.b.1~debian~squeeze_amd64.deb | |
| read -r version release< <(echo "$package" | process_package); | |
| NO_USAGE=1 validate_var "$version" "Failed to read package name '$package'."; | |
| NO_USAGE=1 validate_var "$release" "Failed to read package name '$package'."; | |
| local existing="${versions[$version]}"; | |
| if [[ -z "$existing" ]]; then | |
| versions[$version]="$package"; | |
| else | |
| local existing_release="$(echo $existing | process_package | read -r version release | echo $release)"; | |
| if [[ ${releases[$existing_release]} -lt ${releases[$release]} ]]; then | |
| versions[$version]="$package"; | |
| fi; | |
| fi; | |
| done< <(curl -s "$PACKAGES_URL" | grep 'esl-erlang_' | grep 'ubuntu' | grep "$ARCH" | sed 's|.*href="\(.*\)">.*|\1|g') | |
| for key in "${!versions[@]}"; do | |
| echo "[\"$key\]=\"${versions[$key]}\"" | |
| done; | |
| } | |
| declare -A VERSIONS; | |
| VERSIONS=( | |
| [14.b.2]="esl-erlang_14.b.2-1~ubuntu~precise_amd64.deb" | |
| [14.b.4]="esl-erlang_14.b.4-1~ubuntu~precise_amd64.deb" | |
| [15.b]="esl-erlang_15.b-1~ubuntu~natty_amd64.deb" | |
| [15.b.1]="esl-erlang_15.b.1~ubuntu~lucid_amd64.deb" | |
| [15.b.2]="esl-erlang_15.b.2~ubuntu~lucid_amd64.deb" | |
| [15.b.3]="esl-erlang_15.b.3-1~ubuntu~oneiric_amd64.deb" | |
| [16.a]="esl-erlang_16.a~ubuntu~lucid_amd64.deb" | |
| [16.b]="esl-erlang_16.b~ubuntu~lucid_amd64.deb" | |
| [16.b.1]="esl-erlang_16.b.1~ubuntu~precise_amd64.deb" | |
| [16.b.2]="esl-erlang_16.b.2-1~ubuntu~precise_amd64.deb" | |
| [16.b.2.basho10]="esl-erlang_16.b.2.basho10-1~ubuntu~artful_amd64.deb" | |
| [16.b.3]="esl-erlang_16.b.3-1~ubuntu~precise_amd64.deb" | |
| [17.0]="esl-erlang_17.0-1~ubuntu~precise_amd64.deb" | |
| [17.1]="esl-erlang_17.1-1~ubuntu~precise_amd64.deb" | |
| [17.3]="esl-erlang_17.3-2~ubuntu~precise_amd64.deb" | |
| [17.3.2]="esl-erlang_17.3.2-1~ubuntu~precise_amd64.deb" | |
| [17.4]="esl-erlang_17.4-2~ubuntu~precise_amd64.deb" | |
| [17.5]="esl-erlang_17.5-1~ubuntu~precise_amd64.deb" | |
| [17.5.3]="esl-erlang_17.5.3-1~ubuntu~precise_amd64.deb" | |
| [18.0]="esl-erlang_18.0-1~ubuntu~precise_amd64.deb" | |
| [18.1]="esl-erlang_18.1-1~ubuntu~precise_amd64.deb" | |
| [18.2]="esl-erlang_18.2-1~ubuntu~precise_amd64.deb" | |
| [18.3]="esl-erlang_18.3-1~ubuntu~precise_amd64.deb" | |
| [18.3.4]="esl-erlang_18.3.4-1~ubuntu~precise_amd64.deb" | |
| [18.3.4.11]="esl-erlang_18.3.4.11-1~ubuntu~bionic_amd64.deb" | |
| [18.3.4.5]="esl-erlang_18.3.4.5-1~ubuntu~yakkety_amd64.deb" | |
| [19.0]="esl-erlang_19.0-1~ubuntu~precise_amd64.deb" | |
| [19.0.7]="esl-erlang_19.0.7-1~ubuntu~precise_amd64.deb" | |
| [19.1.5]="esl-erlang_19.1.5-1~ubuntu~precise_amd64.deb" | |
| [19.2]="esl-erlang_19.2-1~ubuntu~precise_amd64.deb" | |
| [19.2.3]="esl-erlang_19.2.3-1~ubuntu~precise_amd64.deb" | |
| [19.3]="esl-erlang_19.3-1~ubuntu~precise_amd64.deb" | |
| [19.3.6]="esl-erlang_19.3.6-1~ubuntu~artful_amd64.deb" | |
| [19.3.6.12]="esl-erlang_19.3.6.12-1~ubuntu~bionic_amd64.deb" | |
| [19.3.6.13]="esl-erlang_19.3.6.13-1~ubuntu~bionic_amd64.deb" | |
| [19.3.6.8]="esl-erlang_19.3.6.8-1~ubuntu~bionic_amd64.deb" | |
| [20.0]="esl-erlang_20.0-1~ubuntu~trusty_amd64.deb" | |
| [20.1]="esl-erlang_20.1-1~ubuntu~artful_amd64.deb" | |
| [20.1.7]="esl-erlang_20.1.7-1~ubuntu~artful_amd64.deb" | |
| [20.2.0.1]="esl-erlang_20.2.0.1-1~ubuntu~bionic_amd64.deb" | |
| [20.2.2]="esl-erlang_20.2.2-1~ubuntu~artful_amd64.deb" | |
| [20.3]="esl-erlang_20.3-1~ubuntu~artful_amd64.deb" | |
| [20.3.2.1]="esl-erlang_20.3.2.1-1~ubuntu~bionic_amd64.deb" | |
| [20.3.6]="esl-erlang_20.3.6-1~ubuntu~artful_amd64.deb" | |
| [20.3.8.14]="esl-erlang_20.3.8.14-1~ubuntu~artful_amd64.deb" | |
| [20.3.8.15]="esl-erlang_20.3.8.15-1~ubuntu~bionic_amd64.deb" | |
| [20.3.8.16]="esl-erlang_20.3.8.16-1~ubuntu~bionic_amd64.deb" | |
| [20.3.8.17]="esl-erlang_20.3.8.17-1~ubuntu~bionic_amd64.deb" | |
| [20.3.8.18]="esl-erlang_20.3.8.18-1~ubuntu~bionic_amd64.deb" | |
| [20.3.8.19]="esl-erlang_20.3.8.19-1~ubuntu~bionic_amd64.deb" | |
| [20.3.8.20]="esl-erlang_20.3.8.20-1~ubuntu~bionic_amd64.deb" | |
| [20.3.8.21]="esl-erlang_20.3.8.21-1~ubuntu~bionic_amd64.deb" | |
| [20.3.8.22]="esl-erlang_20.3.8.22-1~ubuntu~bionic_amd64.deb" | |
| [20.3.8.23]="esl-erlang_20.3.8.23-1~ubuntu~bionic_amd64.deb" | |
| [20.3.8.24]="esl-erlang_20.3.8.24-1~ubuntu~bionic_amd64.deb" | |
| [20.3.8.25]="esl-erlang_20.3.8.25-1~ubuntu~bionic_amd64.deb" | |
| [20.3.8.26]="esl-erlang_20.3.8.26-1~ubuntu~bionic_amd64.deb" | |
| [20.3.8.6]="esl-erlang_20.3.8.6-1~ubuntu~artful_amd64.deb" | |
| [21.0]="esl-erlang_21.0-1~ubuntu~artful_amd64.deb" | |
| [21.0.5]="esl-erlang_21.0.5-1~ubuntu~artful_amd64.deb" | |
| [21.1]="esl-erlang_21.1-1~ubuntu~artful_amd64.deb" | |
| [21.1.1]="esl-erlang_21.1.1-1~ubuntu~bionic_amd64.deb" | |
| [21.1.2]="esl-erlang_21.1.2-1~ubuntu~artful_amd64.deb" | |
| [21.1.3]="esl-erlang_21.1.3-1~ubuntu~bionic_amd64.deb" | |
| [21.1.4]="esl-erlang_21.1.4-1~ubuntu~bionic_amd64.deb" | |
| [21.2]="esl-erlang_21.2-1~ubuntu~bionic_amd64.deb" | |
| [21.2.1]="esl-erlang_21.2.1-1~ubuntu~bionic_amd64.deb" | |
| [21.2.2]="esl-erlang_21.2.2-1~ubuntu~bionic_amd64.deb" | |
| [21.2.3]="esl-erlang_21.2.3-1~ubuntu~bionic_amd64.deb" | |
| [21.2.4]="esl-erlang_21.2.4-1~ubuntu~bionic_amd64.deb" | |
| [21.2.5]="esl-erlang_21.2.5-1~ubuntu~bionic_amd64.deb" | |
| [21.2.6]="esl-erlang_21.2.6-1~ubuntu~bionic_amd64.deb" | |
| [21.2.7]="esl-erlang_21.2.7-1~ubuntu~bionic_amd64.deb" | |
| [21.3]="esl-erlang_21.3-1~ubuntu~bionic_amd64.deb" | |
| [21.3.1]="esl-erlang_21.3.1-1~ubuntu~bionic_amd64.deb" | |
| [21.3.2]="esl-erlang_21.3.2-1~ubuntu~bionic_amd64.deb" | |
| [21.3.3]="esl-erlang_21.3.3-1~ubuntu~bionic_amd64.deb" | |
| [21.3.4]="esl-erlang_21.3.4-1~ubuntu~bionic_amd64.deb" | |
| [21.3.5]="esl-erlang_21.3.5-1~ubuntu~bionic_amd64.deb" | |
| [21.3.6]="esl-erlang_21.3.6-1~ubuntu~bionic_amd64.deb" | |
| [21.3.7]="esl-erlang_21.3.7-1~ubuntu~bionic_amd64.deb" | |
| [21.3.7.1]="esl-erlang_21.3.7.1-1~ubuntu~bionic_amd64.deb" | |
| [21.3.8]="esl-erlang_21.3.8-1~ubuntu~bionic_amd64.deb" | |
| [21.3.8.1]="esl-erlang_21.3.8.1-1~ubuntu~bionic_amd64.deb" | |
| [21.3.8.10]="esl-erlang_21.3.8.10-1~ubuntu~bionic_amd64.deb" | |
| [21.3.8.11]="esl-erlang_21.3.8.11-1~ubuntu~bionic_amd64.deb" | |
| [21.3.8.12]="esl-erlang_21.3.8.12-1~ubuntu~bionic_amd64.deb" | |
| [21.3.8.13]="esl-erlang_21.3.8.13-1~ubuntu~bionic_amd64.deb" | |
| [21.3.8.14]="esl-erlang_21.3.8.14-1~ubuntu~bionic_amd64.deb" | |
| [21.3.8.15]="esl-erlang_21.3.8.15-1~ubuntu~bionic_amd64.deb" | |
| [21.3.8.16]="esl-erlang_21.3.8.16-1~ubuntu~bionic_amd64.deb" | |
| [21.3.8.17]="esl-erlang_21.3.8.17-1~ubuntu~bionic_amd64.deb" | |
| [21.3.8.2]="esl-erlang_21.3.8.2-1~ubuntu~bionic_amd64.deb" | |
| [21.3.8.3]="esl-erlang_21.3.8.3-1~ubuntu~bionic_amd64.deb" | |
| [21.3.8.4]="esl-erlang_21.3.8.4-1~ubuntu~bionic_amd64.deb" | |
| [21.3.8.5]="esl-erlang_21.3.8.5-1~ubuntu~bionic_amd64.deb" | |
| [21.3.8.6]="esl-erlang_21.3.8.6-1~ubuntu~bionic_amd64.deb" | |
| [21.3.8.7]="esl-erlang_21.3.8.7-1~ubuntu~bionic_amd64.deb" | |
| [21.3.8.8]="esl-erlang_21.3.8.8-1~ubuntu~bionic_amd64.deb" | |
| [21.3.8.9]="esl-erlang_21.3.8.9-1~ubuntu~bionic_amd64.deb" | |
| [22.0]="esl-erlang_22.0-1~ubuntu~bionic_amd64.deb" | |
| [22.0.1]="esl-erlang_22.0.1-1~ubuntu~bionic_amd64.deb" | |
| [22.0.2]="esl-erlang_22.0.2-1~ubuntu~bionic_amd64.deb" | |
| [22.0.3]="esl-erlang_22.0.3-1~ubuntu~bionic_amd64.deb" | |
| [22.0.4]="esl-erlang_22.0.4-1~ubuntu~bionic_amd64.deb" | |
| [22.0.5]="esl-erlang_22.0.5-1~ubuntu~bionic_amd64.deb" | |
| [22.0.6]="esl-erlang_22.0.6-1~ubuntu~bionic_amd64.deb" | |
| [22.0.7]="esl-erlang_22.0.7-1~ubuntu~bionic_amd64.deb" | |
| [22.1]="esl-erlang_22.1-1~ubuntu~bionic_amd64.deb" | |
| [22.1.1]="esl-erlang_22.1.1-1~ubuntu~bionic_amd64.deb" | |
| [22.1.2]="esl-erlang_22.1.2-1~ubuntu~bionic_amd64.deb" | |
| [22.1.3]="esl-erlang_22.1.3-1~ubuntu~bionic_amd64.deb" | |
| [22.1.4]="esl-erlang_22.1.4-1~ubuntu~bionic_amd64.deb" | |
| [22.1.5]="esl-erlang_22.1.5-1~ubuntu~bionic_amd64.deb" | |
| [22.1.6]="esl-erlang_22.1.6-1~ubuntu~bionic_amd64.deb" | |
| [22.1.7]="esl-erlang_22.1.7-1~ubuntu~bionic_amd64.deb" | |
| [22.1.8]="esl-erlang_22.1.8-1~ubuntu~bionic_amd64.deb" | |
| [22.1.8.1]="esl-erlang_22.1.8.1-1~ubuntu~bionic_amd64.deb" | |
| [22.2]="esl-erlang_22.2-1~ubuntu~bionic_amd64.deb" | |
| [22.2.1]="esl-erlang_22.2.1-1~ubuntu~bionic_amd64.deb" | |
| [22.2.2]="esl-erlang_22.2.2-1~ubuntu~bionic_amd64.deb" | |
| [22.2.3]="esl-erlang_22.2.3-1~ubuntu~bionic_amd64.deb" | |
| [22.2.4]="esl-erlang_22.2.4-1~ubuntu~bionic_amd64.deb" | |
| [22.2.5]="esl-erlang_22.2.5-1~ubuntu~bionic_amd64.deb" | |
| [22.2.6]="esl-erlang_22.2.6-1~ubuntu~bionic_amd64.deb" | |
| [22.2.7]="esl-erlang_22.2.7-1~ubuntu~bionic_amd64.deb" | |
| [22.2.8]="esl-erlang_22.2.8-1~ubuntu~bionic_amd64.deb" | |
| [22.3]="esl-erlang_22.3-1~ubuntu~bionic_amd64.deb" | |
| [22.3.1]="esl-erlang_22.3.1-1~ubuntu~bionic_amd64.deb" | |
| [22.3.2]="esl-erlang_22.3.2-1~ubuntu~bionic_amd64.deb" | |
| [22.3.3]="esl-erlang_22.3.3-1~ubuntu~bionic_amd64.deb" | |
| [22.3.4]="esl-erlang_22.3.4-1~ubuntu~bionic_amd64.deb" | |
| [22.3.4.1]="esl-erlang_22.3.4.1-1~ubuntu~bionic_amd64.deb" | |
| [22.3.4.2]="esl-erlang_22.3.4.2-1~ubuntu~bionic_amd64.deb" | |
| [22.3.4.3]="esl-erlang_22.3.4.3-1~ubuntu~bionic_amd64.deb" | |
| [22.3.4.4]="esl-erlang_22.3.4.4-1~ubuntu~bionic_amd64.deb" | |
| [22.3.4.5]="esl-erlang_22.3.4.5-1~ubuntu~bionic_amd64.deb" | |
| [22.3.4.6]="esl-erlang_22.3.4.6-1~ubuntu~bionic_amd64.deb" | |
| [22.3.4.7]="esl-erlang_22.3.4.7-1~ubuntu~bionic_amd64.deb" | |
| [22.3.4.8]="esl-erlang_22.3.4.8-1~ubuntu~bionic_amd64.deb" | |
| [22.3.4.9]="esl-erlang_22.3.4.9-1~ubuntu~bionic_amd64.deb" | |
| [23.0]="esl-erlang_23.0-1~ubuntu~bionic_amd64.deb" | |
| [23.0.1]="esl-erlang_23.0.1-1~ubuntu~bionic_amd64.deb" | |
| [23.0.2]="esl-erlang_23.0.2-1~ubuntu~bionic_amd64.deb" | |
| [23.0.3]="esl-erlang_23.0.3-1~ubuntu~bionic_amd64.deb" | |
| [23.1]="esl-erlang_23.1-1~ubuntu~bionic_amd64.deb" | |
| [23.1.2]="esl-erlang_23.1.2-1~ubuntu~bionic_amd64.deb" | |
| [23.1.5]="esl-erlang_23.1.5-1~ubuntu~bionic_amd64.deb" | |
| [23.2]="esl-erlang_23.2-1~ubuntu~bionic_amd64.deb" | |
| [23.2.1]="esl-erlang_23.2.1-1~ubuntu~bionic_amd64.deb" | |
| [23.2.3]="esl-erlang_23.2.3-1~ubuntu~bionic_amd64.deb" | |
| [23.2.7.4]="esl-erlang_23.2.7.4-1~ubuntu~bionic_amd64.deb" | |
| [23.3.1]="esl-erlang_23.3.1-1~ubuntu~bionic_amd64.deb" | |
| [23.3.4.5]="esl-erlang_23.3.4.5-1~ubuntu~bionic_amd64.deb" | |
| [24.0]="esl-erlang_24.0-1~ubuntu~bionic_amd64.deb" | |
| [24.0.1]="esl-erlang_24.0.1-1~ubuntu~bionic_amd64.deb" | |
| [24.0.2]="esl-erlang_24.0.2-1~ubuntu~bionic_amd64.deb" | |
| [24.0.4]="esl-erlang_24.0.4-1~ubuntu~bionic_amd64.deb" | |
| [24.0.5]="esl-erlang_24.0.5-1~ubuntu~bionic_amd64.deb" | |
| [24.0.6]="esl-erlang_24.0.6-1~ubuntu~bionic_amd64.deb" | |
| [24.1]="esl-erlang_24.1-1~ubuntu~bionic_amd64.deb" | |
| [24.1.1]="esl-erlang_24.1.1-1~ubuntu~bionic_amd64.deb" | |
| [24.1.2]="esl-erlang_24.1.2-1~ubuntu~bionic_amd64.deb" | |
| [24.1.3]="esl-erlang_24.1.3-1~ubuntu~bionic_amd64.deb" | |
| [24.1.4]="esl-erlang_24.1.4-1~ubuntu~bionic_amd64.deb" | |
| [24.1.5]="esl-erlang_24.1.5-1~ubuntu~bionic_amd64.deb" | |
| [24.1.6]="esl-erlang_24.1.6-1~ubuntu~bionic_amd64.deb" | |
| [24.1.7]="esl-erlang_24.1.7-1~ubuntu~bionic_amd64.deb" | |
| [24.2]="esl-erlang_24.2-1~ubuntu~bionic_amd64.deb" | |
| [24.2.1]="esl-erlang_24.2.1-1~ubuntu~bionic_amd64.deb" | |
| [24.2.2]="esl-erlang_24.2.2-1~ubuntu~bionic_amd64.deb" | |
| [24.3]="esl-erlang_24.3-1~ubuntu~bionic_amd64.deb" | |
| [24.3.1]="esl-erlang_24.3.1-1~ubuntu~bionic_amd64.deb" | |
| [24.3.2]="esl-erlang_24.3.2-1~ubuntu~bionic_amd64.deb" | |
| [24.3.3]="esl-erlang_24.3.3-1~ubuntu~bionic_amd64.deb" | |
| [25.0]="esl-erlang_25.0-1~ubuntu~bionic_amd64.deb" | |
| [25.0.1]="esl-erlang_25.0.1-1~ubuntu~bionic_amd64.deb" | |
| [25.0.2]="esl-erlang_25.0.2-1~ubuntu~bionic_amd64.deb" | |
| [25.0.3]="esl-erlang_25.0.3-1~ubuntu~bionic_amd64.deb" | |
| [25.0.4]="esl-erlang_25.0.4-1~ubuntu~bionic_amd64.deb" | |
| [25.2.3]="esl-erlang_25.2.3-1~ubuntu~bionic_amd64.deb" | |
| [25.3]="esl-erlang_25.3-1~ubuntu~bionic_amd64.deb" | |
| ) | |
| function list_versions() { | |
| for key in "${!VERSIONS[@]}"; do | |
| echo "* $key" | |
| done | sort; | |
| } | |
| function install() { | |
| if ! mkdir -p /usr/local/erlang/; then | |
| echo "Can't create /usr/local/erlang! Maybe try running as root?" >&2; | |
| exit 1; | |
| fi; | |
| local otp_ver="$1"; | |
| validate_var "$otp_ver" "No OTP version provided!"; | |
| if [[ -d /usr/local/erlang/${otp_ver}/ ]]; then | |
| echo "Erlang installation already exists at /usr/local/erlang/${otp_ver}" >&2; | |
| exit 0; | |
| fi; | |
| local package="${VERSIONS[$otp_ver]}"; | |
| validate_var "$package" "No package found for version '$otp_ver'" | |
| rm -f /tmp/erlang_${otp_ver}.deb; | |
| if ! curl -s "$PACKAGES_URL/$package" -o /tmp/erlang_${otp_ver}.deb; then | |
| echo "Failed to download $PACKAGES_URL/$package!"; | |
| exit 1; | |
| fi; | |
| rm -rf /tmp/erlang_${otp_ver}; | |
| mkdir /tmp/erlang_${otp_ver}; | |
| ar x /tmp/erlang_${otp_ver}.deb --output /tmp/erlang_${otp_ver}/; | |
| local flags="-xJf"; | |
| if [[ -f /tmp/erlang_${otp_ver}/data.tar.gz ]]; then | |
| flags="-xzf"; | |
| fi; | |
| tar $flags /tmp/erlang_${otp_ver}/data.tar.*z -C /tmp/erlang_${otp_ver}/; | |
| if ! mv /tmp/erlang_${otp_ver}/usr/lib/erlang /usr/local/erlang/${otp_ver}; then | |
| echo "Can't move erlang installation to /usr/local/erlang/! Maybe try running as root?" >&2; | |
| exit 1; | |
| fi; | |
| local depends=$(tar $flags /tmp/erlang_${otp_ver}/control.tar.*z -O | grep Depends | cut -d':' -f2); | |
| echo "It is recommended that you install: $depends" >&2; | |
| if ! /usr/local/erlang/${otp_ver}/Install -minimal /usr/local/erlang/${otp_ver}; then | |
| echo "Failed to run erlang install! Maybe try running as root?" >&2; | |
| exit 1; | |
| fi; | |
| rm -f /tmp/erlang_${otp_ver}.deb; | |
| rm -rf /tmp/erlang_${otp_ver}; | |
| } | |
| function main() { | |
| local action="$1"; | |
| validate_var "$action" "No action specified!"; | |
| case $action in | |
| list) | |
| list_versions; | |
| ;; | |
| install) | |
| install "$2"; | |
| ;; | |
| *) | |
| usage; | |
| ;; | |
| esac | |
| } | |
| main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment