Add Docker install, drop yazi, harden installer TERM handling

Replace the Docker-aliases-only component with a full install_docker step:
docker.io via apt, systemd enable, docker group membership, and aliases.
Remove yazi from core packages, terminal configs, aliases, and the repo.

Harden install.sh for SSH clients (e.g. Ghostty) that forward unknown TERM
values: fall back through xterm-256color, xterm, screen, dumb, and use
safe_clear in the interactive menu.

Document Ghostty/SSH terminal issues in README, including bash vs zsh ssh()
wrappers and verification steps.
This commit is contained in:
2026-06-04 22:23:03 +02:00
parent 6fe8529d10
commit 41a7eb370b
4 changed files with 111 additions and 36 deletions

View File

@@ -17,11 +17,11 @@ cd ~/server_cli_tools
| # | Component | What it does | | # | Component | What it does |
|---|-----------|-------------| |---|-----------|-------------|
| 1 | **Core packages** | `vim`, `bat`, `eza`, `fzf`, `htop`, `tmux`, `zsh`, `ripgrep`, `fd-find`, `zoxide`, `yazi`, `git-delta` | | 1 | **Core packages** | `vim`, `bat`, `eza`, `fzf`, `htop`, `tmux`, `zsh`, `ripgrep`, `fd-find`, `zoxide`, `git-delta` |
| 2 | **Zsh + Oh-My-Zsh** | Shell, plugins (`zsh-autosuggestions`, `zsh-syntax-highlighting`, `z`), custom prompt theme | | 2 | **Zsh + Oh-My-Zsh** | Shell, plugins (`zsh-autosuggestions`, `zsh-syntax-highlighting`, `z`), custom prompt theme |
| 3 | **Aliases + tools** | General, git, and docker aliases with a self-documenting help system (`h`) | | 3 | **Aliases + tools** | General, git, and docker aliases with a self-documenting help system (`h`) |
| 4 | **Terminal configs** | `bat` theme (base16), `yazi` file manager config | | 4 | **Terminal configs** | `bat` theme (base16) |
| 5 | **Docker aliases** | Start/stop toggle, bulk stop/remove, image management | | 5 | **Docker** | `docker.io` via apt, service enabled, user added to `docker` group, management aliases |
| 6 | **Git config** | `git-delta` as pager with side-by-side diffs | | 6 | **Git config** | `git-delta` as pager with side-by-side diffs |
## Alias highlights ## Alias highlights
@@ -63,7 +63,6 @@ server_cli_tools/
custom_tools/ custom_tools/
backup_dotfiles.sh # backup conflicting dotfiles backup_dotfiles.sh # backup conflicting dotfiles
bat/config # bat theme bat/config # bat theme
yazi/yazi.toml # yazi file manager config
zsh/zhann-elvis.zsh-theme # custom zsh prompt (git-aware) zsh/zhann-elvis.zsh-theme # custom zsh prompt (git-aware)
zshrc # .zshrc with oh-my-zsh + plugins zshrc # .zshrc with oh-my-zsh + plugins
``` ```
@@ -76,3 +75,67 @@ After installation, create local overrides that won't be tracked:
- `~/.config/aliases/.custom_aliases` — temporary/personal aliases - `~/.config/aliases/.custom_aliases` — temporary/personal aliases
Use `ea l` to edit local aliases, `ea c` for custom, `sa` to re-source. Use `ea l` to edit local aliases, `ea c` for custom, `sa` to re-source.
## Troubleshooting
### Terminal type / colors over SSH
Clients such as [Ghostty](https://ghostty.org/) set `TERM` to values like `xterm-ghostty`. SSH forwards that to the server, but the server usually has no matching terminfo entry. Symptoms include:
- `'xterm-ghostty': unknown terminal type` when running `./install.sh` (the interactive menu calls `clear`)
- Broken or missing colors in `vim`, `htop`, `tmux`, and other TUI programs
`install.sh` detects an unknown `TERM` at startup and falls back to the first available of `xterm-256color`, `xterm`, `screen`, or `dumb`. You can also use the non-interactive installer: `./install.sh --all`.
For **all future SSH sessions** to any server, force a portable `TERM` on the client before connecting. Add a wrapper on your **local** machine (not the server). The function body is the same in bash and zsh; what differs is where you put it and how you check that it took effect.
**Bash** (`~/.bashrc`) — append at the end of the file:
```bash
unalias ssh 2>/dev/null
ssh() {
TERM=xterm-256color command ssh "$@"
}
```
**Zsh** (`~/.zshrc`) — append at the end, *after* Oh-My-Zsh and other plugins so nothing loads later and overrides it:
```zsh
unalias ssh 2>/dev/null
ssh() {
TERM=xterm-256color command ssh "$@"
}
```
Zsh also allows `function ssh { ... }` with the same body; `ssh() { ... }` is equivalent. In both shells, `command ssh` calls the real binary and avoids recursion.
| | Bash | Zsh |
|---|------|-----|
| Config file | `~/.bashrc` | `~/.zshrc` |
| Placement | End of file | End of file, after OMZ/plugins |
| Clear alias first | `unalias ssh` (if present) | Same — plugins sometimes define `ssh` aliases |
| Argument forwarding | `"$@"` | `"$@"` — not `"@"` |
| Reload | `exec bash` or new terminal | `exec zsh` or new terminal |
| Check wrapper is active | `type ssh` | `whence -v ssh` (`type` can be ambiguous in zsh) |
Verify:
```sh
# bash
type ssh
ssh myhost 'echo $TERM'
# zsh
whence -v ssh
ssh myhost 'echo $TERM'
```
Both should report a shell function and print `xterm-256color` on the remote host.
One-off:
```sh
TERM=xterm-256color ./install.sh
```
Optional: in `~/.ssh/config`, `SetEnv TERM=xterm-256color` under `Host *` only works when the remote `sshd` accepts `TERM` via `AcceptEnv` — many servers do not, so the shell wrapper above is more reliable.

View File

@@ -8,8 +8,6 @@
alias ll="eza -lag --icons=always --group-directories-first --smart-group --time-style='+%d %b %y %H:%M'" alias ll="eza -lag --icons=always --group-directories-first --smart-group --time-style='+%d %b %y %H:%M'"
# du all items in folder, human readable # du all items in folder, human readable
alias dh='du -chs *' alias dh='du -chs *'
# yazi file manager
alias y='yazi'
# preview/find file using fzf and bat # preview/find file using fzf and bat
alias pf='fzf --preview "bat --color=always {}"' alias pf='fzf --preview "bat --color=always {}"'
# cd to dir using fuzzy finder (fzf) # cd to dir using fuzzy finder (fzf)

View File

@@ -1,3 +0,0 @@
[mgr]
ratio = [ 1, 2, 5 ]
show_hidden = true

View File

@@ -10,6 +10,18 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CONFIGS="$SCRIPT_DIR/configs" CONFIGS="$SCRIPT_DIR/configs"
BACKUP_DIR="$HOME/.server_cli_tools_bkp/$(date +%Y%m%d-%H%M%S)" BACKUP_DIR="$HOME/.server_cli_tools_bkp/$(date +%Y%m%d-%H%M%S)"
# SSH from Ghostty and other clients forwards TERM values (e.g. xterm-ghostty)
# that remote servers often lack in terminfo — breaks clear/tput and colors.
if ! infocmp "${TERM:-}" &>/dev/null; then
for _term_fallback in xterm-256color xterm screen dumb; do
if infocmp "$_term_fallback" &>/dev/null; then
export TERM="$_term_fallback"
break
fi
done
unset _term_fallback
fi
# Colors (matching the dotfiles convention) # Colors (matching the dotfiles convention)
e_err() { echo -e "\e[1;31m$1\e[0m"; } e_err() { echo -e "\e[1;31m$1\e[0m"; }
e_info() { echo -e "\e[1;34m$1\e[0m"; } e_info() { echo -e "\e[1;34m$1\e[0m"; }
@@ -54,6 +66,10 @@ command_exists() {
command -v "$1" >/dev/null 2>&1 command -v "$1" >/dev/null 2>&1
} }
safe_clear() {
clear 2>/dev/null || printf '\033[H\033[2J'
}
check_os() { check_os() {
if [ ! -f /etc/os-release ]; then if [ ! -f /etc/os-release ]; then
e_err "Cannot detect OS. This script supports Ubuntu/Debian only." e_err "Cannot detect OS. This script supports Ubuntu/Debian only."
@@ -93,7 +109,7 @@ install_core_packages() {
e_info "\n[1/6] Core packages" e_info "\n[1/6] Core packages"
sudo apt-get update -qq sudo apt-get update -qq
apt_install curl vim bat fzf htop tmux zsh ripgrep fd-find zoxide yazi apt_install curl vim bat fzf htop tmux zsh ripgrep fd-find zoxide
# bat is installed as 'batcat' on Debian/Ubuntu # bat is installed as 'batcat' on Debian/Ubuntu
if command_exists batcat && ! command_exists bat; then if command_exists batcat && ! command_exists bat; then
@@ -193,33 +209,39 @@ install_aliases() {
} }
install_terminal_configs() { install_terminal_configs() {
e_info "\n[4/6] Terminal configs (bat, yazi)" e_info "\n[4/6] Terminal configs (bat)"
# bat
mkdir -p "$HOME/.config/bat" mkdir -p "$HOME/.config/bat"
copy_config "$CONFIGS/bat/config" "$HOME/.config/bat/config" copy_config "$CONFIGS/bat/config" "$HOME/.config/bat/config"
e_info " Installed bat config (theme: base16)" e_info " Installed bat config (theme: base16)"
# yazi
mkdir -p "$HOME/.config/yazi"
copy_config "$CONFIGS/yazi/yazi.toml" "$HOME/.config/yazi/yazi.toml"
e_info " Installed yazi config"
INSTALLED+=("terminal-configs") INSTALLED+=("terminal-configs")
} }
install_docker_aliases() { install_docker() {
e_info "\n[5/6] Docker aliases" e_info "\n[5/6] Docker"
if command_exists docker; then sudo apt-get update -qq
copy_config "$CONFIGS/aliases/.docker_aliases" "$HOME/.config/aliases/.docker_aliases" apt_install docker.io
e_info " Installed Docker aliases"
else if command_exists systemctl; then
e_warn " Docker not found — aliases installed anyway (will work once Docker is available)" sudo systemctl enable --now docker 2>/dev/null \
copy_config "$CONFIGS/aliases/.docker_aliases" "$HOME/.config/aliases/.docker_aliases" || e_warn " Could not enable docker service — start manually: sudo systemctl start docker"
fi fi
INSTALLED+=("docker-aliases") if id -nG "$USER" 2>/dev/null | grep -qw docker; then
e_info " $USER is already in the docker group"
else
e_info " Adding $USER to the docker group..."
sudo usermod -aG docker "$USER"
e_warn " Log out and back in (or run: newgrp docker) for group membership to apply"
fi
mkdir -p "$HOME/.config/aliases"
copy_config "$CONFIGS/aliases/.docker_aliases" "$HOME/.config/aliases/.docker_aliases"
e_info " Installed Docker aliases"
INSTALLED+=("docker")
} }
install_git_config() { install_git_config() {
@@ -286,11 +308,6 @@ uninstall() {
rm -f "$HOME/.config/bat/config" rm -f "$HOME/.config/bat/config"
removed+=("bat-config") removed+=("bat-config")
fi fi
if [ -f "$HOME/.config/yazi/yazi.toml" ]; then
rm -f "$HOME/.config/yazi/yazi.toml"
removed+=("yazi-config")
fi
# Zsh theme + zshrc # Zsh theme + zshrc
if [ -f "$HOME/.config/zsh/zhann-elvis.zsh-theme" ]; then if [ -f "$HOME/.config/zsh/zhann-elvis.zsh-theme" ]; then
rm -f "$HOME/.config/zsh/zhann-elvis.zsh-theme" rm -f "$HOME/.config/zsh/zhann-elvis.zsh-theme"
@@ -373,11 +390,11 @@ uninstall() {
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
COMPONENTS=( COMPONENTS=(
"Core packages (vim, bat, eza, fzf, htop, tmux, rg, fd, zoxide, yazi, delta)" "Core packages (vim, bat, eza, fzf, htop, tmux, rg, fd, zoxide, delta)"
"Zsh + Oh-My-Zsh (shell, plugins, theme)" "Zsh + Oh-My-Zsh (shell, plugins, theme)"
"Aliases + custom tools" "Aliases + custom tools"
"Terminal configs (bat, yazi)" "Terminal configs (bat)"
"Docker aliases" "Docker (engine + aliases)"
"Git config (delta pager)" "Git config (delta pager)"
) )
@@ -386,7 +403,7 @@ INSTALLERS=(
install_zsh install_zsh
install_aliases install_aliases
install_terminal_configs install_terminal_configs
install_docker_aliases install_docker
install_git_config install_git_config
) )
@@ -398,7 +415,7 @@ show_menu() {
done done
while true; do while true; do
clear safe_clear
echo "" echo ""
e_info "Server CLI Tools — Installer" e_info "Server CLI Tools — Installer"
echo "=============================" echo "============================="