add install checks

This commit is contained in:
Josh Thomas 2022-05-11 22:20:40 -05:00
parent 5c4f7e597e
commit b528b6f3ad

48
install
View file

@ -85,23 +85,32 @@ install_tmux_plugin_manager () {
install_starship () {
sh -c "$(curl -fsSL https://starship.rs/install.sh)" -- --force --bin-dir ${LOCAL_BIN_DIR}
starship --version >/dev/null 2>&1
if [[ $? -ne 0 ]]; then
sh -c "$(curl -fsSL https://starship.rs/install.sh)" -- --force --bin-dir ${LOCAL_BIN_DIR}
fi
}
install_direnv () {
set_kernal_and_machine_env_var
download_url=$(
curl -fL https://api.github.com/repos/direnv/direnv/releases/latest \
| grep browser_download_url \
| cut -d '"' -f 4 \
| grep "direnv.$KERNAL.$MACHINE"
)
curl -o "${LOCAL_BIN_DIR}/direnv" -fL "$download_url"
chmod +x "${LOCAL_BIN_DIR}/direnv"
direnv --version >/dev/null 2>&1
if [[ $? -ne 0 ]]; then
set_kernal_and_machine_env_var
download_url=$(
curl -fL https://api.github.com/repos/direnv/direnv/releases/latest \
| grep browser_download_url \
| cut -d '"' -f 4 \
| grep "direnv.$KERNAL.$MACHINE"
)
curl -o "${LOCAL_BIN_DIR}/direnv" -fL "$download_url"
chmod +x "${LOCAL_BIN_DIR}/direnv"
fi
}
install_just () {
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --force --to ${LOCAL_BIN_DIR}
just --version >/dev/null 2>&1
if [[ $? -ne 0 ]]; then
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --force --to ${LOCAL_BIN_DIR}
fi
}
install_fzf () {
@ -109,13 +118,16 @@ install_fzf () {
}
install_gh_cli () {
set_kernal_and_machine_env_var
version=`curl "https://api.github.com/repos/cli/cli/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/' | cut -c2-`
curl -sSL https://github.com/cli/cli/releases/download/v${version}/gh_${version}_${KERNAL}_${MACHINE}.tar.gz -o gh_${version}_${KERNAL}_${MACHINE}.tar.gz
tar xvf gh_${version}_${KERNAL}_${MACHINE}.tar.gz
mv gh_${version}_${KERNAL}_${MACHINE}/bin/gh ${LOCAL_BIN_DIR}/gh
sudo mv gh_${version}_${KERNAL}_${MACHINE}/share/man/man1/* /usr/share/man/man1/
chmod +x "${LOCAL_BIN_DIR}/gh"
gh --version >/dev/null 2>&1
if [[ $? -ne 0 ]]; then
set_kernal_and_machine_env_var
version=`curl "https://api.github.com/repos/cli/cli/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/' | cut -c2-`
curl -sSL https://github.com/cli/cli/releases/download/v${version}/gh_${version}_${KERNAL}_${MACHINE}.tar.gz -o gh_${version}_${KERNAL}_${MACHINE}.tar.gz
tar xvf gh_${version}_${KERNAL}_${MACHINE}.tar.gz
mv gh_${version}_${KERNAL}_${MACHINE}/bin/gh ${LOCAL_BIN_DIR}/gh
sudo mv gh_${version}_${KERNAL}_${MACHINE}/share/man/man1/* /usr/share/man/man1/
chmod +x "${LOCAL_BIN_DIR}/gh"
fi
}
copy_alacritty_config () {