From 09e4c3e12b557519d94ca29e3850a7723cc98e78 Mon Sep 17 00:00:00 2001 From: Roderick van Domburg Date: Tue, 15 Oct 2024 21:47:02 +0200 Subject: [PATCH] Prevent garbage toml-e files on macOS Newer macOS versions output `uname` as "Darwin", while older versions output "darwin". --- publish.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/publish.sh b/publish.sh index 7a685e03..d1d8f783 100755 --- a/publish.sh +++ b/publish.sh @@ -8,15 +8,19 @@ cd $WORKINGDIR crates=( "protocol" "oauth" "core" "discovery" "audio" "metadata" "playback" "connect" "librespot" ) -OS=`uname` function replace_in_file() { - if [ "$OS" == 'darwin' ]; then - # for MacOS - sed -i '' -e "$1" "$2" - else - # for Linux and Windows - sed -i'' -e "$1" "$2" - fi + OS=`uname` + shopt -s nocasematch + case "$OS" in + darwin) + # for macOS + sed -i '' -e "$1" "$2" + ;; + *) + # for Linux and Windows + sed -i'' -e "$1" "$2" + ;; + esac } function switchBranch {