You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ja...@apache.org on 2016/10/04 08:12:35 UTC
lucene-solr:branch_6x: SOLR-9475: Imrpove distro detection by
grepping /etc/os-release and adding lsb_release -i
Repository: lucene-solr
Updated Branches:
refs/heads/branch_6x 658cd155e -> ba482681f
SOLR-9475: Imrpove distro detection by grepping /etc/os-release and adding lsb_release -i
(cherry picked from commit 2ad0082)
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/ba482681
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/ba482681
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/ba482681
Branch: refs/heads/branch_6x
Commit: ba482681f3d12658b1591cef4a15ab75b4ccf605
Parents: 658cd15
Author: Jan H�ydahl <ja...@apache.org>
Authored: Tue Oct 4 09:22:07 2016 +0200
Committer: Jan H�ydahl <ja...@apache.org>
Committed: Tue Oct 4 09:26:39 2016 +0200
----------------------------------------------------------------------
solr/bin/install_solr_service.sh | 52 ++++++++++++++++++-----------------
1 file changed, 27 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ba482681/solr/bin/install_solr_service.sh
----------------------------------------------------------------------
diff --git a/solr/bin/install_solr_service.sh b/solr/bin/install_solr_service.sh
index 73c0712..6b9df79 100755
--- a/solr/bin/install_solr_service.sh
+++ b/solr/bin/install_solr_service.sh
@@ -59,31 +59,33 @@ print_error() {
exit 1
}
-proc_version=`cat /etc/*-release 2>/dev/null`
-if [[ $? -gt 0 ]]; then
- if [ -f "/proc/version" ]; then
- proc_version=`cat /proc/version`
- else
- proc_version=`uname -a`
- fi
-fi
-
-if [[ $proc_version == *"Debian"* ]]; then
- distro=Debian
-elif [[ $proc_version == *"Red Hat"* ]]; then
- distro=RedHat
-elif [[ $proc_version == *"CentOS"* ]]; then
- distro=CentOS
-elif [[ $proc_version == *"Ubuntu"* ]]; then
- distro=Ubuntu
-elif [[ $proc_version == *"SUSE"* ]]; then
- distro=SUSE
-elif [[ $proc_version == *"Darwin"* ]]; then
- echo "Sorry, this script does not support macOS. You'll need to setup Solr as a service manually using the documentation provided in the Solr Reference Guide."
- echo "You could also try installing via Homebrew (http://brew.sh/), e.g. brew install solr"
- exit 1
-else
- echo -e "\nERROR: Your Linux distribution ($proc_version) not supported by this script!\nYou'll need to setup Solr as a service manually using the documentation provided in the Solr Reference Guide.\n" 1>&2
+# Locate *NIX distribution by looking for match from various detection strategies
+# We start with /etc/os-release, as this will also work for Docker containers
+for command in "grep -E \"^NAME=\" /etc/os-release" \
+ "lsb_release -i" \
+ "cat /proc/version" \
+ "uname -a" ; do
+ distro_string=$(eval $command 2>/dev/null)
+ unset distro
+ if [[ ${distro_string,,} == *"debian"* ]]; then
+ distro=Debian
+ elif [[ ${distro_string,,} == *"red hat"* ]]; then
+ distro=RedHat
+ elif [[ ${distro_string,,} == *"centos"* ]]; then
+ distro=CentOS
+ elif [[ ${distro_string,,} == *"ubuntu"* ]]; then
+ distro=Ubuntu
+ elif [[ ${distro_string,,} == *"suse"* ]]; then
+ distro=SUSE
+ elif [[ ${distro_string,,} == *"darwin"* ]]; then
+ echo "Sorry, this script does not support macOS. You'll need to setup Solr as a service manually using the documentation provided in the Solr Reference Guide."
+ echo "You could also try installing via Homebrew (http://brew.sh/), e.g. brew install solr"
+ exit 1
+ fi
+ if [[ $distro ]] ; then break ; fi
+done
+if [[ ! $distro ]] ; then
+ echo -e "\nERROR: Unable to auto-detect your *NIX distribution!\nYou'll need to setup Solr as a service manually using the documentation provided in the Solr Reference Guide.\n" 1>&2
exit 1
fi