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:
71
install.sh
71
install.sh
@@ -10,6 +10,18 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
CONFIGS="$SCRIPT_DIR/configs"
|
||||
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)
|
||||
e_err() { echo -e "\e[1;31m$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
|
||||
}
|
||||
|
||||
safe_clear() {
|
||||
clear 2>/dev/null || printf '\033[H\033[2J'
|
||||
}
|
||||
|
||||
check_os() {
|
||||
if [ ! -f /etc/os-release ]; then
|
||||
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"
|
||||
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
|
||||
if command_exists batcat && ! command_exists bat; then
|
||||
@@ -193,33 +209,39 @@ install_aliases() {
|
||||
}
|
||||
|
||||
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"
|
||||
copy_config "$CONFIGS/bat/config" "$HOME/.config/bat/config"
|
||||
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")
|
||||
}
|
||||
|
||||
install_docker_aliases() {
|
||||
e_info "\n[5/6] Docker aliases"
|
||||
install_docker() {
|
||||
e_info "\n[5/6] Docker"
|
||||
|
||||
if command_exists docker; then
|
||||
copy_config "$CONFIGS/aliases/.docker_aliases" "$HOME/.config/aliases/.docker_aliases"
|
||||
e_info " Installed Docker aliases"
|
||||
else
|
||||
e_warn " Docker not found — aliases installed anyway (will work once Docker is available)"
|
||||
copy_config "$CONFIGS/aliases/.docker_aliases" "$HOME/.config/aliases/.docker_aliases"
|
||||
sudo apt-get update -qq
|
||||
apt_install docker.io
|
||||
|
||||
if command_exists systemctl; then
|
||||
sudo systemctl enable --now docker 2>/dev/null \
|
||||
|| e_warn " Could not enable docker service — start manually: sudo systemctl start docker"
|
||||
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() {
|
||||
@@ -286,11 +308,6 @@ uninstall() {
|
||||
rm -f "$HOME/.config/bat/config"
|
||||
removed+=("bat-config")
|
||||
fi
|
||||
if [ -f "$HOME/.config/yazi/yazi.toml" ]; then
|
||||
rm -f "$HOME/.config/yazi/yazi.toml"
|
||||
removed+=("yazi-config")
|
||||
fi
|
||||
|
||||
# Zsh theme + zshrc
|
||||
if [ -f "$HOME/.config/zsh/zhann-elvis.zsh-theme" ]; then
|
||||
rm -f "$HOME/.config/zsh/zhann-elvis.zsh-theme"
|
||||
@@ -373,11 +390,11 @@ uninstall() {
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
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)"
|
||||
"Aliases + custom tools"
|
||||
"Terminal configs (bat, yazi)"
|
||||
"Docker aliases"
|
||||
"Terminal configs (bat)"
|
||||
"Docker (engine + aliases)"
|
||||
"Git config (delta pager)"
|
||||
)
|
||||
|
||||
@@ -386,7 +403,7 @@ INSTALLERS=(
|
||||
install_zsh
|
||||
install_aliases
|
||||
install_terminal_configs
|
||||
install_docker_aliases
|
||||
install_docker
|
||||
install_git_config
|
||||
)
|
||||
|
||||
@@ -398,7 +415,7 @@ show_menu() {
|
||||
done
|
||||
|
||||
while true; do
|
||||
clear
|
||||
safe_clear
|
||||
echo ""
|
||||
e_info "Server CLI Tools — Installer"
|
||||
echo "============================="
|
||||
|
||||
Reference in New Issue
Block a user