changeset 265: |
fab40b02d833 |
parent: |
8015880d9a0d
|
child: |
0e3229b8409f |
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Sun, 16 Jun 2024 02:43:16 +0000 |
permissions: |
-rwxr-xr-x |
description: |
less verbose, start lisp from autogen.lisp |
7 local _arch=$(_read
arch
| tr
-d
'"') 14 local _url="https://packy.compiler.company/dist/${_arch}/pack" 16 if !
_stash=".stash"; then 17 # Because the previous command ran in a subshell, we must manually 18 # propagate exit status. 21 ensure
mkdir
-p
"${_stash}/src" 22 ensure
mkdir
-p
"${_stash}/share/lisp/fasl" 23 ensure
mkdir
-p
"${_stash}/bin" 24 ensure
mkdir
-p
"${_stash}/lib" 25 ensure
mkdir
-p
"${_stash}/include" 27 local _sbcl_pack="sbcl.tar.zst" 28 local _rocksdb_pack="rocksdb.tar.zst" 29 local _core_pack="core.tar.zst" 30 local _core_src_pack="core-source.tar.zst" 31 local _sbcl_url="${_url}/${_sbcl_pack}" 32 local _rocksdb_url="${_url}/${_rocksdb_pack}" 33 local _core_url="${_url}/${_core_pack}" 34 local _core_src_url="${_url}/${_core_src_pack}" 35 ensure
download
"$_sbcl_url" "$_sbcl_pack" "$_arch" 36 unzstd
"${_sbcl_pack}" 38 cd sbcl
&& INSTALL_ROOT=$(realpath
..
) sh
install.sh
&& cd ..
39 # ensure download "$_core_src_url" "$_core_src_pack" "$_arch" 40 # unzstd "${_core_src_pack}" 41 # tar -xvf "core-source.tar" 43 # ensure download "$_rocksdb_url" "${_rocksdb_pack}" "$_arch" 44 # unzstd "${_rocksdb_pack}" 45 # tar -xvf "pack/rocksdb.tar" 46 # cp -rf rocksdb/include/* include/ 47 # cp -rf rocksdb/*.so lib/ 48 ensure
download
"$_core_url" "${_core_pack}" "$_arch" 49 unzstd
"${_core_pack}" 51 cp
-rf
core/bin/*
bin/
52 cp
-rf
core/share/*
share/
56 say
"successfully unpacked core" 57 say
"starting lisp..." 58 cd ..
&& .stash/bin/sbcl
--core
.stash/share/lisp/prelude.core
--script
autogen.lisp
63 grep
":$1" $INFRA_HOST_CONFIG | cut
-d
' ' -f
2-
66 # Check if curl supports the --retry flag, then pass it to the curl invocation. 67 check_curl_for_retry_support
() { 68 local _retry_supported="" 69 # "unspecified" is for arch, allows for possibility old OS using macports, homebrew, etc. 70 if check_help_for
"notspecified" "curl" "--retry"; then 71 _retry_supported="--retry 3" 72 if check_help_for
"notspecified" "curl" "--continue-at"; then 73 # "-C -" tells curl to automatically find where to resume the download when retrying. 74 _retry_supported="--retry 3 -C -" 78 RETVAL="$_retry_supported" 81 # Return cipher suite string specified by user, otherwise return strong TLS 1.2-1.3 cipher suites 82 # if support by local tools is detected. Detection currently supports these curl backends: 83 # GnuTLS and OpenSSL (possibly also LibreSSL and BoringSSL). Return value can be empty. 84 get_ciphersuites_for_curl
() { 85 if [ -n
"${TLS_CIPHERSUITES-}" ]; then 86 # user specified custom cipher suites, assume they know what they're doing 87 RETVAL="$TLS_CIPHERSUITES" 91 local _openssl_syntax="no" 92 local _gnutls_syntax="no" 93 local _backend_supported="yes" 94 if curl
-V
| grep
-q
' OpenSSL/'; then 96 elif curl
-V
| grep
-iq
' LibreSSL/'; then 98 elif curl
-V
| grep
-iq
' BoringSSL/'; then 100 elif curl
-V
| grep
-iq
' GnuTLS/'; then 103 _backend_supported="no" 106 local _args_supported="no" 107 if [ "$_backend_supported" = "yes" ]; then 108 # "unspecified" is for arch, allows for possibility old OS using macports, homebrew, etc. 109 if check_help_for
"notspecified" "curl" "--tlsv1.2" "--ciphers" "--proto"; then 110 _args_supported="yes" 115 if [ "$_args_supported" = "yes" ]; then 116 if [ "$_openssl_syntax" = "yes" ]; then 117 _cs=$(get_strong_ciphersuites_for
"openssl") 118 elif [ "$_gnutls_syntax" = "yes" ]; then 119 _cs=$(get_strong_ciphersuites_for
"gnutls") 126 # Return cipher suite string specified by user, otherwise return strong TLS 1.2-1.3 cipher suites 127 # if support by local tools is detected. Detection currently supports these wget backends: 128 # GnuTLS and OpenSSL (possibly also LibreSSL and BoringSSL). Return value can be empty. 129 get_ciphersuites_for_wget
() { 130 if [ -n
"${TLS_CIPHERSUITES-}" ]; then 131 # user specified custom cipher suites, assume they know what they're doing 132 RETVAL="$TLS_CIPHERSUITES" 137 if wget
-V
| grep
-q
'\-DHAVE_LIBSSL'; then 138 # "unspecified" is for arch, allows for possibility old OS using macports, homebrew, etc. 139 if check_help_for
"notspecified" "wget" "TLSv1_2" "--ciphers" "--https-only" "--secure-protocol"; then 140 _cs=$(get_strong_ciphersuites_for
"openssl") 142 elif wget
-V
| grep
-q
'\-DHAVE_LIBGNUTLS'; then 143 # "unspecified" is for arch, allows for possibility old OS using macports, homebrew, etc. 144 if check_help_for
"notspecified" "wget" "TLSv1_2" "--ciphers" "--https-only" "--secure-protocol"; then 145 _cs=$(get_strong_ciphersuites_for
"gnutls") 162 if "$_cmd" --help
| grep
-q
'For all options use the manual or "--help all".'; then 171 if check_cmd
sw_vers
; then 172 case $(sw_vers
-productVersion
) in 174 # If we're running on macOS, older than 10.13, then we always 175 # fail to find these options to force fallback 176 if [ "$(sw_vers
-productVersion
| cut
-d.
-f2
)" -lt
13 ]; then 178 echo "Warning: Detected macOS platform older than 10.13" 183 # We assume Big Sur will be OK for now 186 # Unknown product version, warn and continue 187 echo "Warning: Detected unknown macOS major version: $(sw_vers
-productVersion
)" 188 echo "Warning TLS capabilities detection may fail" 197 if !
"$_cmd" --help
"$_category" | grep
-q
--
"$_arg"; then 202 true # not strictly needed 205 # Return strong TLS 1.2-1.3 cipher suites in OpenSSL or GnuTLS syntax. TLS 1.2 206 # excludes non-ECDHE and non-AEAD cipher suites. DHE is excluded due to bad 207 # DH params often found on servers (see RFC 7919). Sequence matches or is 208 # similar to Firefox 68 ESR with weak cipher suites disabled via about:config. 209 # $1 must be openssl or gnutls. 210 get_strong_ciphersuites_for
() { 211 if [ "$1" = "openssl" ]; then 212 # OpenSSL is forgiving of unknown values, no problems with TLS 1.3 values on versions that don't support it yet. 213 echo "TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384" 214 elif [ "$1" = "gnutls" ]; then 215 # GnuTLS isn't forgiving of unknown values, so this may require a GnuTLS version that supports TLS 1.3 even if wget doesn't. 216 # Begin with SECURE128 (and higher) then remove/add to build cipher suites. Produces same 9 cipher suites as OpenSSL but in slightly different order. 217 echo "SECURE128:-VERS-SSL3.0:-VERS-TLS1.0:-VERS-TLS1.1:-VERS-DTLS-ALL:-CIPHER-ALL:-MAC-ALL:-KX-ALL:+AEAD:+ECDHE-ECDSA:+ECDHE-RSA:+AES-128-GCM:+CHACHA20-POLY1305:+AES-256-GCM" 221 # This wraps curl or wget. Try curl first, if not installed, 229 if check_cmd
curl
; then 231 elif check_cmd
wget
; then 234 _dld='curl or wget' # to be used in error message of need_cmd 237 if [ "$1" = --check
]; then 239 elif [ "$_dld" = curl
]; then 240 check_curl_for_retry_support
242 get_ciphersuites_for_curl
243 _ciphersuites="$RETVAL" 244 if [ -n
"$_ciphersuites" ]; then 245 _err=$(curl
$_retry --proto
'=https' --tlsv1.2
--ciphers
"$_ciphersuites" --silent
--show-error
--fail
--location
"$1" --output
"$2" 2>
&1) 248 echo "Warning: Not enforcing strong cipher suites for TLS, this is potentially less secure" 249 if !
check_help_for
"$3" curl
--proto
--tlsv1.2
; then 250 echo "Warning: Not enforcing TLS v1.2, this is potentially less secure" 251 _err=$(curl
$_retry --silent
--show-error
--fail
--location
"$1" --output
"$2" 2>
&1) 254 _err=$(curl
$_retry --proto
'=https' --tlsv1.2
--silent
--show-error
--fail
--location
"$1" --output
"$2" 2>
&1) 258 if [ -n
"$_err" ]; then 260 if echo "$_err" | grep
-q
404$
; then 261 err
"installer for platform '$3' not found, this may be unsupported" 265 elif [ "$_dld" = wget
]; then 266 if [ "$(wget
-V
2>
&1|head
-2
|tail
-1
|cut
-f1
-d
" ")" = "BusyBox" ]; then 267 echo "Warning: using the BusyBox version of wget. Not enforcing strong cipher suites for TLS or TLS v1.2, this is potentially less secure" 268 _err=$(wget
"$1" -O
"$2" 2>
&1) 271 get_ciphersuites_for_wget
272 _ciphersuites="$RETVAL" 273 if [ -n
"$_ciphersuites" ]; then 274 _err=$(wget
--https-only
--secure-protocol
=TLSv1_2
--ciphers
"$_ciphersuites" "$1" -O
"$2" 2>
&1) 277 echo "Warning: Not enforcing strong cipher suites for TLS, this is potentially less secure" 278 if !
check_help_for
"$3" wget
--https-only
--secure-protocol
; then 279 echo "Warning: Not enforcing TLS v1.2, this is potentially less secure" 280 _err=$(wget
"$1" -O
"$2" 2>
&1) 283 _err=$(wget
--https-only
--secure-protocol
=TLSv1_2
"$1" -O
"$2" 2>
&1) 288 if [ -n
"$_err" ]; then 290 if echo "$_err" | grep
-q
' 404 Not Found$'; then 291 err
"installer for platform '$3' not found, this may be unsupported" 296 err
"Unknown downloader" # should not reach here