#!/bin/bash # 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" hash -r # todo: this should happen in some kind of sandbox or vm # install rust. if type -t rustc &>/dev/null; then rustup update else # 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 cargo install ripgrep fi if ! type -t cargo-install-update &>/dev/null; then # due to # error: failed to run custom build command for `openssl-sys v0.9.53` pi libssl-dev pkg-config cargo install cargo-update 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