Apache Lucene open-source search software
SOLR-10223: Allow running examples as root on Linux with -force option
Jan Høydahlb5aa0da6ff56
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex b1584ee2538..92e8d8d2628 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -115,6 +115,8 @@ Bug Fixes* SOLR-10413: v2 API: parsed JSON type should be coerced to expected type (Cao Manh Dat, Noble Paul)+* SOLR-10223: Allow running examples as root on Linux with -force option (janhoy)+Optimizations----------------------diff --git a/solr/bin/solr b/solr/bin/solrindex 621ac96ec8a..b7bf142de8d 100755--- a/solr/bin/solr+++ b/solr/bin/solr@@ -1469,6 +1469,7 @@ if [ $# -gt 0 ]; then;;-force)FORCE=true+ PASS_TO_RUN_EXAMPLE+=" -force"shift;;--)diff --git a/solr/core/src/java/org/apache/solr/util/SolrCLI.java b/solr/core/src/java/org/apache/solr/util/SolrCLI.javaindex 833e3b4fd20..97fdf1ea44e 100644--- a/solr/core/src/java/org/apache/solr/util/SolrCLI.java+++ b/solr/core/src/java/org/apache/solr/util/SolrCLI.java@@ -2549,6 +2549,10 @@ public class SolrCLI {.withDescription("Path to the Solr server directory.").withLongOpt("serverDir").create('d'),+ OptionBuilder+ .withArgName("FORCE")+ .withDescription("Force option in case Solr is run as root")+ .create("force"),OptionBuilder.withArgName("DIR").hasArg()@@ -2918,6 +2922,7 @@ public class SolrCLI {String zkHostArg = (zkHost != null) ? " -z "+zkHost : "";String memArg = (memory != null) ? " -m "+memory : "";String cloudModeArg = cloudMode ? "-cloud " : "";+ String forceArg = cli.hasOption("force") ? " -force" : "";String addlOpts = cli.getOptionValue('a');String addlOptsArg = (addlOpts != null) ? " -a \""+addlOpts+"\"" : "";@@ -2936,8 +2941,8 @@ public class SolrCLI {solrHome = solrHome.substring(cwdPath.length()+1);String startCmd =- String.format(Locale.ROOT, "%s start %s -p %d -s \"%s\" %s %s %s %s %s",- callScript, cloudModeArg, port, solrHome, hostArg, zkHostArg, memArg, extraArgs, addlOptsArg);+ String.format(Locale.ROOT, "%s start %s -p %d -s \"%s\" %s %s %s %s %s %s",+ callScript, cloudModeArg, port, solrHome, hostArg, zkHostArg, memArg, forceArg, extraArgs, addlOptsArg);startCmd = startCmd.replaceAll("\\s+", " ").trim(); // for pretty printingecho("\nStarting up Solr on port " + port + " using command:");