mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	This has been broken for many years and nobody’s complained. Signed-off-by: Anders Kaseorg <anders@zulip.com>
		
			
				
	
	
		
			42 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/env bash
 | 
						|
set -euo pipefail
 | 
						|
 | 
						|
version=22.12.0
 | 
						|
arch="$(uname -m)"
 | 
						|
 | 
						|
case $arch in
 | 
						|
    x86_64)
 | 
						|
        tarball="node-v$version-linux-x64.tar.xz"
 | 
						|
        sha256=22982235e1b71fa8850f82edd09cdae7e3f32df1764a9ec298c72d25ef2c164f
 | 
						|
        ;;
 | 
						|
 | 
						|
    aarch64)
 | 
						|
        tarball="node-v$version-linux-arm64.tar.xz"
 | 
						|
        sha256=8cfd5a8b9afae5a2e0bd86b0148ca31d2589c0ea669c2d0b11c132e35d90ed68
 | 
						|
        ;;
 | 
						|
esac
 | 
						|
 | 
						|
check_version() {
 | 
						|
    out="$(node --version)" && [ "$out" = "v$version" ] \
 | 
						|
        && [ /usr/local/bin/pnpm -ef /srv/zulip-node/lib/node_modules/corepack/dist/pnpm.js ]
 | 
						|
}
 | 
						|
 | 
						|
if ! check_version 2>/dev/null; then
 | 
						|
    set -x
 | 
						|
    tmpdir="$(mktemp -d)"
 | 
						|
    trap 'rm -r "$tmpdir"' EXIT
 | 
						|
    cd "$tmpdir"
 | 
						|
    curl -fLO --retry 3 "https://nodejs.org/dist/v$version/$tarball"
 | 
						|
    sha256sum -c <<<"$sha256 $tarball"
 | 
						|
    rm -rf /srv/zulip-node
 | 
						|
    mkdir -p /srv/zulip-node
 | 
						|
    tar -xJf "$tarball" --no-same-owner --strip-components=1 -C /srv/zulip-node
 | 
						|
    ln -sf /srv/zulip-node/bin/{corepack,node,npm,npx} /usr/local/bin
 | 
						|
    COREPACK_DEFAULT_TO_LATEST=0 /usr/local/bin/corepack enable
 | 
						|
 | 
						|
    # Clean up after previous versions of this script
 | 
						|
    rm -rf /srv/zulip-yarn /usr/bin/yarn /usr/local/nvm
 | 
						|
 | 
						|
    check_version
 | 
						|
fi
 |