function check_if_installed() { if [[ -f "$HOME/.cargo/bin/probe-rs" ]]; then echo "already installed." else echo "installing probe-rs, cargo-embed and cargo-flash.." curl -LsSf https://github.com/probe-rs/probe-rs/releases/latest/download/probe-rs-tools-installer.sh | sh fi } function install_udev_rules() { if [[ $EUID -eq 0 ]]; then sudo probe-rs complete install-udev-rules else echo "could not install udev-rules, needs to be root." fi } check_if_installed install_udev_rules