From f618de15436941c91cc1b82a56518a4e338c7b76 Mon Sep 17 00:00:00 2001 From: Filipe Oliveira Date: Tue, 4 Aug 2015 21:33:48 -0300 Subject: [PATCH] Adding support to forked distributions in installer script. Signed-off-by: Filipe Oliveira --- hack/install.sh | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/hack/install.sh b/hack/install.sh index d40404a8c0..748ad321c8 100755 --- a/hack/install.sh +++ b/hack/install.sh @@ -51,6 +51,32 @@ echo_docker_as_nonroot() { EOF } +# Check if this is a forked Linux distro +check_forked() { + # Check for lsb_release command existence, it usually exists in forked distros + if command_exists lsb_release; then + # Check if the `-u` option is supported + lsb_release -a -u > /dev/null 2>&1 + + # Check if the command has exited successfully, it means we're in a forked distro + if [ "$?" = "0" ]; then + # Print info about current distro + cat <<-EOF + You're using '$lsb_dist' version '$dist_version'. + EOF + + # Get the upstream release info + lsb_dist=$(lsb_release -a -u 2>&1 | tr '[:upper:]' '[:lower:]' | grep -E 'id' | cut -d ':' -f 2 | tr -d '[[:space:]]') + dist_version=$(lsb_release -a -u 2>&1 | tr '[:upper:]' '[:lower:]' | grep -E 'codename' | cut -d ':' -f 2 | tr -d '[[:space:]]') + + # Print info about upstream distro + cat <<-EOF + Upstream release is '$lsb_dist' version '$dist_version'. + EOF + fi + fi +} + do_install() { case "$(uname -m)" in *64) @@ -187,8 +213,11 @@ do_install() { esac - + # Check if this is a forked Linux distro + check_forked + + # Run setup for each distro accordingly case "$lsb_dist" in amzn) (