Skip to content

Commit

Permalink
[8.9](backport #36188) dev-tools/packaging/templates/rpm: add warning…
Browse files Browse the repository at this point in the history
… when /etc/rc.d/init.d/functions is missing (#36278)

* dev-tools/packaging/templates/rpm: add warning when /etc/rc.d/init.d/functions is missing (#36188)

On RHEL9, the functions script is no longer present resulting in failure
when init-script based service management commands are used. We still
support at least one distribution that provides init-script based
service management, so we need to retain these scripts, but provide a
warning to users on systems where these will not work pointing to the
new approach.

(cherry picked from commit e797d53)

* remove irrelevant changelog line

---------

Co-authored-by: Dan Kortschak <[email protected]>
  • Loading branch information
mergify[bot] and efd6 committed Aug 10, 2023
1 parent 11b83ca commit 3799398
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ automatic splitting at root level, if root level element is an array. {pull}3415
*Affecting all Beats*

- Added append Processor which will append concrete values or values from a field to target. {issue}29934[29934] {pull}33364[33364]
- Add warning message to SysV init scripts for RPM-based systems that lack `/etc/rc.d/init.d/functions`. {issue}35708[35708] {pull}36188[36188]

*Auditbeat*

Expand Down
7 changes: 7 additions & 0 deletions dev-tools/packaging/templates/rpm/elastic-agent.init.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
# family. Please see: https://www.elastic.co/beats
### END INIT INFO

# Exit with an informative message if functions does not exist.
# This has been removed from RHEL9, but exists on other RPM-based
# distributions in the support matrix.
if [ ! -f /etc/rc.d/init.d/functions ]; then
echo "SysV-style init script service management is not supported on this system, use systemctl instead"
exit 1
fi


PATH=/usr/bin:/sbin:/bin:/usr/sbin
Expand Down
7 changes: 7 additions & 0 deletions dev-tools/packaging/templates/rpm/init.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
# family. Please see: https://www.elastic.co/beats
### END INIT INFO

# Exit with an informative message if functions does not exist.
# This has been removed from RHEL9, but exists on other RPM-based
# distributions in the support matrix.
if [ ! -f /etc/rc.d/init.d/functions ]; then
echo "SysV-style init script service management is not supported on this system, use systemctl instead"
exit 1
fi


PATH=/usr/bin:/sbin:/bin:/usr/sbin
Expand Down

0 comments on commit 3799398

Please sign in to comment.