X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=rust;h=5ed2870e32fcf374b4b8c682ee7cfc866ccfa12d;hb=HEAD;hp=ceaf4c21a4832a0ca971f58bb80c276c6b26dedc;hpb=36463736352b319d20280a80f74631f1628ed651;p=buildscripts diff --git a/rust b/rust index ceaf4c2..58009fe 100755 --- a/rust +++ b/rust @@ -1,16 +1,27 @@ #!/bin/bash -# Copyright (C) 2019 Ian Kelling -# SPDX-License-Identifier: AGPL-3.0-or-later - -if [ -z "$BASH_VERSION" ]; then echo "error: shell is not bash" >&2; exit 1; fi - -shopt -s inherit_errexit 2>/dev/null ||: # ignore fail in bash < 4.4 -set -eE -o pipefail -trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR -# alternatively, using https://iankelling.org/git/?p=errhandle;a=tree -# source /path/errhandle/err -# on my machine -source /a/bin/errhandle/err +# I, Ian Kelling, follow the GNU license recommendations at +# https://www.gnu.org/licenses/license-recommendations.en.html. They +# recommend that small programs, < 300 lines, be licensed under the +# Apache License 2.0. This file contains or is part of one or more small +# programs. If a small program grows beyond 300 lines, I plan to switch +# its license to GPL. + +# Copyright 2024 Ian Kelling + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +source /a/bin/bash-bear-trap/bash-bear source /a/bin/distro-functions/src/package-manager-abstractions PATH="$PATH:$HOME/.cargo/bin" @@ -22,7 +33,16 @@ hash -r if type -t rustc &>/dev/null; then rustup update else - curl https://sh.rustup.rs -sSf | bash -s -- -y + + # added stable due to this error +# Mar 11 00:13:15 info: no updatable toolchains installed +# Mar 11 00:13:15 info: checking for self-update +# Mar 11 00:13:15 info: cleaning up downloads & tmp directories +# Mar 11 00:13:15 error: rustup could not choose a version of cargo to run, because one wasn't specified explicitly, and no default is configured. +# Mar 11 00:13:15 help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain. +# Mar 11 00:13:15 /a/bin/buildscripts/rust:31: `cargo install-update -a' returned 1 + + curl https://sh.rustup.rs -sSf | bash -s -- --default-toolchain stable -y fi if ! which rg &>/dev/null; then @@ -37,3 +57,9 @@ if ! type -t cargo-install-update &>/dev/null; then fi cargo install-update -a + +# https://github.com/rust-lang/cargo/issues/3289 +# 149 mb on fresh install as of 07-2023 +if du -s -t 500M ~/.cargo/registry | grep . &>/dev/null; then + rm -rf ~/.cargo/registry +fi