Skip to content

Commit 7082552

Browse files
moneymanolisk9ert
andauthored
Chore: macos release-script fixes (#1897)
Co-authored-by: k9ert <[email protected]>
1 parent 1b57d2c commit 7082552

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

utils/release.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1-
#!//bin/bash
1+
#!/bin/bash
2+
3+
# Replacing MacOS utilities with GNU core utilities to make script more robust
4+
# See: https://apple.stackexchange.com/questions/69223/how-to-replace-mac-os-x-utilities-with-gnu-core-utilities
5+
if [[ "$OSTYPE" == "darwin"* ]]; then
6+
brew ls --versions coreutils > /dev/null;
7+
exitCode=$?
8+
if [[ $exitCode == 0 ]]; then
9+
echo "Coreutils are installed via Homebrew, prepending PATH to use GNU core utilities over MacOS utilities."
10+
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
11+
else
12+
echo "GNU core utilities not installed. Run brew install coreutils"
13+
fi
14+
fi
215

316
ask_yn() {
417
while true; do
@@ -50,8 +63,8 @@ done
5063

5164

5265
function main() {
53-
54-
if ! [ "$(git remote -v | grep upstream | grep '[email protected]:cryptoadvance/specter-desktop.git' | wc -l)" = "2" ]; then
66+
# Sed is used as there can be whitespaces
67+
if ! [ "$(git remote -v | grep upstream | grep '[email protected]:cryptoadvance/specter-desktop.git' | wc -l | sed -e 's/\s*//')" = "2" ]; then
5568
echo " --> You don't have the correct upstream-remote. You need this to release. Please do this:"
5669
echo "git remote add upstream [email protected]:cryptoadvance/specter-desktop.git "
5770
exit 2

0 commit comments

Comments
 (0)