File tree Expand file tree Collapse file tree 2 files changed +38
-21
lines changed
Expand file tree Collapse file tree 2 files changed +38
-21
lines changed Original file line number Diff line number Diff line change 22
33NU_VERSION=$( cat $( dirname $0 ) /.nu_version)
44
5- if [ ! -f build/nu-$NU_VERSION ]; then
6- os=$( uname -s)
7- arch=$( uname -m)
8-
9- case " $os " in
10- " Darwin" )
11- [[ " $arch " == " arm64" ]] && arch=" aarch64"
12- name=" nu-${NU_VERSION} -${arch} -apple-darwin"
13- ;;
14- " Linux" )
15- name=" nu-${NU_VERSION} -${arch} -unknown-linux-musl"
16- ;;
17- * )
18- echo " Unsupported operating system: $os " >&2
19- exit 1
20- ;;
21- esac
5+ os=$( uname -s)
6+ arch=$( uname -m)
7+
8+ case " $os " in
9+ " Darwin" )
10+ [ " $arch " = " arm64" ] && arch=" aarch64"
11+ native_nu=" nu-${NU_VERSION} -${arch} -apple-darwin"
12+ ;;
13+ " Linux" )
14+ native_nu=" nu-${NU_VERSION} -${arch} -unknown-linux-musl"
15+ ;;
16+ * )
17+ echo " Unsupported operating system: $os " >&2
18+ exit 1
19+ ;;
20+ esac
21+
22+ linux_nu=" nu-${NU_VERSION} -${arch} -unknown-linux-musl"
23+
24+ fetch_nu () {
25+ name=" $1 "
2226
2327 mkdir -p build/
2428 cd build/
2529
2630 wget " https://github.com/nushell/nushell/releases/download/$NU_VERSION /$name .tar.gz"
31+
2732 tar -zxvf ${name} .tar.gz $name /nu
2833 rm ${name} .tar.gz
29- mv $name /nu nu-$NU_VERSION
30- rmdir $name
3134
3235 cd -
36+ }
37+
38+ if [ ! -f build/$native_nu /nu ]; then
39+ fetch_nu " $native_nu "
40+ fi
41+
42+ if [ ! -f build/$linux_nu /nu ]; then
43+ fetch_nu " $linux_nu "
3344fi
3445
3546script=" $( dirname " $0 " ) /src/commands/$1 .nu"
3647shift
3748
38- exec build/nu- $NU_VERSION $script " $@ "
49+ exec build/$native_nu /nu $script " $@ "
Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ use ../config.nu
55
66def main [config_path : string ] {
77 let root_path = ($env .FILE_PWD | path join " ../../" )
8+
9+ mut host_arch = (uname | get machine )
10+ if $host_arch == " arm64" {
11+ $host_arch = " aarch64"
12+ }
13+
814 let nu_version = (open ($root_path | path join " .nu_version" ) | str trim )
915 let cfg = config normalise (open $config_path )
1016
@@ -17,7 +23,7 @@ def main [config_path: string] {
1723 $"(pwd )/toolchains " : " /toolchains"
1824 }
1925 ro_bind : {
20- $"(pwd )/build/nu-($nu_version ) " : " /bin/nu" ,
26+ $"(pwd )/build/nu-($nu_version )-( $host_arch )-unknown-linux-musl/nu " : " /bin/nu" ,
2127 ($config_path | path expand ): " /build/config.nuon" ,
2228 ($root_path | path join " src" ): " /src"
2329 }
You can’t perform that action at this time.
0 commit comments