Browse Source

update-alternatives

main
pvincent 3 weeks ago
parent
commit
01073293f6
  1. 37
      install.sh

37
install.sh

@ -38,13 +38,44 @@ function install_ghostty {
} }
function install_homebrew { function install_homebrew {
:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
}
function raise_error {
message=${1:-an undefined error has occured!}
code=${2:-1}
echo "error ${code}: ${message}" >&2
exit ${code}
}
function set_alternative {
local key=$1
[[ -f /etc/alternatives/$key ]] || raise_error "alternative <${key}> not found!" 11
local path_to_key=$(readlink -f /usr/bin/$key)
local command=$2
local path_to_command=$(command -v "${command}")
if [[ "${path_to_key}" != "${path_to_command}" ]]; then
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}
else
echo "alternative ${key} => ${command}"
fi
} }
function configure_default { function configure_default {
# CAPS LOCK means ESC
# CAPS LOCK means ESC()
gsettings set org.gnome.desktop.input-sources xkb-options "['caps:escape']" gsettings set org.gnome.desktop.input-sources xkb-options "['caps:escape']"
set_alternative editor nvim
set_alternative vi nvim
set_alternative vim nvim
} }
## MAIN ## MAIN
@ -54,6 +85,6 @@ assert_gnome_desktop
echo "MIAOU-DESKTOP installation..." echo "MIAOU-DESKTOP installation..."
install_ghostty install_ghostty
install_homebrew
# install_homebrew
configure_default configure_default
echo SUCCESS echo SUCCESS
Loading…
Cancel
Save