mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #914 from rainbeam/linux-distro-detection
Stronger Linux distro detection
This commit is contained in:
commit
ad47a06a76
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Bash script for installing pre-requisite packages for solidity on a
|
# Shell script for installing pre-requisite packages for solidity on a
|
||||||
# variety of Linux and other UNIX-derived platforms.
|
# variety of Linux and other UNIX-derived platforms.
|
||||||
#
|
#
|
||||||
# This is an "infrastucture-as-code" alternative to the manual build
|
# This is an "infrastucture-as-code" alternative to the manual build
|
||||||
@ -12,17 +12,9 @@
|
|||||||
# flow for all supported operating systems:
|
# flow for all supported operating systems:
|
||||||
#
|
#
|
||||||
# - git clone --recursive
|
# - git clone --recursive
|
||||||
# - ./install_deps.sh
|
# - ./scripts/install_deps.sh
|
||||||
# - cmake && make
|
# - cmake && make
|
||||||
#
|
#
|
||||||
# At the time of writing we are assuming that 'lsb_release' is present for all
|
|
||||||
# Linux distros, which is not a valid assumption. We will need a variety of
|
|
||||||
# approaches to actually get this working across all the distros which people
|
|
||||||
# are using.
|
|
||||||
#
|
|
||||||
# See http://unix.stackexchange.com/questions/92199/how-can-i-reliably-get-the-operating-systems-name
|
|
||||||
# for some more background on this common problem.
|
|
||||||
#
|
|
||||||
# TODO - There is no support here yet for cross-builds in any form, only
|
# TODO - There is no support here yet for cross-builds in any form, only
|
||||||
# native builds. Expanding the functionality here to cover the mobile,
|
# native builds. Expanding the functionality here to cover the mobile,
|
||||||
# wearable and SBC platforms covered by doublethink and EthEmbedded would
|
# wearable and SBC platforms covered by doublethink and EthEmbedded would
|
||||||
@ -55,6 +47,19 @@
|
|||||||
# Check for 'uname' and abort if it is not available.
|
# Check for 'uname' and abort if it is not available.
|
||||||
uname -v > /dev/null 2>&1 || { echo >&2 "ERROR - solidity requires 'uname' to identify the platform."; exit 1; }
|
uname -v > /dev/null 2>&1 || { echo >&2 "ERROR - solidity requires 'uname' to identify the platform."; exit 1; }
|
||||||
|
|
||||||
|
# See http://unix.stackexchange.com/questions/92199/how-can-i-reliably-get-the-operating-systems-name
|
||||||
|
detect_linux_distro() {
|
||||||
|
if [ $(command -v lsb_release) ]; then
|
||||||
|
DISTRO=$(lsb_release -is)
|
||||||
|
elif [ -f /etc/os-release ]; then
|
||||||
|
# extract 'foo' from NAME=foo, only on the line with NAME=foo
|
||||||
|
DISTRO=$(sed -n -e 's/^NAME="\(.*\)\"/\1/p' /etc/os-release)
|
||||||
|
else
|
||||||
|
DISTRO=''
|
||||||
|
fi
|
||||||
|
echo $DISTRO
|
||||||
|
}
|
||||||
|
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
@ -124,7 +129,7 @@ case $(uname -s) in
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
Linux)
|
Linux)
|
||||||
case $(lsb_release -is) in
|
case $(detect_linux_distro) in
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Arch Linux
|
# Arch Linux
|
||||||
@ -147,7 +152,7 @@ case $(uname -s) in
|
|||||||
# Alpine Linux
|
# Alpine Linux
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
Alpine)
|
"Alpine Linux")
|
||||||
#Alpine
|
#Alpine
|
||||||
echo "Installing solidity dependencies on Alpine Linux."
|
echo "Installing solidity dependencies on Alpine Linux."
|
||||||
|
|
||||||
@ -155,7 +160,6 @@ case $(uname -s) in
|
|||||||
# See https://pkgs.alpinelinux.org/
|
# See https://pkgs.alpinelinux.org/
|
||||||
|
|
||||||
apk update
|
apk update
|
||||||
apk upgrade
|
|
||||||
apk add boost-dev build-base cmake jsoncpp-dev
|
apk add boost-dev build-base cmake jsoncpp-dev
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user