Skip to content

Commit

Permalink
dev-tools/packaging/templates/rpm: add warning when /etc/rc.d/init.d/…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
efd6 authored Aug 9, 2023
1 parent 1c138c5 commit e797d53
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 @@ -211,6 +211,7 @@ automatic splitting at root level, if root level element is an array. {pull}3415

- Added append Processor which will append concrete values or values from a field to target. {issue}29934[29934] {pull}33364[33364]
- When running under Elastic-Agent the status is now reported per Unit instead of the whole Beat {issue}35874[35874] {pull}36183[36183]
- 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 e797d53

Please sign in to comment.