Skip to content

Commit 3799398

Browse files
mergify[bot]efd6
andauthored
[8.9](backport #36188) dev-tools/packaging/templates/rpm: add warning 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]>
1 parent 11b83ca commit 3799398

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

CHANGELOG.next.asciidoc

+1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ automatic splitting at root level, if root level element is an array. {pull}3415
181181
*Affecting all Beats*
182182

183183
- Added append Processor which will append concrete values or values from a field to target. {issue}29934[29934] {pull}33364[33364]
184+
- 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]
184185

185186
*Auditbeat*
186187

dev-tools/packaging/templates/rpm/elastic-agent.init.sh.tmpl

+7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
# family. Please see: https://www.elastic.co/beats
1818
### END INIT INFO
1919

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

2128

2229
PATH=/usr/bin:/sbin:/bin:/usr/sbin

dev-tools/packaging/templates/rpm/init.sh.tmpl

+7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
# family. Please see: https://www.elastic.co/beats
1818
### END INIT INFO
1919

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

2128

2229
PATH=/usr/bin:/sbin:/bin:/usr/sbin

0 commit comments

Comments
 (0)