#!/usr/bin/env bash # SPDX-FileCopyrightText: 2022 Robin Vobruba # # SPDX-License-Identifier: Unlicense # Exit immediately on each error and unset variable; # see: https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/ set -Eeuo pipefail #set -Eeu function print_help() { local script_name="$(basename "$0")" echo "Installs the Ubuntu/Debian packages required" echo "for building (this) Rust project, using 'apt-get'." echo echo "Usage:" echo " $script_name [OPTION...]" echo "Options:" echo " -h, --help" echo " Show this help message and exit" echo "Examples:" echo " $script_name" echo " $script_name --help" } # read command-line args POSITIONAL=() while [[ $# -gt 0 ]] do arg="$1" shift # $2 -> $1, $3 -> $2, ... case "$arg" in -h|--help) print_help exit 0 ;; *) # non-/unknown option POSITIONAL+=("$arg") # save it in an array for later ;; esac done set -- "${POSITIONAL[@]}" # restore positional parameters sudo apt-get update sudo apt-get install -y --no-install-recommends \ build-essential \ musl-tools