X-Git-Url: https://iankelling.org/git/?p=buildscripts;a=blobdiff_plain;f=rust;fp=rust;h=ab70029ba354633bb6f8c31e2d88e32fb3d1fce0;hp=0000000000000000000000000000000000000000;hb=c426f5dc07b0a086a3163697db3abb516955566c;hpb=850dedd6b7a117c86c4e3e97a4ad1c948e9cd7a0 diff --git a/rust b/rust new file mode 100755 index 0000000..ab70029 --- /dev/null +++ b/rust @@ -0,0 +1,30 @@ +#!/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 + +# install rust. +if type -t rustc &>/dev/null; then + rustup update +else + curl https://sh.rustup.rs -sSf | bash -s -- -y +fi +# todo: update this. updates in rust are stupidly complicate +if ! which rg &>/dev/null; then + cargo install ripgrep +fi + +if ! type -t cargo-install-update &>/dev/null; then + cargo-install-update +fi + +cargo install-update -a