confOS/termux.sh

92 lines
2.7 KiB
Bash
Raw Normal View History

2024-03-30 18:17:02 +01:00
#!/usr/bin/env bash
set -o errexit # crash the script when a command crash
set -o pipefail # same as above for piped command
set -o nounset # crash when a variable doesnt exist
# TRACE=1 for debug
if [[ "${TRACE-0}" == "1" ]]; then
set -o xtrace
fi
cd "$(dirname "$0")" # change script directory
function main {
# === Variables ==
2024-03-30 18:25:54 +01:00
local repo apt_arg
2024-03-30 18:17:02 +01:00
repo=https://git.mylloon.fr/Anri/confOS/raw/branch/main
2024-03-30 18:28:29 +01:00
apt_arg='-y -o Dpkg::Options::="--force-confnew"'
2024-03-30 18:17:02 +01:00
# === Update ==
2024-03-30 18:36:28 +01:00
eval "apt-get update ${apt_arg}"
2024-03-30 18:17:02 +01:00
# === Packages ==
2024-03-30 18:36:28 +01:00
eval "apt-get install ${apt_arg} \
2024-04-03 08:54:38 +02:00
fish eza tealdeer bat wget topgrade git make micro"
2024-03-30 18:17:02 +01:00
# === Fish ==
# Default shell
chsh -s fish
# Remove motd
fish -c "set -U fish_greeting"
2024-03-30 18:41:04 +01:00
# Fisher
2024-03-30 18:17:02 +01:00
curl -sL https://git.io/fisher | fish -c "source && fisher install jorgebucaran/fisher"
2024-03-30 18:41:04 +01:00
# Auto pair
2024-03-30 18:17:02 +01:00
fish -c "fisher install jorgebucaran/autopair.fish"
# Fish theme
fish -c "fish_config theme choose 'Base16 Eighties' && yes | fish_config theme save"
fish -c "set fish_color_comment 5c6773" # custom comment color
# Fish prompt
rm "$HOME"/.config/fish/functions/fish_prompt.fish 2> /dev/null ||:
wget -q "${repo}"/.config/fish/functions/fish_prompt.fish -P "$HOME"/.config/fish/functions/
# EZA colors
fish -c "set -Ux EXA_COLORS 'di=1;36:da=35'"
# Add configuration
wget -q "${repo}"/.config/fish/config.fish -O "$HOME"/.config/fish/config.fish
2024-03-30 18:17:02 +01:00
# Add abbreviations
wget -q "${repo}"/.config/fish/conf.d/abbr.fish -O "$HOME"/.config/fish/conf.d/abbr.fish
# Add aliases
wget -q "${repo}"/.config/fish/conf.d/alias.fish -O "$HOME"/.config/fish/conf.d/alias.fish
# === Default editor ==
fish -c "set -Ux EDITOR nano"
# === tldr ==
fish -c "tldr --update"
# Fish completion
local url_tldr
url_tldr=$(curl -s https://api.github.com/repos/dbrgn/tealdeer/releases/latest \
| grep 'browser_download_url": ".*/completions_fish"' \
| cut --delimiter=":" --field=2,3 \
| tr -d \" )
wget -q --show-progress "${url_tldr:1}" -O completions_fish
mv completions_fish ~/.config/fish/completions/tldr.fish
# === Git ==
wget -q "${repo}"/dotfiles/.gitconfig -O "$HOME"/.gitconfig
2024-04-03 08:40:27 +02:00
# === Topgrade ==
wget -q "${repo}"/.config/topgrade/topgrade.toml -O "$HOME"/.config/topgrade.toml
# === Fix ==
# Since Termux isn't used a lot, I don't plan to make it a real distro
# supported by thoses scripts, so I give the bare minimum support to it
# Fix topgrade
sed -i "/fish_ssh_agent/d" "$HOME"/.config/fish/config.fish
2024-04-03 08:40:27 +02:00
sed -i "/topgrade/d" "$HOME"/.config/fish/conf.d/abbr.fish
2024-03-30 18:17:02 +01:00
}
if type termux-info &> /dev/null;
then
main "$@"
else
echo "Ce script ne fonctionne que sur Termux." >&2
fi