Skip to content

Commit 3ee9ef9

Browse files
committed
util: Fix brew-update cross-platform
1 parent febfda8 commit 3ee9ef9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

util/brew-update

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ defn main(version):
88
download-releases: version
99
update-brew: version
1010

11+
defn sha256sum(file):
12+
os =: System/getProperty("os.name")
13+
cond:
14+
os =~ /Mac\s?OS/: sh("shasum -a 256 $file")
15+
else: sh("sha256sum $file")
16+
1117
defn update-brew(version):
1218
releases =: releases(version)
1319

@@ -22,7 +28,7 @@ defn update-brew(version):
2228
text =:
2329
reduce-kv _ text releases:
2430
fn(text key file):
25-
sha256 =: sh("sha256sum $file").out:words.0
31+
sha256 =: sha256sum(file).out:words.0
2632
text: .replace(key sha256)
2733

2834
say: "Updating homebrew-yamlscript/ys.rb"
@@ -51,7 +57,7 @@ defn download-releases(version):
5157
when-not fs-e(file):
5258
say: "Downloading $file"
5359
url =: "$releases-url/download/$version/$file"
54-
res =: sh("wget -q $url")
60+
res =: sh("curl --silent --location $url --output $file")
5561
when res.exit:N.?:
5662
die: "Download of '$url' failed:\n$(res.err)"
5763

0 commit comments

Comments
 (0)