(install.sh): update eza installation logic to install via cargo if Rust is not present, removing previous GPG and repository setup steps

This commit is contained in:
Frank Qing
2025-05-28 04:07:10 +08:00
parent e515a8b4bc
commit 1bd3a2dcb8

View File

@@ -48,16 +48,15 @@ install_eza_fallback() {
echo "Attempting fallback installation of eza..."
case $os in
ubuntu|debian)
# Ensure gpg exists and add the community repo
command -v gpg &> /dev/null || sudo apt-get install -y gpg
sudo mkdir -p /etc/apt/keyrings
wget -qO- https://raw.githubusercontent.com/eza-community/eza/main/deb.asc | \
sudo gpg --dearmor -o /etc/apt/keyrings/gierens.gpg
echo "deb [signed-by=/etc/apt/keyrings/gierens.gpg] http://deb.gierens.de stable main" | \
sudo tee /etc/apt/sources.list.d/gierens.list
sudo chmod 644 /etc/apt/keyrings/gierens.gpg /etc/apt/sources.list.d/gierens.list
sudo apt-get update
sudo apt-get install -y eza
# Install cargo if it doesn't exist
if ! command -v cargo &> /dev/null; then
echo "Installing Rust and cargo..."
sudo apt-get update
sudo apt-get install -y curl build-essential
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source ~/.cargo/env
fi
cargo install eza
;;
fedora)
sudo dnf install -y eza || {