You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
2.4 KiB
101 lines
2.4 KiB
#!/usr/bin/env bash
|
|
|
|
## CONSTANTS
|
|
|
|
## FUNCTIONS
|
|
|
|
function assert_debian13 {
|
|
test -f /etc/debian_version &&
|
|
grep --quiet ^13\. /etc/debian_version ||
|
|
echo "assert: Debian 13 missing!"
|
|
}
|
|
|
|
function assert_gnome_desktop {
|
|
[[ $XDG_SESSION_DESKTOP == "gnome" ]] ||
|
|
echo "assert: Gnome Shell missing!"
|
|
}
|
|
|
|
function install_ghostty {
|
|
|
|
if ! command -v ghostty >/dev/null; then
|
|
curl -sS https://debian.griffo.io/EA0F721D231FDD3A0A17B9AC7808B4DD62C41256.asc |
|
|
sudo gpg --dearmor --yes -o /etc/apt/trusted.gpg.d/debian.griffo.io.gpg
|
|
|
|
echo "deb https://debian.griffo.io/apt $(lsb_release -sc 2>/dev/null) main" |
|
|
sudo tee /etc/apt/sources.list.d/debian.griffo.io.list
|
|
|
|
sudo apt-get update &&
|
|
sudo apt-get install -y ghostty
|
|
else
|
|
echo Ghostty already installed!
|
|
fi
|
|
|
|
if ! systemctl is-enabled --user --quiet app-com.mitchellh.ghostty; then
|
|
systemctl enable --user app-com.mitchellh.ghostty.service
|
|
else
|
|
echo "Ghostty service already enabled!"
|
|
fi
|
|
}
|
|
|
|
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 command path_to_command path_to_key
|
|
key=$1
|
|
[[ -f /etc/alternatives/$key ]] || raise_error "alternative <${key}> not found!" 11
|
|
|
|
path_to_key=$(readlink "/etc/alternatives/$key")
|
|
|
|
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}"
|
|
else
|
|
echo "alternative ${key} => ${command}"
|
|
fi
|
|
|
|
}
|
|
|
|
function configure_default {
|
|
# CAPS LOCK means ESC()
|
|
gsettings set org.gnome.desktop.input-sources xkb-options "['caps:escape']"
|
|
|
|
set_alternative editor nvim
|
|
set_alternative vi nvim
|
|
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
|
|
assert_gnome_desktop
|
|
|
|
echo "MIAOU-DESKTOP installation..."
|
|
|
|
install_ghostty
|
|
# install_homebrew
|
|
install_neovim
|
|
configure_default
|
|
echo SUCCESS
|