Skip to content

Commit f8fa126

Browse files
fix: add missing init script support for CentOS 6 (#78)
* ci: support optional DH login * fix: add missing CentOS 6 init script --------- Signed-off-by: Patrick Stephens <pat@fluent.do>
1 parent 244d00e commit f8fa126

File tree

18 files changed

+184
-791
lines changed

18 files changed

+184
-791
lines changed

.github/workflows/call-build-linux-packages.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ on:
2525
description: The Dockerhub username to use for authenticated pulls.
2626
required: false
2727
type: string
28-
default: "fluentdo"
28+
default: ""
2929
amd-runner-label:
3030
description: The label to use for the runner (if not specified then the default ubuntu-latest or equivalent is used).
3131
required: false
@@ -50,7 +50,7 @@ on:
5050
required: false
5151
dockerhub-token:
5252
description: The Dockerhub token to use for authenticated pulls (not pushes).
53-
required: true
53+
required: false
5454
jobs:
5555
build-packages:
5656
name: agent - ${{ matrix.distro }} package build and upload
@@ -96,6 +96,7 @@ jobs:
9696
distro: "${{ matrix.distro }}"
9797

9898
- name: Log in to docker.io for authorised pulls
99+
if: inputs.dockerhub-username != ''
99100
uses: docker/login-action@v3
100101
with:
101102
username: ${{ inputs.dockerhub-username }}
@@ -149,5 +150,10 @@ jobs:
149150

150151
- name: List RPM package dependencies
151152
continue-on-error: false
152-
run: find source/packaging/packages/ -type f -name '*.rpm' -exec sh -c 'i="$1";echo "$i";docker run --rm -t -v "$PWD/$i":/test.rpm:ro registry.access.redhat.com/ubi9:9.4 yum -q deplist /test.rpm' shell {} \;
153+
run: find source/packaging/packages/ -type f -name '*.rpm' -exec sh -c 'i="$1";echo "$i";docker run --rm -t -v "$PWD/$i":/test.rpm:ro registry.access.redhat.com/ubi9:9.5 yum -q deplist /test.rpm' shell {} \;
154+
shell: bash
155+
156+
- name: CentOS 6 checks
157+
if: matrix.distro == 'centos/6'
158+
run: /bin/bash ./scripts/centos6-init-check.sh
153159
shell: bash

scripts/centos6-init-check.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
set -eux
3+
# This does not work with a symlink to this script
4+
# SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
5+
# See https://stackoverflow.com/a/246128/24637657
6+
SOURCE=${BASH_SOURCE[0]}
7+
while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
8+
SCRIPT_DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
9+
SOURCE=$(readlink "$SOURCE")
10+
# if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
11+
[[ $SOURCE != /* ]] && SOURCE=$SCRIPT_DIR/$SOURCE
12+
done
13+
SCRIPT_DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
14+
15+
REPO_ROOT=${REPO_ROOT:-$SCRIPT_DIR/..}
16+
17+
# Check for /etc/init.d/xxx script to run the agent
18+
WORKDIR=${WORKDIR:-/tmp/rpmcontents}
19+
rm -rf "${WORKDIR:?}/*"
20+
mkdir -p "$WORKDIR"
21+
find "$REPO_ROOT/source/packaging/packages/centos/6/" -type f -name '*x86_64.rpm' -print0 |
22+
while IFS= read -r -d '' line; do
23+
echo "Extracting $line"
24+
docker run --rm -t \
25+
-v "${WORKDIR}:/rpmcontents" \
26+
-v "$line:/test.rpm:ro" \
27+
registry.access.redhat.com/ubi9:9.5 \
28+
/bin/sh -c 'cd /rpmcontents && yum install -y cpio && rpm2cpio /test.rpm | cpio -idmv'
29+
done
30+
31+
if [[ -f "${WORKDIR}/etc/init.d/fluent-bit" ]]; then
32+
echo "INFO: Found fluent-bit init.d script"
33+
elif [[ -f "${WORKDIR}/etc/init.d/fluentdo-agent" ]]; then
34+
echo "INFO: Found fluentdo-agent init.d script"
35+
else
36+
echo "ERROR: Unable to find init.d script"
37+
ls -lRh "$WORKDIR"
38+
exit 1
39+
fi

source/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ option(FLB_PREFER_SYSTEM_LIB_NGHTTP2 "Prefer the libnghttp2 system library"
250250
option(FLB_PREFER_SYSTEM_LIB_SQLITE "Prefer the libsqlite3 system library" ${FLB_PREFER_SYSTEM_LIBS})
251251
option(FLB_PREFER_SYSTEM_LIB_ZSTD "Prefer the libzstd system library" ${FLB_PREFER_SYSTEM_LIBS})
252252

253+
# Enable support for CentOS 6 init scripts
254+
option(FLB_CPACK_SYSVINIT "Enable creation of SysV init scripts after installation" No)
255+
253256
# Enable all features
254257
if(FLB_ALL)
255258
# Global
@@ -1560,4 +1563,10 @@ if(FLB_SYSTEM_MACOS)
15601563
endif()
15611564
endif()
15621565

1566+
# Primarily for legacy (CentOS 6/AL 1) support and workarounds
1567+
if(FLB_CPACK_SYSVINIT)
1568+
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/cpack/scripts/sysv-init-install.sh)
1569+
set(CPACK_RPM_PACKAGE_REQUIRES_POST "initscripts")
1570+
endif(FLB_CPACK_SYSVINIT)
1571+
15631572
include(CPack)

source/Dockerfile

Lines changed: 0 additions & 1 deletion
This file was deleted.

source/cmake/version.rc.in

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ BEGIN
3232
VALUE "FileDescription", "Compiled with @CMAKE_C_COMPILER_ID@ @CMAKE_C_COMPILER_VERSION@\0"
3333
VALUE "ProductVersion", FLB_VER_PRODUCTVERSION_STR
3434
VALUE "FileVersion", FLB_VER_FILEVERSION_STR
35-
VALUE "InternalName", "fluent-bit\0"
36-
VALUE "ProductName", "Fluent Bit - Fast and Lightweight Logs and Metrics processor for Linux, BSD, OSX and Windows\0"
37-
VALUE "CompanyName", "Calyptia Inc.\0"
38-
VALUE "LegalCopyright", "Copyright (C) 2015-2018 Treasure Data Inc.\nCopyright (C) 2019-2021 The Fluent Bit Authors.\nAll rights reserved.\0"
35+
VALUE "InternalName", "fluentdo-agent\0"
36+
VALUE "ProductName", "FluentDo Agent is an enterprise-hardened distribution of Fluent Bit\0"
37+
VALUE "CompanyName", "FluentDo.\0"
38+
VALUE "LegalCopyright", "Copyright (C) 2015-2018 Treasure Data Inc.\nCopyright (C) 2019-2025 The Fluent Bit Authors.\nAll rights reserved.\0"
3939
VALUE "Licence", "Apache-2.0\0"
40-
VALUE "Info", "https://docs.fluentbit.io/manual/0"
40+
VALUE "Info", "https://docs.fluent.do/0"
4141
END
4242
END
4343
END

source/cpack/description

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
Fluent Bit is a high performance and multi platform Log Forwarder.
1+
FluentDo Agent is an enterprise-hardened distribution of Fluent Bit, maintained by core OSS maintainers.
2+
It delivers production-ready log processing with enhanced security, reduced footprint, and enterprise support.

source/cpack/macos/welcome.txt.cmakein

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ This will install @FLB_OUT_NAME@ on your Mac.
22

33
--------------------------------------------------
44

5-
Thank you for trying @FLB_OUT_NAME@! Have a fantastic day!
6-
75
You can start / stop @FLB_OUT_NAME@ via launchctl command.
86

97
- start @FLB_OUT_NAME@
@@ -14,6 +12,4 @@ You can start / stop @FLB_OUT_NAME@ via launchctl command.
1412

1513
% sudo launchctl unload /Library/LaunchDaemons/@FLB_OUT_NAME@.plist
1614

17-
If you have a question, please ask it on Fluent Bit Community Forum:
18-
19-
https://github.com/fluent/fluent-bit/discussions
15+
If you require Enterprise support, please contact us via info@fluent.do
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
NAME=""
3+
if [ -f /etc/init.d/fluentdo-agent ]; then
4+
NAME=fluentdo-agent
5+
elif [ -f /etc/init.d/fluent-bit ]; then
6+
NAME=fluent-bit
7+
else
8+
echo "ERROR: No init.d script found"
9+
exit 1
10+
fi
11+
chmod a+x /etc/init.d/"$NAME"
12+
chkconfig --add "$NAME"

0 commit comments

Comments
 (0)