[
https://issues.apache.org/jira/browse/SOLR-9475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15540811#comment-15540811
]
Jan Høydahl commented on SOLR-9475:
-----------------------------------
bq. Slurping in all of the files like this seems like a very bad idea
Yes, that is bad, and indeed it turns out it is totally unnecessary, since all
the distros have agreed to support {{/etc/os-release}}. That is a nice
structured file, and all we need is the {{NAME=}} line. So I have done one
change to one line and I think we're good:
{code}
- proc_version=`cat /etc/*-release 2>/dev/null`
+ proc_version=$(grep -E "^NAME=" /etc/os-release 2>/dev/null)
{code}
I tested this change across a number of distros by extracting the detection
code into a script distro.sh and then running this command
{code}
for os in ubuntu debian centos opensuse gidikern/rhel-oracle-jre; do echo
"Testing on $os:" && docker run -it -v `pwd`/distro.sh:/tmp/distro.sh $os bash
/tmp/distro.sh ; done
Testing on ubuntu:
Contents of variable 'proc_version' before matching: NAME="Ubuntu"
Contents of variable 'distro' after matching: Ubuntu
Testing on debian:
Contents of variable 'proc_version' before matching: NAME="Debian GNU/Linux"
Contents of variable 'distro' after matching: Debian
Testing on centos:
Contents of variable 'proc_version' before matching: NAME="CentOS Linux"
Contents of variable 'distro' after matching: CentOS
Testing on opensuse:
Contents of variable 'proc_version' before matching: NAME="openSUSE Leap"
Contents of variable 'distro' after matching: SUSE
Testing on gidikern/rhel-oracle-jre:
Contents of variable 'proc_version' before matching: NAME="Red Hat Enterprise
Linux Server"
Contents of variable 'distro' after matching: RedHat
{code}
Regarding {{lsb_release -i}} it finds info from {{/etc/lsb-release}} which, at
least for common docker images, does not exist for the majority of distros. And
the main reason why I'm checking {{/etc/os-release}} before {(/proc/version}}
or {{uname -a}} is that in virtualized envs the latter two tend to print the
docker VM's OS instead of the container's OS. So with the {{etc/os-release}}
approach, we behave nicely in both cases.
So if no objections I'll commit the one-line change outlined above.
> Add install script support for CentOS
> -------------------------------------
>
> Key: SOLR-9475
> URL: https://issues.apache.org/jira/browse/SOLR-9475
> Project: Solr
> Issue Type: Bug
> Security Level: Public(Default Security Level. Issues are Public)
> Affects Versions: 6.2
> Environment: Centos 7
> Reporter: Nitin Surana
> Assignee: Jan Høydahl
> Fix For: 6.3, master (7.0)
>
> Attachments: SOLR-9475.patch, install_solr_service.sh
>
>
> [root@ns521582 tmp]# sudo ./install_solr_service.sh solr-6.2.0.tgz
> id: solr: no such user
> Creating new user: solr
> adduser: group '--disabled-password' does not exist
> Extracting solr-6.2.0.tgz to /opt
> Installing symlink /opt/solr -> /opt/solr-6.2.0 ...
> Installing /etc/init.d/solr script ...
> /etc/default/solr.in.sh already exist. Skipping install ...
> /var/solr/data/solr.xml already exists. Skipping install ...
> /var/solr/log4j.properties already exists. Skipping install ...
> chown: invalid spec: ‘solr:’
> ./install_solr_service.sh: line 322: update-rc.d: command not found
> id: solr: no such user
> User solr not found! Please create the solr user before running this script.
> id: solr: no such user
> User solr not found! Please create the solr user before running this script.
> Service solr installed.
> Reference -
> http://stackoverflow.com/questions/39320647/unable-to-create-user-when-installing-solr-6-2-0-on-centos-7
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]