-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcosmocc.cmd
More file actions
executable file
·57 lines (46 loc) · 1.45 KB
/
cosmocc.cmd
File metadata and controls
executable file
·57 lines (46 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
::/*#! 2> /dev/null #
@ 2>/dev/null # 2>nul & echo off & goto BOF #
export SIREUM_HOME=$(cd -P "$(dirname "$0")/../.." && pwd -P) #
exec "${SIREUM_HOME}/bin/sireum" slang run "$0" "$@" #
:BOF
setlocal
set SIREUM_HOME=%~dp0..\..
"%SIREUM_HOME%\bin\sireum.bat" slang run %0 %*
exit /B %errorlevel%
::!#*/
// #Sireum
import org.sireum._
val homeBin = Os.slashDir.up.canon
val cacheDir: Os.Path = Os.env("SIREUM_CACHE") match {
case Some(dir) => Os.path(dir)
case _ => Os.home / "Downloads" / "sireum"
}
val version = Sireum.versions.get("org.sireum.version.cosmocc").get
val urlPrefix = s"https://github.com/jart/cosmopolitan/releases/download/$version"
val cosmoccDropName = s"cosmocc-$version.zip"
def install(): Unit = {
val cosmocc = homeBin / "cosmocc"
val ver = cosmocc / "VER"
if (ver.exists && ver.read == version) {
return
}
cosmocc.removeAll()
cosmocc.mkdirAll()
val cosmoccDrop = cacheDir / cosmoccDropName
if (!cosmoccDrop.exists) {
println(s"Downloading cosmocc $version ...")
val url = s"$urlPrefix/${cosmoccDrop.name}"
cosmoccDrop.downloadFrom(url)
println()
}
println(s"Extracting cosmocc $version ...")
if (Os.isLinux) {
proc"unzip -qq $cosmoccDrop".at(cosmocc).runCheck()
} else {
proc"tar xf $cosmoccDrop".at(cosmocc).runCheck()
}
println()
ver.writeOver(version)
println(s"cosmocc is available at: $cosmocc")
}
install()