Skip to content
Snippets Groups Projects
Commit 8980d75d authored by Thomas Mortagne's avatar Thomas Mortagne
Browse files

XWIKI-22088: The xwiki-solr9-* packages don't work out of the box with standard Solr 9 install

parent 542c8a69
No related branches found
No related tags found
No related merge requests found
......@@ -43,35 +43,49 @@
<debian.package>xwiki-solr${solr.major.version}-${debian.xwiki.core}</debian.package>
<debian.xwiki.var.solr.base>${debian.xwiki.var}/solr</debian.xwiki.var.solr.base>
<debian.xwiki.var.solr>${debian.xwiki.var.solr.base}/${solr.major.version}</debian.xwiki.var.solr>
<debian.solr.package>xwiki-platform-search-solr-server-core-minimal</debian.solr.package>
<debian.solr.var.solr>/var/solr/data</debian.solr.var.solr>
<debian.solr.core>xwiki_${debian.xwiki.core}_${solr.major.version}</debian.solr.core>
<debian.solr.var>/var/solr</debian.solr.var>
<debian.solr.var.data>${debian.solr.var}/data</debian.solr.var.data>
<debian.solr.var.data.core>${debian.solr.var.data}/${debian.solr.core}</debian.solr.var.data.core>
<debian.solr.var.oldsolr8core>${debian.solr.var.data}/xwiki_${debian.xwiki.core}</debian.solr.var.oldsolr8core>
<debian.xwiki.var.oldsolr8core>${debian.xwiki.var}/solr/${debian.xwiki.core}</debian.xwiki.var.oldsolr8core>
<debian.xwiki.var.oldsolr9corecore>${debian.xwiki.var}/solr/${solr.major.version}/${debian.xwiki.core}</debian.xwiki.var.oldsolr9corecore>
<debian.postinst>
#!/bin/sh
set -e
#set -x
if [ ! -d ${debian.xwiki.var} ]; then
mkdir ${debian.xwiki.var}/
fi
if [ ! -d ${debian.xwiki.var.solr.base} ]; then
mkdir ${debian.xwiki.var.solr.base}/
fi
if [ ! -d ${debian.xwiki.var.solr} ]; then
mkdir ${debian.xwiki.var.solr}/
# By default, Solr 9 is not allowed to access files outside of ${debian.solr.var} (even through links) which unfortunately was the case of the XWiki cores before 16.4.0.
# Move the core files stored at the Solr 8 location (XWiki &lt; 16.2.0)
if [ -d ${debian.xwiki.var.oldsolr8core} ]; then
# Remove the link to the old location
rm -f ${debian.solr.var.oldsolr8core}
# And replace it with the actual core
mv -r ${debian.xwiki.var.oldsolr8core} ${debian.solr.var.oldsolr8core}
fi
# TODO: add some automatic Solr data cleanup depending on the previous version
# Migrate the core files stored at the previous Solr 9 location (XWiki 16.2.0 and 16.3.0)
if [ -d ${debian.xwiki.var.oldsolr9corecore} ]; then
# Move the data
mv -r ${debian.xwiki.var.oldsolr9corecore}/data ${debian.solr.var.data.core}/
# Replace the default schema with the previous one (so that it matches the data)
mv -f ${debian.xwiki.var.oldsolr9corecore}/conf/managed-schema ${debian.solr.var.data.core}/conf/managed-schema
# Delete what remains of the old core location
rm -rf ${debian.xwiki.var.oldsolr9corecore}
fi
# Make the default solr user ("solr") owner of the data folder
# Make the default solr user ("solr") owner of the core files
if id "solr" &gt;/dev/null 2&gt;&amp;1; then
chown -R solr:solr ${debian.xwiki.var.solr}/${debian.xwiki.core}/
chown -R solr:solr ${debian.solr.var.data.core}
else
echo "No user with name 'solr' could be found. Please make the user which runs Solr the owner of the folder ${debian.xwiki.var.solr}/${debian.xwiki.core}/"
echo "No system user with name 'solr' could be found. Please make the user which runs Solr is the owner of the folder ${debian.solr.var.data.core} and its content."
fi
</debian.postinst>
<debian.postrm>
......@@ -81,12 +95,7 @@
#set -x
if [ "$1" = "purge" ]; then
rm -rf ${debian.xwiki.var.solr}/${debian.xwiki.core}
if [ -e /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
db_purge
fi
rm -rf ${debian.solr.var.data.core}
fi
</debian.postrm>
</properties>
......@@ -152,17 +161,10 @@
<type>directory</type>
<mapper>
<type>perm</type>
<prefix>${debian.xwiki.var.solr}/${debian.xwiki.core}</prefix>
<prefix>${debian.solr.var.data.core}</prefix>
</mapper>
<conffile>true</conffile>
</data>
<!-- Register the ratings core in Solr -->
<data>
<type>link</type>
<symlink>true</symlink>
<linkName>${debian.solr.var.solr}/${debian.solr.core}</linkName>
<linkTarget>${debian.xwiki.var.solr}/${debian.xwiki.core}</linkTarget>
</data>
</dataSet>
</configuration>
</plugin>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment