Skip to content

Commit

Permalink
Merge pull request quattor#33 from jouvin/remove_el6_support
Browse files Browse the repository at this point in the history
Remove support for EL6 (init scripts)
  • Loading branch information
jrha authored Jul 25, 2024
2 parents 9139dc4 + a096253 commit 2f6f090
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 113 deletions.
48 changes: 12 additions & 36 deletions pom.xml
Original file line number Diff line number Diff line change
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 All @@ -140,16 +126,6 @@
</source>
</sources>
</mapping>
<mapping>
<sources>
<source>
<location>${project.build.directory}/daemon</location>
</source>
</sources>
<directory>/etc/init.d</directory>
<filemode>755</filemode>
<directoryIncluded>false</directoryIncluded>
</mapping>
<mapping>
<sources>
<source>
Expand Down
75 changes: 0 additions & 75 deletions src/main/daemon/cdp-listend

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/resources/systemd/cdp-listend.service
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Before=shutdown.target
Type=simple
ExecStart=/usr/sbin/cdp-listend --nofork
KillMode=process
PIDFile=/var/run/cdp-listend.pid
PIDFile=/run/cdp-listend.pid

[Install]
WantedBy=multi-user.target
2 changes: 1 addition & 1 deletion src/main/scripts/cdp-listend
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ $config->define("help|h!",
"fetch_smear=i",{DEFAULT=>$fetch_smear_def},
"nch_smear=i",{DEFAULT=>$nch_smear_def},
"facility=s", {DEFAULT=>"daemon"},
"pidfile=s", {DEFAULT=>"/var/run/cdp-listend.pid"},
"pidfile=s", {DEFAULT=>"/run/cdp-listend.pid"},
"nofork", {DEFAULT=>0},
"hostname=s", {DEFAULT=>$hostname_def},
);
Expand Down

0 comments on commit 2f6f090

Please sign in to comment.