Browse Source

debian alternatives

main
pvincent 3 weeks ago
parent
commit
b33247d565
  1. 25
      install.sh

25
install.sh

@ -46,22 +46,24 @@ function raise_error {
message=${1:-an undefined error has occured!}
code=${2:-1}
echo "error ${code}: ${message}" >&2
exit ${code}
exit "${code}"
}
function set_alternative {
local key=$1
local key command path_to_command path_to_key
key=$1
[[ -f /etc/alternatives/$key ]] || raise_error "alternative <${key}> not found!" 11
local path_to_key=$(readlink -f /usr/bin/$key)
path_to_key=$(readlink "/etc/alternatives/$key")
local command=$2
local path_to_command=$(command -v "${command}")
command=$2
path_to_command=$(command -v "${command}")
if [[ "${path_to_key}" != "${path_to_command}" ]]; then
echo "$key: $path_to_key != $path_to_command"
sudo -vp 'sudo for update-alternatives: '
sudo update-alternatives --install /usr/bin/${key} ${key} ${path_to_command} 100
sudo update-alternatives --set ${key} ${path_to_command}
sudo update-alternatives --install "/usr/bin/${key}" "${key}" "${path_to_command}" 100
sudo update-alternatives --set "${key}" "${path_to_command}"
else
echo "alternative ${key} => ${command}"
fi
@ -77,6 +79,14 @@ function configure_default {
set_alternative vim nvim
}
function install_neovim {
if ! grep -q nvim-vanilla ~/.bashrc; then
alias nvim-vanilla='NVIM_APPNAME=nvim-vanilla nvim'
else
echo 'nvim-vanilla ready!'
fi
}
## MAIN
assert_debian13
@ -86,5 +96,6 @@ echo "MIAOU-DESKTOP installation..."
install_ghostty
# install_homebrew
install_neovim
configure_default
echo SUCCESS
Loading…
Cancel
Save