From f1ee87664482ec816d544d226c1f96072ccc8fb2 Mon Sep 17 00:00:00 2001 From: rain Date: Tue, 16 Aug 2016 19:11:58 +0100 Subject: separate function for determining linux distro --- scripts/install_deps.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/install_deps.sh b/scripts/install_deps.sh index bbf28d95..3884cb12 100755 --- a/scripts/install_deps.sh +++ b/scripts/install_deps.sh @@ -55,6 +55,11 @@ # 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; } +detect_linux_distro() { + DISTRO=$(lsb_release -is) + echo $DISTRO +} + case $(uname -s) in #------------------------------------------------------------------------------ @@ -124,7 +129,7 @@ case $(uname -s) in #------------------------------------------------------------------------------ Linux) - case $(lsb_release -is) in + case $(detect_linux_distro) in #------------------------------------------------------------------------------ # Arch Linux -- cgit v1.2.3 From 14c15e815458b97f0148a443d5ac5de8a7379123 Mon Sep 17 00:00:00 2001 From: rain Date: Tue, 16 Aug 2016 19:31:52 +0100 Subject: fall back to os-release if lsb_release not present --- scripts/install_deps.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/install_deps.sh b/scripts/install_deps.sh index 3884cb12..2ae17737 100755 --- a/scripts/install_deps.sh +++ b/scripts/install_deps.sh @@ -56,7 +56,14 @@ uname -v > /dev/null 2>&1 || { echo >&2 "ERROR - solidity requires 'uname' to identify the platform."; exit 1; } detect_linux_distro() { - DISTRO=$(lsb_release -is) + 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 } -- cgit v1.2.3 From 3577e8feb24c5f54c9901031e87e87f18b162ddf Mon Sep 17 00:00:00 2001 From: rain Date: Tue, 16 Aug 2016 19:44:26 +0100 Subject: correct detection string for Alpine --- scripts/install_deps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_deps.sh b/scripts/install_deps.sh index 2ae17737..7af9475d 100755 --- a/scripts/install_deps.sh +++ b/scripts/install_deps.sh @@ -159,7 +159,7 @@ case $(uname -s) in # Alpine Linux #------------------------------------------------------------------------------ - Alpine) + "Alpine Linux") #Alpine echo "Installing solidity dependencies on Alpine Linux." -- cgit v1.2.3 From b998621cf5f01d721bc5d0dfc71919419531aec1 Mon Sep 17 00:00:00 2001 From: rain Date: Tue, 16 Aug 2016 19:45:24 +0100 Subject: replace bash with sh sh is portable across POSIX systems --- scripts/install_deps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install_deps.sh b/scripts/install_deps.sh index 7af9475d..7458fa8b 100755 --- a/scripts/install_deps.sh +++ b/scripts/install_deps.sh @@ -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. # # This is an "infrastucture-as-code" alternative to the manual build -- cgit v1.2.3 From d9f4b351331bc704898bfa7c9edfe0ec54e1179f Mon Sep 17 00:00:00 2001 From: rain Date: Tue, 16 Aug 2016 19:52:10 +0100 Subject: don't force upgrade on alpine linux install --- scripts/install_deps.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/install_deps.sh b/scripts/install_deps.sh index 7458fa8b..4e75ac62 100755 --- a/scripts/install_deps.sh +++ b/scripts/install_deps.sh @@ -167,7 +167,6 @@ case $(uname -s) in # See https://pkgs.alpinelinux.org/ apk update - apk upgrade apk add boost-dev build-base cmake jsoncpp-dev ;; -- cgit v1.2.3 From b87adc2f4691e4d84e119509e9188f5913eb1ab5 Mon Sep 17 00:00:00 2001 From: rain Date: Tue, 16 Aug 2016 19:54:48 +0100 Subject: update comments --- scripts/install_deps.sh | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/scripts/install_deps.sh b/scripts/install_deps.sh index 4e75ac62..4fb948ed 100755 --- a/scripts/install_deps.sh +++ b/scripts/install_deps.sh @@ -12,17 +12,9 @@ # flow for all supported operating systems: # # - git clone --recursive -# - ./install_deps.sh +# - ./scripts/install_deps.sh # - 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 # native builds. Expanding the functionality here to cover the mobile, # wearable and SBC platforms covered by doublethink and EthEmbedded would @@ -55,6 +47,7 @@ # 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; } +# 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) -- cgit v1.2.3