mirror of https://github.com/apache/lucene.git
SOLR-7826: Refuse "bin/solr create" if run as root, unless -force is specified
This commit is contained in:
parent
b894ab292d
commit
7561461f73
|
@ -152,6 +152,8 @@ Other Changes
|
||||||
* SOLR-9508: Install script install_solr_service.sh now checks existence of tools.
|
* SOLR-9508: Install script install_solr_service.sh now checks existence of tools.
|
||||||
New option -n to avoid starting service after installation (janhoy)
|
New option -n to avoid starting service after installation (janhoy)
|
||||||
|
|
||||||
|
* SOLR-7826: Refuse "bin/solr create" if run as root, unless -force is specified (janhoy, Binoy Dalal)
|
||||||
|
|
||||||
================== 6.2.1 ==================
|
================== 6.2.1 ==================
|
||||||
|
|
||||||
Bug Fixes
|
Bug Fixes
|
||||||
|
|
|
@ -696,6 +696,7 @@ if [[ "$SCRIPT_CMD" == "create" || "$SCRIPT_CMD" == "create_core" || "$SCRIPT_CM
|
||||||
|
|
||||||
CREATE_NUM_SHARDS=1
|
CREATE_NUM_SHARDS=1
|
||||||
CREATE_REPFACT=1
|
CREATE_REPFACT=1
|
||||||
|
FORCE=false
|
||||||
|
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
while true; do
|
while true; do
|
||||||
|
@ -748,6 +749,10 @@ if [[ "$SCRIPT_CMD" == "create" || "$SCRIPT_CMD" == "create_core" || "$SCRIPT_CM
|
||||||
CREATE_PORT="$2"
|
CREATE_PORT="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
-force)
|
||||||
|
FORCE=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
-help|-usage)
|
-help|-usage)
|
||||||
print_usage "$SCRIPT_CMD"
|
print_usage "$SCRIPT_CMD"
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -805,6 +810,11 @@ if [[ "$SCRIPT_CMD" == "create" || "$SCRIPT_CMD" == "create_core" || "$SCRIPT_CM
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "$(whoami)" == "root" ]] && [[ "$FORCE" == "false" ]] ; then
|
||||||
|
echo "WARNING: Creating cores as the root user can cause Solr to fail and is not advisable. Exiting."
|
||||||
|
echo " If you started Solr as root (not advisable either), force core creation by adding argument -force"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
if [ "$SCRIPT_CMD" == "create_core" ]; then
|
if [ "$SCRIPT_CMD" == "create_core" ]; then
|
||||||
run_tool create_core -name "$CREATE_NAME" -solrUrl "$SOLR_URL_SCHEME://$SOLR_TOOL_HOST:$CREATE_PORT/solr" \
|
run_tool create_core -name "$CREATE_NAME" -solrUrl "$SOLR_URL_SCHEME://$SOLR_TOOL_HOST:$CREATE_PORT/solr" \
|
||||||
-confdir "$CREATE_CONFDIR" -configsetsDir "$SOLR_TIP/server/solr/configsets"
|
-confdir "$CREATE_CONFDIR" -configsetsDir "$SOLR_TIP/server/solr/configsets"
|
||||||
|
|
Loading…
Reference in New Issue