Added Rust crates script
Necessary to implement the installation of Rust and associated crates which can be used by downstream configurations. This functionality was originally part of the macOS Configuration project but has been moved here to provide a common foundation in which to build upon.
This commit is contained in:
@@ -171,6 +171,15 @@ install_program() {
|
||||
}
|
||||
export -f install_program
|
||||
|
||||
# Installs Rust.
|
||||
# Parameters: None.
|
||||
install_rust() {
|
||||
if ! command -v cargo > /dev/null; then
|
||||
curl --proto "=https" --tlsv1.2 --fail --silent --show-error https://sh.rustup.rs | sh
|
||||
fi
|
||||
}
|
||||
export -f install_rust
|
||||
|
||||
# Installs an application via a tar file.
|
||||
# Parameters: $1 (required) - URL, $2 (required) - Application name, $3 (required) - Decompress options.
|
||||
install_tar_app() {
|
||||
|
||||
@@ -22,6 +22,8 @@ process_option() {
|
||||
bin/install_applications;;
|
||||
'x')
|
||||
bin/install_extensions;;
|
||||
'rc')
|
||||
bin/install_rust_crates;;
|
||||
'd')
|
||||
bin/apply_default_settings;;
|
||||
's')
|
||||
@@ -35,6 +37,7 @@ process_option() {
|
||||
bin/install_app_store
|
||||
bin/install_applications
|
||||
bin/install_extensions
|
||||
bin/install_rust_crates
|
||||
bin/apply_default_settings
|
||||
bin/setup_software
|
||||
clean_work_path;;
|
||||
@@ -46,7 +49,8 @@ process_option() {
|
||||
verify_homebrew_casks
|
||||
verify_app_store_applications
|
||||
verify_applications
|
||||
verify_extensions;;
|
||||
verify_extensions
|
||||
verify_rust_crates;;
|
||||
'C')
|
||||
caffeinate_machine;;
|
||||
'ua')
|
||||
|
||||
@@ -126,3 +126,20 @@ verify_path() {
|
||||
fi
|
||||
}
|
||||
export -f verify_path
|
||||
|
||||
# Checks for missing Rust crates.
|
||||
verify_rust_crates() {
|
||||
printf "\nChecking Rust crates...\n"
|
||||
|
||||
local crates="$(ls -A1 $HOME/.cargo/bin)"
|
||||
|
||||
while read line; do
|
||||
if [[ "$line" == "cargo install"* ]]; then
|
||||
local crate=$(printf "$line" | awk '{print $3}')
|
||||
verify_listed_application "$crate" "${crates[*]}"
|
||||
fi
|
||||
done < "$MAC_OS_CONFIG_PATH/bin/install_rust_crates"
|
||||
|
||||
printf "Rust crates check complete.\n"
|
||||
}
|
||||
export -f verify_rust_crates
|
||||
|
||||
Reference in New Issue
Block a user