Ensure config files are not overwritten in RPM upgrade
In order to ensure that configuration files do not get overwritten when upgrading an RPM, it is not sufficient to mark them as configuration. You have to use the 'noreplace' parameter to make sure, they are never overwritten. Added this parameter for the /etc/elasticsearch directory as well as the /etc/sysconfig/elasticsearch file. In addition, the post remove script now only deletes the user in case of a package removal (and does nothing on package upgrade). Closes #3123
This commit is contained in:
parent
e6a3c9c153
commit
183bb76371
8
pom.xml
8
pom.xml
|
@ -634,11 +634,7 @@
|
|||
<mappings>
|
||||
<mapping>
|
||||
<directory>/etc/elasticsearch/</directory>
|
||||
<configuration>true</configuration>
|
||||
</mapping>
|
||||
<mapping>
|
||||
<directory>/etc/elasticsearch/</directory>
|
||||
<configuration>true</configuration>
|
||||
<configuration>noreplace</configuration>
|
||||
<sources>
|
||||
<source>
|
||||
<location>config/</location>
|
||||
|
@ -650,7 +646,7 @@
|
|||
</mapping>
|
||||
<mapping>
|
||||
<directory>/etc/sysconfig/</directory>
|
||||
<configuration>true</configuration>
|
||||
<configuration>noreplace</configuration>
|
||||
<sources>
|
||||
<source>
|
||||
<location>src/rpm/sysconfig</location>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
echo "Removing elasticsearch user and group if existing"
|
||||
# only execute in case of package removal, not on upgrade
|
||||
if [ $1 -eq 0 ] ; then
|
||||
|
||||
getent passwd elasticsearch > /dev/null
|
||||
if [ "$?" == "0" ] ; then
|
||||
|
@ -9,5 +10,6 @@ getent group elasticsearch >/dev/null
|
|||
if [ "$?" == "0" ] ; then
|
||||
groupdel elasticsearch
|
||||
fi
|
||||
fi
|
||||
|
||||
exit
|
||||
|
|
Loading…
Reference in New Issue