Skip to content

Commit

Permalink
Remove support for EL6 (init scripts)
Browse files Browse the repository at this point in the history
- Presence of init scripts causes a conflict on RHEL9 if installing also the chkconfig package

Fixes quattor#27
  • Loading branch information
jouvin committed Apr 2, 2024
1 parent 9139dc4 commit 4853946
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 101 deletions.
38 changes: 12 additions & 26 deletions pom.xml
Expand Up @@ -69,14 +69,16 @@
<requires>
<require>crontabs</require>
<require>logrotate</require>
<require>chkconfig</require>
</requires>
<preinstallScriptlet>
<script><![CDATA[
if [ "$1" -eq 2 ]; then # upgrade
if [ -x /bin/systemctl -a -h /etc/rc3.d/S30${project.artifactId} ]; then
if [ -x /sbin/chkconfig -a -x /sbin/service -a -h /etc/rc3.d/S30${project.artifactId} ]
then
# Upgrade from the initscript version. The daemon needs to be
# stopped, otherwise, systemd gets confused
# If chkconfig/service are not installed assume that migration
# has already been done
/sbin/service ${project.artifactId} stop > /dev/null 2>&1 || :
/sbin/chkconfig --del ${project.artifactId}
fi
Expand All @@ -86,44 +88,28 @@
<postinstallScriptlet>
<script><![CDATA[
if [ "$1" -eq 1 ]; then # first install
if [ -x /bin/systemctl ]; then
/bin/systemctl preset ${project.artifactId}.service > /dev/null 2>&1 || :
else
/sbin/chkconfig --add ${project.artifactId}
fi
/bin/systemctl preset ${project.artifactId}.service > /dev/null 2>&1 || :
elif [ "$1" -eq 2 ]; then # upgrade
if [ -x /bin/systemctl ]; then
/bin/systemctl daemon-reload > /dev/null 2>&1 || :
/bin/systemctl daemon-reload > /dev/null 2>&1 || :
# Calling 'preset' here is arguably wrong, but not doing it could leave
# the daemon disabled when upgrading from the init script version
/bin/systemctl preset ${project.artifactId}.service > /dev/null 2>&1 || :
# Calling 'preset' here is arguably wrong, but not doing it could leave
# the daemon disabled when upgrading from the init script version
/bin/systemctl preset ${project.artifactId}.service > /dev/null 2>&1 || :
/bin/systemctl restart ${project.artifactId} > /dev/null 2>&1 || :
else
/sbin/chkconfig --add ${project.artifactId}
/sbin/service ${project.artifactId} restart > /dev/null 2>&1 || :
fi
/bin/systemctl restart ${project.artifactId} > /dev/null 2>&1 || :
fi
]]></script>
</postinstallScriptlet>
<preremoveScriptlet>
<script><![CDATA[
if [ "$1" -eq 0 ]; then # Uninstall rather than upgrade
# Do not stop the service as the uninstall may happen from within the service...
if [ -x /bin/systemctl ]; then
/bin/systemctl --no-reload disable ${project.artifactId}.service > /dev/null 2>&1 || :
else
/sbin/chkconfig --del ${project.artifactId}
fi
/bin/systemctl --no-reload disable ${project.artifactId}.service > /dev/null 2>&1 || :
fi
]]></script>
</preremoveScriptlet>
<postremoveScriptlet>
<script><![CDATA[
if [ -x /bin/systemctl ]; then
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
]]></script>
</postremoveScriptlet>
<mappings combine.self="override">
Expand Down
75 changes: 0 additions & 75 deletions src/main/daemon/cdp-listend

This file was deleted.

0 comments on commit 4853946

Please sign in to comment.