245 lines
6.8 KiB
Bash
245 lines
6.8 KiB
Bash
#!/bin/bash
|
|
|
|
# Arch Linux Terminal Utilities Module
|
|
# Handles modern CLI tools, terminal applications, and replacements
|
|
|
|
arch_install_terminal_base() {
|
|
if ! role_enabled "TERMINAL"; then
|
|
return 0
|
|
fi
|
|
|
|
log SECTION "Installing terminal base applications"
|
|
local section_start=$(date +%s)
|
|
|
|
if confirm "Install terminal applications (alacritty, tmux, etc.)?"; then
|
|
# Remove conflicting fonts
|
|
if package_installed gnu-free-fonts; then
|
|
sudo pacman --noconfirm -R gnu-free-fonts
|
|
fi
|
|
|
|
local terminal_packages=(
|
|
alacritty btop ranger tmux fd ttf-nerd-fonts-symbols
|
|
ttf-roboto-mono-nerd gdu bottom dysk
|
|
)
|
|
|
|
install_packages "${terminal_packages[@]}"
|
|
|
|
log SUCCESS "Terminal base applications installed $(show_timer $section_start)"
|
|
fi
|
|
}
|
|
|
|
arch_install_modern_replacements() {
|
|
if ! role_enabled "TERMINAL"; then
|
|
return 0
|
|
fi
|
|
|
|
log SECTION "Installing modern CLI replacements"
|
|
local section_start=$(date +%s)
|
|
|
|
if confirm "Install modern CLI tools (already installed via cargo)?"; then
|
|
# These are installed via cargo in development.sh
|
|
# Just verify they're available and set up aliases
|
|
|
|
local tools_to_check=("eza" "ripgrep" "fd" "zoxide" "starship")
|
|
local missing_tools=()
|
|
|
|
for tool in "${tools_to_check[@]}"; do
|
|
if ! command_exists "$tool"; then
|
|
missing_tools+=("$tool")
|
|
fi
|
|
done
|
|
|
|
if [ ${#missing_tools[@]} -gt 0 ]; then
|
|
log WARNING "Some modern CLI tools are missing: ${missing_tools[*]}"
|
|
log INFO "These will be installed via cargo in development setup"
|
|
else
|
|
log SUCCESS "All modern CLI tools are available"
|
|
fi
|
|
|
|
log SUCCESS "Modern CLI replacements verified $(show_timer $section_start)"
|
|
fi
|
|
}
|
|
|
|
arch_install_fzf() {
|
|
if ! role_enabled "TERMINAL"; then
|
|
return 0
|
|
fi
|
|
|
|
log SECTION "Installing fzf fuzzy finder"
|
|
local section_start=$(date +%s)
|
|
|
|
if confirm "Install fzf fuzzy finder?"; then
|
|
# Clean up any existing installation
|
|
rm -rf ~/.fzf
|
|
|
|
# Clone and install fzf
|
|
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
|
|
~/.fzf/install --all
|
|
|
|
# Source fzf for current session if possible
|
|
if [ -f ~/.fzf.bash ]; then
|
|
source ~/.fzf.bash
|
|
fi
|
|
|
|
log SUCCESS "fzf installed $(show_timer $section_start)"
|
|
fi
|
|
}
|
|
|
|
arch_setup_tmux() {
|
|
if ! role_enabled "TERMINAL"; then
|
|
return 0
|
|
fi
|
|
|
|
log SECTION "Setting up tmux"
|
|
local section_start=$(date +%s)
|
|
|
|
# tmux is already installed via terminal_packages
|
|
# Just link the configuration
|
|
ln -sf ~/linuxbox/tmux.conf ~/.tmux.conf
|
|
|
|
log SUCCESS "tmux configuration linked $(show_timer $section_start)"
|
|
}
|
|
|
|
arch_setup_alacritty() {
|
|
if ! role_enabled "TERMINAL"; then
|
|
return 0
|
|
fi
|
|
|
|
log SECTION "Setting up Alacritty terminal"
|
|
local section_start=$(date +%s)
|
|
|
|
# Create config directory and link configuration
|
|
mkdir -p ~/.config/alacritty
|
|
ln -sf ~/linuxbox/config/alacritty/alacritty.toml ~/.config/alacritty/alacritty.toml
|
|
|
|
log SUCCESS "Alacritty configuration linked $(show_timer $section_start)"
|
|
}
|
|
|
|
arch_setup_shell_config() {
|
|
if ! role_enabled "TERMINAL"; then
|
|
return 0
|
|
fi
|
|
|
|
log SECTION "Setting up shell configuration"
|
|
local section_start=$(date +%s)
|
|
|
|
# Link bash configuration
|
|
ln -sf ~/linuxbox/bashrc_arch ~/.bashrc
|
|
|
|
# Create local bin directory
|
|
mkdir -p ~/.local/bin
|
|
|
|
# Link utility scripts
|
|
ln -sf ~/linuxbox/start_nvim.sh ~/.local/bin/start_nvim
|
|
|
|
log SUCCESS "Shell configuration setup $(show_timer $section_start)"
|
|
}
|
|
|
|
arch_install_system_monitors() {
|
|
if ! role_enabled "TERMINAL"; then
|
|
return 0
|
|
fi
|
|
|
|
log SECTION "Installing system monitoring tools"
|
|
local section_start=$(date +%s)
|
|
|
|
if confirm "Install system monitoring tools (htop, iotop, etc.)?"; then
|
|
local monitor_packages=(
|
|
htop iotop nethogs bandwhich dust ncdu
|
|
)
|
|
|
|
# Only install packages that aren't already covered by modern replacements
|
|
local packages_to_install=()
|
|
for pkg in "${monitor_packages[@]}"; do
|
|
case "$pkg" in
|
|
"dust"|"ncdu")
|
|
# These might conflict with modern versions, check first
|
|
if ! command_exists "$pkg"; then
|
|
packages_to_install+=("$pkg")
|
|
fi
|
|
;;
|
|
*)
|
|
packages_to_install+=("$pkg")
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [ ${#packages_to_install[@]} -gt 0 ]; then
|
|
install_packages "${packages_to_install[@]}"
|
|
fi
|
|
|
|
log SUCCESS "System monitoring tools installed $(show_timer $section_start)"
|
|
fi
|
|
}
|
|
|
|
arch_install_network_tools() {
|
|
if ! role_enabled "TERMINAL"; then
|
|
return 0
|
|
fi
|
|
|
|
log SECTION "Installing network utilities"
|
|
local section_start=$(date +%s)
|
|
|
|
if confirm "Install network tools (wget, curl, etc.)?"; then
|
|
local network_packages=(
|
|
wget curl rsync openssh bind-tools whois nmap
|
|
)
|
|
|
|
install_packages "${network_packages[@]}"
|
|
|
|
log SUCCESS "Network tools installed $(show_timer $section_start)"
|
|
fi
|
|
}
|
|
|
|
arch_install_archive_tools() {
|
|
if ! role_enabled "TERMINAL"; then
|
|
return 0
|
|
fi
|
|
|
|
log SECTION "Installing archive and compression tools"
|
|
local section_start=$(date +%s)
|
|
|
|
if confirm "Install archive tools (zip, 7zip, etc.)?"; then
|
|
local archive_packages=(
|
|
zip unzip p7zip tar gzip bzip2 xz
|
|
)
|
|
|
|
install_packages "${archive_packages[@]}"
|
|
|
|
log SUCCESS "Archive tools installed $(show_timer $section_start)"
|
|
fi
|
|
}
|
|
|
|
arch_setup_locale() {
|
|
log SECTION "Setting up system locale"
|
|
local section_start=$(date +%s)
|
|
|
|
# Set locale
|
|
sudo localectl set-locale LANG=en_US.UTF-8
|
|
|
|
log SUCCESS "System locale configured $(show_timer $section_start)"
|
|
}
|
|
|
|
# Main function to run all terminal setup
|
|
arch_setup_terminal() {
|
|
if ! role_enabled "TERMINAL"; then
|
|
log INFO "Terminal role not enabled - skipping terminal setup"
|
|
return 0
|
|
fi
|
|
|
|
arch_setup_locale
|
|
arch_install_terminal_base
|
|
arch_install_modern_replacements
|
|
arch_install_fzf
|
|
arch_setup_tmux
|
|
arch_setup_alacritty
|
|
arch_setup_shell_config
|
|
arch_install_system_monitors
|
|
arch_install_network_tools
|
|
arch_install_archive_tools
|
|
}
|
|
|
|
# Source guard
|
|
if [ -z "$ARCH_TERMINAL_LOADED" ]; then
|
|
ARCH_TERMINAL_LOADED=true
|
|
fi |