on main help sign in
refactor: try to fix install.sh
commit9caf438a8b7200cf01cdc5516378e5f5f7ab308e authorrobcholz <84130577+robcholz@users.noreply.github.com> dateSat 7 Feb 2026, 21:09 (8 months ago) parent3e1b069
1 file changed+46−1
install.sh+46−1
install.sh+46−1
@@ -38,9 +38,54 @@ require_cmd() {
3838 fi
3939}
4040
41−require_cmd cargo "Install Rust (cargo) from https://rustup.rs and retry."
4241require_cmd git "Install git and retry."
4342
43+ensure_cargo() {
44+ if command -v cargo >/dev/null 2>&1; then
45+ return 0
46+ fi
47+
48+ print_message warning "Rust (cargo) is required but not found."
49+ print_message info "You should review and approve the Rust installer before proceeding."
50+ if [[ -t 0 ]]; then
51+ read -r -p "Install Rust using rustup now? (y/N) " reply
52+ case "${reply}" in
53+ y|Y)
54+ if command -v curl >/dev/null 2>&1; then
55+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
56+ elif command -v wget >/dev/null 2>&1; then
57+ wget -qO- https://sh.rustup.rs | sh -s -- -y
58+ else
59+ print_message error "Missing required command: curl or wget"
60+ print_message info "Install Rust manually from https://rustup.rs and retry."
61+ exit 1
62+ fi
63+ # shellcheck source=/dev/null
64+ if [[ -f "$HOME/.cargo/env" ]]; then
65+ # shellcheck disable=SC1090
66+ source "$HOME/.cargo/env"
67+ fi
68+ ;;
69+ *)
70+ print_message info "Install Rust manually from https://rustup.rs and retry."
71+ exit 1
72+ ;;
73+ esac
74+ else
75+ print_message error "Non-interactive shell: cannot prompt to install Rust."
76+ print_message info "Install Rust manually from https://rustup.rs and retry."
77+ exit 1
78+ fi
79+
80+ if ! command -v cargo >/dev/null 2>&1; then
81+ print_message error "Cargo still not available after installation."
82+ print_message info "Open a new shell or run: source \"$HOME/.cargo/env\""
83+ exit 1
84+ fi
85+}
86+
87+ensure_cargo
88+
4489CARGO_HOME=${CARGO_HOME:-$HOME/.cargo}
4590INSTALL_DIR="$CARGO_HOME/bin"
4691