67 lines
1.6 KiB
Bash
67 lines
1.6 KiB
Bash
{
|
|
#!/usr/bin/env bash
|
|
|
|
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
|
command_exists() {
|
|
command -v "$@" >/dev/null 2>&1
|
|
}
|
|
|
|
if command_exists curl; then
|
|
eval "$(curl -fsSL https://git.k4li.de/scripts/imports/raw/branch/main/distros.sh)"
|
|
else
|
|
echo "curl is required, but missing.."
|
|
exit 1
|
|
fi
|
|
|
|
evalCargo() {
|
|
if [ -e "$HOME/.cargo/env" ]; then
|
|
echo_note "Using $HOME/.cargo/env.."
|
|
. "$HOME/.cargo/env"
|
|
fi
|
|
}
|
|
|
|
i_yazi() {
|
|
# if ! command_exists make || ! command_exists gcc; then
|
|
# echo_error "The script might run into issues, because of make and gcc not being installed. Please install it, and run the script again, if it fails!"
|
|
# fi
|
|
evalCargo
|
|
if command_exists cargo; then
|
|
echo_info "Installing yazi through cargo"
|
|
elif command_exists curl; then
|
|
echo_note "no cargo found, using curl to install rustup"
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
|
|
evalCargo
|
|
|
|
rustup update
|
|
|
|
echo_info "Installing yazi through cargo"
|
|
else
|
|
echo_warning "neither cargo, nor curl were found. Cannot continue!"
|
|
fi
|
|
|
|
cargo install --locked yazi-fm yazi-cli
|
|
|
|
c_yazi
|
|
}
|
|
|
|
c_yazi() {
|
|
if [ -e "$HOME/.config/yazi/package.toml" ]; then
|
|
if command_exists ya; then
|
|
ya pack -i
|
|
fi
|
|
else
|
|
echo_warning "There was no yazi config found.. "
|
|
fi
|
|
}
|
|
|
|
main() {
|
|
if $arch || $opensuse; then
|
|
_install yazi
|
|
else
|
|
i_yazi
|
|
fi
|
|
}
|
|
|
|
main
|
|
}
|