From 22aae2e107c77a6e2b7d8042517d545fbaaffffa Mon Sep 17 00:00:00 2001 From: Antoon Huiskens <50206792+antoonhuiskens@users.noreply.github.com> Date: Thu, 13 Jul 2023 17:16:24 +0200 Subject: [PATCH] =?UTF-8?q?Replacing=20sed=20with=20awk=20for=20determinin?= =?UTF-8?q?g=20systemd-version=20provides=20more=20=E2=80=A6=20(#9925)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/grafana/loki/issues/9924 **What this PR does / why we need it**: This PR addresses a parsing bug for package post install scripts. **Which issue(s) this PR fixes**: Fixes #9924 **Special notes for your reviewer**: **Checklist** - [X] Reviewed the [`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md) guide (**required**) - [X] Documentation added - [ ] Tests updated - [ ] `CHANGELOG.md` updated - [ ] If the change is worth mentioning in the release notes, add `add-to-release-notes` label - [ ] Changes that require user attention or interaction to upgrade are documented in `docs/sources/upgrading/_index.md` - [ ] For Helm chart changes bump the Helm chart version in `production/helm/loki/Chart.yaml` and update `production/helm/loki/CHANGELOG.md` and `production/helm/loki/README.md`. [Example PR](https://github.com/grafana/loki/commit/d10549e3ece02120974929894ee333d07755d213) --- tools/packaging/loki-postinstall.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packaging/loki-postinstall.sh b/tools/packaging/loki-postinstall.sh index acf8df4bcc..69e1295061 100644 --- a/tools/packaging/loki-postinstall.sh +++ b/tools/packaging/loki-postinstall.sh @@ -5,7 +5,7 @@ if ! command -V systemctl >/dev/null 2>&1; then echo "Could not find systemd. Skipping system installation." && exit 0 else - systemd_version=$(systemctl --version | head -1 | sed 's/systemd //g') + systemd_version=$(systemctl --version | awk '/systemd /{print $2}') fi cleanInstall() {