From 8b6cae881ec47af4371c2b0c20182b11634ac7c9 Mon Sep 17 00:00:00 2001 From: Renato Botelho do Couto Date: Thu, 18 Jun 2026 06:58:31 -0500 Subject: [PATCH] Make it possible to replace sed On systems like Chimera Linux, GNU sed is available as gsed. Make it possible to set an environment variable and use it instead of sed. No functional changes intended --- Makefile | 3 +++ releng/tag-release.sh | 8 +++++--- releng/version.sh | 6 ++++-- testing/helpers/zbm-populate.sh | 10 ++++++---- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 271bdb9c..2a278f29 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,9 @@ INITCPIODIR=$(PREFIX)/lib/initcpio MANDIR=$(PREFIX)/share/man BINDIR=$(PREFIX)/bin EXAMPLES=$(PREFIX)/share/examples/zfsbootmenu +SED?=sed + +export SED .PHONY: install core dracut initcpio zbm-release show-version diff --git a/releng/tag-release.sh b/releng/tag-release.sh index af4dc9c5..bfe17e11 100755 --- a/releng/tag-release.sh +++ b/releng/tag-release.sh @@ -1,6 +1,8 @@ #!/bin/bash # vim: softtabstop=2 shiftwidth=2 expandtab +: ${SED:=sed} + error () { echo "$@" exit 1 @@ -14,7 +16,7 @@ fi # Validate release # shellcheck disable=SC2001 -if [ -n "$(echo "${release}" | sed 's/[0-9][A-Za-z0-9_.-]*$//')" ]; then +if [ -n "$(echo "${release}" | $SED 's/[0-9][A-Za-z0-9_.-]*$//')" ]; then error "ERROR: release must start with a number and contain [A-Za-z0-9_.-]" fi @@ -75,7 +77,7 @@ fi echo "Will tag release version ${release} as ${tag}" # update version in documentation -sed -i "s/^release = '.*'\$/release = '${release}'/" docs/conf.py +$SED -i "s/^release = '.*'\$/release = '${release}'/" docs/conf.py # Synchronize man pages with POD documentation if [ ! -x releng/rst2help.sh ]; then @@ -180,7 +182,7 @@ for f in sha256.{txt,sig}; do done # github-cli does not automatically strip header that hub uses for a title -sed -i '1,/^$/d' "${relnotes}" +$SED -i '1,/^$/d' "${relnotes}" echo "Release ${release} ready to push and tag" while true; do diff --git a/releng/version.sh b/releng/version.sh index 06ff3c09..99b2855f 100755 --- a/releng/version.sh +++ b/releng/version.sh @@ -68,7 +68,7 @@ detect_version() ( if [ -r "${genzbm}" ]; then # shellcheck disable=SC2016 if verline="$(grep 'our $VERSION[[:space:]]*=' "${genzbm}")"; then - version="$(echo "${verline}" | head -n1 | sed -e "s/.*=[[:space:]]*['\"]//" -e "s/['\"].*//")" || version="" + version="$(echo "${verline}" | head -n1 | ${SED} -e "s/.*=[[:space:]]*['\"]//" -e "s/['\"].*//")" || version="" if [ -n "${version}" ]; then echo "${version}" return 0 @@ -103,10 +103,12 @@ update_version() { # Update generate-zbm if [ -w bin/generate-zbm ]; then echo "Updating bin/generate-zbm" - sed -e "s/our \$VERSION.*/our \$VERSION = '${version}';/" -i bin/generate-zbm + ${SED} -e "s/our \$VERSION.*/our \$VERSION = '${version}';/" -i bin/generate-zbm fi } +: ${SED:=sed} + version= update= while getopts "huv:" opt; do diff --git a/testing/helpers/zbm-populate.sh b/testing/helpers/zbm-populate.sh index c87a884c..47c7cf22 100755 --- a/testing/helpers/zbm-populate.sh +++ b/testing/helpers/zbm-populate.sh @@ -1,5 +1,7 @@ #!/bin/bash +: ${SED:=sed} + # Clone ZFSBootMenu and install ( cd / && git clone https://github.com/zbm-dev/zfsbootmenu.git ) ( cd /zfsbootmenu && make install ) @@ -11,7 +13,7 @@ fi # Adjust the configuration for convenient builds if [ -f /etc/zfsbootmenu/config.yaml ]; then - sed -e 's/Versions:.*/Versions: false/' \ + $SED -e 's/Versions:.*/Versions: false/' \ -e 's/ManageImages:.*/ManageImages: true/' \ -e 's@ImageDir:.*@ImageDir: /zfsbootmenu/build@' \ -e '/BootMountPoint:/d' -i /etc/zfsbootmenu/config.yaml @@ -19,16 +21,16 @@ if [ -f /etc/zfsbootmenu/config.yaml ]; then # Build the EFI executable if the stub is available for stubdir in /usr/lib/systemd/boot/efi /usr/lib/gummiboot; do [ -r "${stubdir}/linuxx64.efi.stub" ] || continue - sed -e 's/Enabled:.*/Enabled: true/' -i /etc/zfsbootmenu/config.yaml + $SED -e 's/Enabled:.*/Enabled: true/' -i /etc/zfsbootmenu/config.yaml break done case "${INITCPIO,,}" in yes|y|on|1) - sed -e "s/InitCPIO:.*/InitCPIO: true/" -i /etc/zfsbootmenu/config.yaml + $SED -e "s/InitCPIO:.*/InitCPIO: true/" -i /etc/zfsbootmenu/config.yaml ;; no|n|off|0) - sed -e "s/InitCPIO:.*/InitCPIO: false/" -i /etc/zfsbootmenu/config.yaml + $SED -e "s/InitCPIO:.*/InitCPIO: false/" -i /etc/zfsbootmenu/config.yaml ;; esac fi