mirror of
https://github.com/acedanger/shell.git
synced 2025-12-06 04:30:13 -08:00
Update local aliases configuration
This commit is contained in:
0
completions/backup-scripts-completion.bash
Normal file → Executable file
0
completions/backup-scripts-completion.bash
Normal file → Executable file
@@ -0,0 +1,43 @@
|
|||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
alias py=python3
|
||||||
|
alias gpull="git pull"
|
||||||
|
alias gpush="git push"
|
||||||
|
alias gc="git commit"
|
||||||
|
alias gcm="git commit -m"
|
||||||
|
|
||||||
|
alias ll="ls -laFh --group-directories-first --color=auto"
|
||||||
|
alias findzombie="ps -A -ostat,pid,ppid | grep -e '[zZ]'"
|
||||||
|
|
||||||
|
# 🌟 Eza aliases - Modern replacement for ls (conditionally enabled by setup.sh)
|
||||||
|
# These provide enhanced directory listing with icons, git status, and tree views
|
||||||
|
# The setup script will enable these dynamically if eza is available, otherwise traditional ls aliases are used
|
||||||
|
alias ls-eza="eza --color=auto --group-directories-first"
|
||||||
|
alias la-eza="eza -la --color=auto --group-directories-first"
|
||||||
|
alias ll-eza="eza -laFh --color=auto --group-directories-first"
|
||||||
|
alias l-eza="eza -1 --color=auto --group-directories-first"
|
||||||
|
alias lt="eza --tree --level=2 --color=auto --group-directories-first" # Tree view (2 levels)
|
||||||
|
alias llt="eza -la --tree --level=2 --color=auto --group-directories-first" # Long tree view
|
||||||
|
alias lg="eza -la --git --color=auto --group-directories-first" # Show git status
|
||||||
|
alias lh="eza -la --color=auto --group-directories-first --sort=size" # Sort by size
|
||||||
|
alias lr="eza -la --color=auto --group-directories-first --sort=modified" # Sort by modified
|
||||||
|
alias lx="eza -la --color=auto --group-directories-first --sort=extension" # Sort by extension
|
||||||
|
alias tree="eza --tree --color=auto --group-directories-first" # Tree alias
|
||||||
|
|
||||||
|
# 🎬 Plex Media Server Management - Sexy Edition
|
||||||
|
alias plex="/home/acedanger/shell/plex/plex.sh"
|
||||||
|
alias px="/home/acedanger/shell/plex/plex.sh" # Quick shortcut
|
||||||
|
alias plex-start="/home/acedanger/shell/plex/plex.sh start" # Start Plex
|
||||||
|
alias plex-stop="/home/acedanger/shell/plex/plex.sh stop" # Stop Plex
|
||||||
|
alias plex-restart="/home/acedanger/shell/plex/plex.sh restart" # Restart Plex
|
||||||
|
alias plex-status="/home/acedanger/shell/plex/plex.sh status" # Status check
|
||||||
|
alias plex-web="xdg-open http://localhost:32400/web" # Open web UI in browser
|
||||||
|
alias update="/home/acedanger/shell/update.sh"
|
||||||
|
alias dcdn="docker compose down"
|
||||||
|
alias dcupd="docker compose up -d"
|
||||||
|
alias dcpull="docker compose pull"
|
||||||
|
alias lzd="lazydocker"
|
||||||
|
alias cat="batcat"
|
||||||
|
alias fd="fdfind"
|
||||||
|
alias fzf="fzf --preview='batcat {}'"
|
||||||
|
>>>>>>> f7542cdb3fe600f7b5b09cb9c5bab173ec78697a
|
||||||
|
|||||||
@@ -4,21 +4,48 @@ alias gpush="git push"
|
|||||||
alias gc="git commit"
|
alias gc="git commit"
|
||||||
alias gcm="git commit -m"
|
alias gcm="git commit -m"
|
||||||
|
|
||||||
alias ll="ls -laFh --group-directories-first --color=auto"
|
|
||||||
alias findzombie="ps -A -ostat,pid,ppid | grep -e '[zZ]'"
|
alias findzombie="ps -A -ostat,pid,ppid | grep -e '[zZ]'"
|
||||||
|
|
||||||
|
# 🌟 Eza aliases - Modern replacement for ls (conditionally enabled by setup.sh)
|
||||||
|
# These provide enhanced directory listing with icons, git status, and tree views
|
||||||
|
# The setup script will enable these dynamically if eza is available, otherwise traditional ls aliases are used
|
||||||
|
alias la-eza="eza -la --color=auto --group-directories-first"
|
||||||
|
alias ll-eza="eza -laFh --color=auto --group-directories-first"
|
||||||
|
alias l-eza="eza -1 --color=auto --group-directories-first"
|
||||||
|
alias lt="eza --tree --level=2 --color=auto --group-directories-first" # Tree view (2 levels)
|
||||||
|
alias llt="eza -la --tree --level=2 --color=auto --group-directories-first" # Long tree view
|
||||||
|
alias lg="eza -la --git --color=auto --group-directories-first" # Show git status
|
||||||
|
alias lh="eza -la --color=auto --group-directories-first --sort=size" # Sort by size
|
||||||
|
alias lr="eza -la --color=auto --group-directories-first --sort=modified" # Sort by modified
|
||||||
|
alias lx="eza -la --color=auto --group-directories-first --sort=extension" # Sort by extension
|
||||||
|
alias tree="eza --tree --color=auto --group-directories-first" # Tree alias
|
||||||
|
|
||||||
# 🎬 Plex Media Server Management - Sexy Edition
|
# 🎬 Plex Media Server Management - Sexy Edition
|
||||||
alias plex="/home/acedanger/shell/plex/plex.sh"
|
alias plex="/home/acedanger/shell/plex/plex.sh"
|
||||||
alias px="/home/acedanger/shell/plex/plex.sh" # Quick shortcut
|
alias px="/home/acedanger/shell/plex/plex.sh" # Quick shortcut
|
||||||
alias plex-start="/home/acedanger/shell/plex/plex.sh start" # Start Plex
|
alias plex-start="/home/acedanger/shell/plex/plex.sh start" # Start Plex
|
||||||
alias plex-stop="/home/acedanger/shell/plex/plex.sh stop" # Stop Plex
|
alias plex-stop="/home/acedanger/shell/plex/plex.sh stop" # Stop Plex
|
||||||
alias plex-restart="/home/acedanger/shell/plex.sh restart" # Restart Plex
|
alias plex-restart="/home/acedanger/shell/plex/plex.sh restart" # Restart Plex
|
||||||
alias plex-status="/home/acedanger/shell/plex.sh status" # Status check
|
alias plex-status="/home/acedanger/shell/plex/plex.sh status" # Status check
|
||||||
alias plex-web="xdg-open http://localhost:32400/web" # Open web UI in browser
|
alias plex-web="xdg-open http://localhost:32400/web" # Open web UI in browser
|
||||||
alias update="/home/acedanger/shell/update.sh"
|
alias update="/home/acedanger/shell/update.sh"
|
||||||
alias dcdn="docker compose down"
|
alias dcdn="docker compose down"
|
||||||
alias dcupd="docker compose up -d"
|
alias dcupd="docker compose up -d"
|
||||||
alias dcpull="docker compose pull"
|
alias dcpull="docker compose pull"
|
||||||
alias lzd="lazydocker"
|
alias lzd="lazydocker"
|
||||||
alias cat="batcat"
|
alias cat="bat"
|
||||||
alias fd="fdfind"
|
alias fd="fd"
|
||||||
alias fzf="fzf --preview='batcat {}'"
|
alias fzf="fzf --preview='bat {}'"
|
||||||
|
|
||||||
|
# 🌟 Eza aliases - Modern replacement for ls
|
||||||
|
alias ls="eza --color=auto --group-directories-first"
|
||||||
|
alias la="eza -la --color=auto --group-directories-first"
|
||||||
|
alias ll="eza -laFh --color=auto --group-directories-first"
|
||||||
|
alias l="eza -1 --color=auto --group-directories-first"
|
||||||
|
alias lt="eza --tree --level=2 --color=auto --group-directories-first"
|
||||||
|
alias llt="eza -la --tree --level=2 --color=auto --group-directories-first"
|
||||||
|
alias lg="eza -la --git --color=auto --group-directories-first"
|
||||||
|
alias lh="eza -la --color=auto --group-directories-first --sort=size"
|
||||||
|
alias lr="eza -la --color=auto --group-directories-first --sort=modified"
|
||||||
|
alias lx="eza -la --color=auto --group-directories-first --sort=extension"
|
||||||
|
alias tree="eza --tree --color=auto --group-directories-first"
|
||||||
|
|||||||
@@ -47,6 +47,12 @@ if ! command -v git &>/dev/null; then
|
|||||||
sudo nala install -y git
|
sudo nala install -y git
|
||||||
;;
|
;;
|
||||||
dnf)
|
dnf)
|
||||||
|
# Enable COPR repositories for Fedora before installing packages
|
||||||
|
if [ "$OS_NAME" = "fedora" ]; then
|
||||||
|
echo -e "${YELLOW}Setting up COPR repositories for Fedora...${NC}"
|
||||||
|
sudo dnf copr enable -y alternateved/eza 2>/dev/null || echo -e "${YELLOW}Eza COPR repo already enabled or unavailable${NC}"
|
||||||
|
sudo dnf copr enable -y shaps/lazygit 2>/dev/null || echo -e "${YELLOW}Lazygit COPR repo already enabled or unavailable${NC}"
|
||||||
|
fi
|
||||||
sudo dnf install -y git
|
sudo dnf install -y git
|
||||||
;;
|
;;
|
||||||
apt)
|
apt)
|
||||||
|
|||||||
@@ -9,3 +9,6 @@ fzf
|
|||||||
zsh
|
zsh
|
||||||
nala
|
nala
|
||||||
fd-find
|
fd-find
|
||||||
|
lazygit
|
||||||
|
lazydocker
|
||||||
|
eza
|
||||||
137
setup/setup.sh
137
setup/setup.sh
@@ -39,7 +39,7 @@ determine_pkg_manager() {
|
|||||||
|
|
||||||
# Set up package management based on OS
|
# Set up package management based on OS
|
||||||
if [ "$OS_NAME" = "fedora" ]; then
|
if [ "$OS_NAME" = "fedora" ]; then
|
||||||
echo -e "${YELLOW}Setting up Fedora Tsrepositories and package management...${NC}"
|
echo -e "${YELLOW}Setting up Fedora repositories and package management...${NC}"
|
||||||
|
|
||||||
# Install prerequisites for Fedora
|
# Install prerequisites for Fedora
|
||||||
sudo dnf install -y wget gpg
|
sudo dnf install -y wget gpg
|
||||||
@@ -55,6 +55,14 @@ if [ "$OS_NAME" = "fedora" ]; then
|
|||||||
# Use a different approach to add the GitHub CLI repo to avoid the "--add-repo" error
|
# Use a different approach to add the GitHub CLI repo to avoid the "--add-repo" error
|
||||||
sudo curl -fsSL https://cli.github.com/packages/rpm/gh-cli.repo -o /etc/yum.repos.d/gh-cli.repo
|
sudo curl -fsSL https://cli.github.com/packages/rpm/gh-cli.repo -o /etc/yum.repos.d/gh-cli.repo
|
||||||
|
|
||||||
|
# Setup COPR repository for eza
|
||||||
|
echo -e "${YELLOW}Setting up COPR repository for eza...${NC}"
|
||||||
|
sudo dnf copr enable -y alternateved/eza
|
||||||
|
|
||||||
|
# Setup COPR repository for lazygit
|
||||||
|
echo -e "${YELLOW}Setting up COPR repository for lazygit...${NC}"
|
||||||
|
sudo dnf copr enable -y shaps/lazygit
|
||||||
|
|
||||||
# Update package lists
|
# Update package lists
|
||||||
echo -e "${YELLOW}Updating package lists for Fedora...${NC}"
|
echo -e "${YELLOW}Updating package lists for Fedora...${NC}"
|
||||||
sudo dnf check-update -y || true
|
sudo dnf check-update -y || true
|
||||||
@@ -90,6 +98,19 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Setup eza repository for Ubuntu/Debian
|
||||||
|
echo -e "${YELLOW}Setting up eza repository...${NC}"
|
||||||
|
if ! apt-cache show eza &>/dev/null; then
|
||||||
|
# Add eza repository for older Ubuntu/Debian versions
|
||||||
|
echo -e "${YELLOW}Adding eza repository...${NC}"
|
||||||
|
sudo mkdir -p -m 755 /etc/apt/keyrings
|
||||||
|
wget -qO- https://raw.githubusercontent.com/eza-community/eza/main/deb.asc | sudo gpg --dearmor -o /etc/apt/keyrings/gierens.gpg
|
||||||
|
echo "deb [signed-by=/etc/apt/keyrings/gierens.gpg] http://deb.gierens.de stable main" | sudo tee /etc/apt/sources.list.d/gierens.list
|
||||||
|
sudo chmod 644 /etc/apt/keyrings/gierens.gpg /etc/apt/sources.list.d/gierens.list
|
||||||
|
else
|
||||||
|
echo -e "${GREEN}Eza is available in standard repositories${NC}"
|
||||||
|
fi
|
||||||
|
|
||||||
# Setup VS Code repository
|
# Setup VS Code repository
|
||||||
echo -e "${YELLOW}Setting up VS Code repository...${NC}"
|
echo -e "${YELLOW}Setting up VS Code repository...${NC}"
|
||||||
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /tmp/packages.microsoft.gpg
|
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /tmp/packages.microsoft.gpg
|
||||||
@@ -136,16 +157,34 @@ mapfile -t pkgs < <(grep -v '^//' "$SCRIPT_DIR/packages.list" | grep -v -e '^$')
|
|||||||
declare -A fedora_pkg_map
|
declare -A fedora_pkg_map
|
||||||
fedora_pkg_map["bat"]="bat"
|
fedora_pkg_map["bat"]="bat"
|
||||||
fedora_pkg_map["fd-find"]="fd" # On Fedora, the package is called 'fd'
|
fedora_pkg_map["fd-find"]="fd" # On Fedora, the package is called 'fd'
|
||||||
|
# eza is available from COPR repository
|
||||||
|
fedora_pkg_map["eza"]="eza"
|
||||||
|
# lazygit is available from COPR repository
|
||||||
|
fedora_pkg_map["lazygit"]="lazygit"
|
||||||
|
# lazydocker will be installed manually from GitHub releases
|
||||||
# Add more package mappings as needed
|
# Add more package mappings as needed
|
||||||
|
|
||||||
# Process the package list based on OS
|
# Process the package list based on OS
|
||||||
install_pkg_list=()
|
install_pkg_list=()
|
||||||
|
special_installs=()
|
||||||
for pkg in "${pkgs[@]}"; do
|
for pkg in "${pkgs[@]}"; do
|
||||||
# Skip nala package on non-Debian/Ubuntu systems
|
# Skip nala package on non-Debian/Ubuntu systems
|
||||||
if [ "$pkg" = "nala" ] && [ "$OS_NAME" != "ubuntu" ] && [ "$OS_NAME" != "debian" ]; then
|
if [ "$pkg" = "nala" ] && [ "$OS_NAME" != "ubuntu" ] && [ "$OS_NAME" != "debian" ]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Handle packages that need special installation
|
||||||
|
if [ "$pkg" = "lazydocker" ]; then
|
||||||
|
special_installs+=("$pkg")
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Handle lazygit - available in COPR for Fedora, special install for Debian/Ubuntu
|
||||||
|
if [ "$pkg" = "lazygit" ] && [ "$OS_NAME" != "fedora" ]; then
|
||||||
|
special_installs+=("$pkg")
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if we need to map the package name for Fedora
|
# Check if we need to map the package name for Fedora
|
||||||
if [ "$OS_NAME" = "fedora" ] && [[ -n "${fedora_pkg_map[$pkg]}" ]]; then
|
if [ "$OS_NAME" = "fedora" ] && [[ -n "${fedora_pkg_map[$pkg]}" ]]; then
|
||||||
install_pkg_list+=("${fedora_pkg_map[$pkg]}")
|
install_pkg_list+=("${fedora_pkg_map[$pkg]}")
|
||||||
@@ -189,6 +228,44 @@ esac
|
|||||||
|
|
||||||
echo -e "${GREEN}Package installation completed for $OS_NAME $OS_VERSION.${NC}"
|
echo -e "${GREEN}Package installation completed for $OS_NAME $OS_VERSION.${NC}"
|
||||||
|
|
||||||
|
# Handle special installations that aren't available through package managers
|
||||||
|
echo -e "${YELLOW}Installing special packages...${NC}"
|
||||||
|
for pkg in "${special_installs[@]}"; do
|
||||||
|
case $pkg in
|
||||||
|
"lazydocker")
|
||||||
|
if ! command -v lazydocker &> /dev/null; then
|
||||||
|
echo -e "${YELLOW}Installing Lazydocker from GitHub releases...${NC}"
|
||||||
|
LAZYDOCKER_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazydocker/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
|
||||||
|
curl -Lo lazydocker.tar.gz "https://github.com/jesseduffield/lazydocker/releases/latest/download/lazydocker_${LAZYDOCKER_VERSION}_Linux_x86_64.tar.gz"
|
||||||
|
mkdir -p lazydocker-temp
|
||||||
|
tar xf lazydocker.tar.gz -C lazydocker-temp
|
||||||
|
sudo mv lazydocker-temp/lazydocker /usr/local/bin
|
||||||
|
rm -rf lazydocker-temp lazydocker.tar.gz
|
||||||
|
echo -e "${GREEN}Lazydocker installed successfully!${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${GREEN}Lazydocker is already installed${NC}"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"lazygit")
|
||||||
|
if ! command -v lazygit &> /dev/null; then
|
||||||
|
echo -e "${YELLOW}Installing Lazygit from GitHub releases...${NC}"
|
||||||
|
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
|
||||||
|
curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
|
||||||
|
mkdir -p lazygit-temp
|
||||||
|
tar xf lazygit.tar.gz -C lazygit-temp
|
||||||
|
sudo mv lazygit-temp/lazygit /usr/local/bin
|
||||||
|
rm -rf lazygit-temp lazygit.tar.gz
|
||||||
|
echo -e "${GREEN}Lazygit installed successfully!${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${GREEN}Lazygit is already installed${NC}"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo -e "${YELLOW}Unknown special package: $pkg${NC}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
# Install Zsh if not already installed
|
# Install Zsh if not already installed
|
||||||
echo -e "${YELLOW}Installing Zsh...${NC}"
|
echo -e "${YELLOW}Installing Zsh...${NC}"
|
||||||
if ! command -v zsh &> /dev/null; then
|
if ! command -v zsh &> /dev/null; then
|
||||||
@@ -247,20 +324,6 @@ else
|
|||||||
echo -e "${YELLOW}Warning: nvm installation may require a new shell session${NC}"
|
echo -e "${YELLOW}Warning: nvm installation may require a new shell session${NC}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install Lazydocker (not available in apt repositories)
|
|
||||||
echo -e "${YELLOW}Installing Lazydocker...${NC}"
|
|
||||||
if ! command -v lazydocker &> /dev/null; then
|
|
||||||
LAZYDOCKER_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazydocker/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
|
|
||||||
curl -Lo lazydocker.tar.gz "https://github.com/jesseduffield/lazydocker/releases/latest/download/lazydocker_${LAZYDOCKER_VERSION}_Linux_x86_64.tar.gz"
|
|
||||||
mkdir -p lazydocker-temp
|
|
||||||
tar xf lazydocker.tar.gz -C lazydocker-temp
|
|
||||||
sudo mv lazydocker-temp/lazydocker /usr/local/bin
|
|
||||||
rm -rf lazydocker-temp lazydocker.tar.gz
|
|
||||||
echo -e "${GREEN}Lazydocker installed successfully!${NC}"
|
|
||||||
else
|
|
||||||
echo -e "Lazydocker is already installed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Define a reusable function for cloning Zsh plugins
|
# Define a reusable function for cloning Zsh plugins
|
||||||
clone_zsh_plugin() {
|
clone_zsh_plugin() {
|
||||||
local plugin_url=$1
|
local plugin_url=$1
|
||||||
@@ -285,13 +348,13 @@ COMPLETION_SCRIPT="$DOTFILES_DIR/completions/backup-scripts-completion.bash"
|
|||||||
if [ -f "$COMPLETION_SCRIPT" ]; then
|
if [ -f "$COMPLETION_SCRIPT" ]; then
|
||||||
# Create completions directory in home
|
# Create completions directory in home
|
||||||
mkdir -p "$HOME/.local/share/bash-completion/completions"
|
mkdir -p "$HOME/.local/share/bash-completion/completions"
|
||||||
|
|
||||||
# Copy completion script to user's completion directory
|
# Copy completion script to user's completion directory
|
||||||
cp "$COMPLETION_SCRIPT" "$HOME/.local/share/bash-completion/completions/"
|
cp "$COMPLETION_SCRIPT" "$HOME/.local/share/bash-completion/completions/"
|
||||||
|
|
||||||
# Make sure it's executable
|
# Make sure it's executable
|
||||||
chmod +x "$HOME/.local/share/bash-completion/completions/backup-scripts-completion.bash"
|
chmod +x "$HOME/.local/share/bash-completion/completions/backup-scripts-completion.bash"
|
||||||
|
|
||||||
echo -e "${GREEN}Bash completion script installed successfully!${NC}"
|
echo -e "${GREEN}Bash completion script installed successfully!${NC}"
|
||||||
else
|
else
|
||||||
echo -e "${YELLOW}Warning: Bash completion script not found at $COMPLETION_SCRIPT${NC}"
|
echo -e "${YELLOW}Warning: Bash completion script not found at $COMPLETION_SCRIPT${NC}"
|
||||||
@@ -314,8 +377,14 @@ mkdir -p "$ZSH_CUSTOM"
|
|||||||
# Create a copy of the original aliases file for backup
|
# Create a copy of the original aliases file for backup
|
||||||
cp "$DOTFILES_SUBDIR/my-aliases.zsh" "$ALIASES_FILE.bak"
|
cp "$DOTFILES_SUBDIR/my-aliases.zsh" "$ALIASES_FILE.bak"
|
||||||
|
|
||||||
# First, copy all general aliases except those we'll modify based on OS
|
# First, copy all general aliases except those we'll modify based on OS and available commands
|
||||||
grep -v "alias cat=" "$DOTFILES_SUBDIR/my-aliases.zsh" | grep -v "alias fd=" | grep -v "alias fzf=" > "$ALIASES_FILE"
|
grep -v "^alias cat=" "$DOTFILES_SUBDIR/my-aliases.zsh" | \
|
||||||
|
grep -v "^alias fd=" | \
|
||||||
|
grep -v "^alias fzf=" | \
|
||||||
|
grep -v "^alias ls=" | \
|
||||||
|
grep -v "^alias ll=" | \
|
||||||
|
grep -v "^alias la=" | \
|
||||||
|
grep -v "^alias l=" > "$ALIASES_FILE"
|
||||||
|
|
||||||
# Function to check for command existence and add appropriate alias
|
# Function to check for command existence and add appropriate alias
|
||||||
add_conditional_alias() {
|
add_conditional_alias() {
|
||||||
@@ -360,6 +429,34 @@ if command -v fzf &> /dev/null; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Set up eza aliases if eza is available
|
||||||
|
if command -v eza &> /dev/null; then
|
||||||
|
echo -e "${YELLOW}Setting up eza aliases...${NC}"
|
||||||
|
cat >> "$ALIASES_FILE" << 'EOF'
|
||||||
|
|
||||||
|
# 🌟 Eza aliases - Modern replacement for ls
|
||||||
|
alias ls="eza --color=auto --group-directories-first"
|
||||||
|
alias la="eza -la --color=auto --group-directories-first"
|
||||||
|
alias ll="eza -laFh --color=auto --group-directories-first"
|
||||||
|
alias l="eza -1 --color=auto --group-directories-first"
|
||||||
|
alias lt="eza --tree --level=2 --color=auto --group-directories-first"
|
||||||
|
alias llt="eza -la --tree --level=2 --color=auto --group-directories-first"
|
||||||
|
alias lg="eza -la --git --color=auto --group-directories-first"
|
||||||
|
alias lh="eza -la --color=auto --group-directories-first --sort=size"
|
||||||
|
alias lr="eza -la --color=auto --group-directories-first --sort=modified"
|
||||||
|
alias lx="eza -la --color=auto --group-directories-first --sort=extension"
|
||||||
|
alias tree="eza --tree --color=auto --group-directories-first"
|
||||||
|
EOF
|
||||||
|
echo -e "${GREEN}Eza aliases configured successfully!${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW}Eza not found. Using traditional ls aliases.${NC}"
|
||||||
|
cat >> "$ALIASES_FILE" << 'EOF'
|
||||||
|
|
||||||
|
# Traditional ls aliases
|
||||||
|
alias ll="ls -laFh --group-directories-first --color=auto"
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
# Also create a symlink from the custom aliases file back to the dotfiles directory for persistence
|
# Also create a symlink from the custom aliases file back to the dotfiles directory for persistence
|
||||||
# This allows changes made to aliases.zsh to be tracked in the dotfiles repo
|
# This allows changes made to aliases.zsh to be tracked in the dotfiles repo
|
||||||
echo -e "${YELLOW}Creating symlink to save customized aliases back to dotfiles...${NC}"
|
echo -e "${YELLOW}Creating symlink to save customized aliases back to dotfiles...${NC}"
|
||||||
|
|||||||
@@ -17,18 +17,20 @@ MAX_INSTALL_ATTEMPTS=3
|
|||||||
CURRENT_ATTEMPT=1
|
CURRENT_ATTEMPT=1
|
||||||
|
|
||||||
# Log file
|
# Log file
|
||||||
# C log_both "\n${BLUE}Debugging lolcat package:${NC}" "Debugging lolcat package:"
|
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
||||||
if [ -f "/usr/games/lolcat" ]; then
|
CONTAINER_INFO=""
|
||||||
log_both "- Lolcat found at /usr/games/lolcat"
|
if [ -f /.dockerenv ]; then
|
||||||
ls -la /usr/games/lolcat >> "$LOG_FILE"
|
# We're in a container, try to get container info
|
||||||
else
|
if [ -f /etc/os-release ]; then
|
||||||
log_both "- Lolcat not found at /usr/games/lolcat"
|
CONTAINER_INFO="$(grep '^ID=' /etc/os-release | cut -d'=' -f2 | tr -d '"')-"
|
||||||
fi
|
fi
|
||||||
if check_command lolcat; then
|
fi
|
||||||
log_both "- Lolcat found in PATH"
|
|
||||||
command -v lolcat >> "$LOG_FILE"
|
# Create logs directory if it doesn't exist
|
||||||
else
|
LOGS_DIR="/tmp"
|
||||||
log_both "- Lolcat not found in PATH"
|
if [ ! -d "$LOGS_DIR" ]; then
|
||||||
|
mkdir -p "$LOGS_DIR"
|
||||||
|
fi
|
||||||
firectory if it doesn't exist and is writable
|
firectory if it doesn't exist and is writable
|
||||||
# First, try creating the logs directory in case it doesn't exist
|
# First, try creating the logs directory in case it doesn't exist
|
||||||
if [ -d "/logs" ] || mkdir -p /logs 2>/dev/null; then
|
if [ -d "/logs" ] || mkdir -p /logs 2>/dev/null; then
|
||||||
@@ -68,10 +70,10 @@ echo "Starting setup test at $(date)" > "$LOG_FILE" || {
|
|||||||
log_both() {
|
log_both() {
|
||||||
local colored_message="$1"
|
local colored_message="$1"
|
||||||
local clean_message="$2"
|
local clean_message="$2"
|
||||||
|
|
||||||
# Display colored message to terminal
|
# Display colored message to terminal
|
||||||
echo -e "$colored_message"
|
echo -e "$colored_message"
|
||||||
|
|
||||||
# Log clean message to file
|
# Log clean message to file
|
||||||
if [ -n "$clean_message" ]; then
|
if [ -n "$clean_message" ]; then
|
||||||
echo "$clean_message" >> "$LOG_FILE"
|
echo "$clean_message" >> "$LOG_FILE"
|
||||||
@@ -134,9 +136,9 @@ test_package() {
|
|||||||
local pkg=$1
|
local pkg=$1
|
||||||
local cmd=${2:-$1}
|
local cmd=${2:-$1}
|
||||||
local alt_cmd=$3 # Optional alternative command name
|
local alt_cmd=$3 # Optional alternative command name
|
||||||
|
|
||||||
echo -en "Testing if $pkg is installed... "
|
echo -en "Testing if $pkg is installed... "
|
||||||
|
|
||||||
# Special case for cowsay and lolcat which might be in different paths
|
# Special case for cowsay and lolcat which might be in different paths
|
||||||
if [ "$pkg" = "cowsay" ]; then
|
if [ "$pkg" = "cowsay" ]; then
|
||||||
if check_command "$cmd"; then
|
if check_command "$cmd"; then
|
||||||
@@ -208,7 +210,7 @@ test_file_exists() {
|
|||||||
# Get actual package name based on distribution
|
# Get actual package name based on distribution
|
||||||
get_package_name() {
|
get_package_name() {
|
||||||
local pkg=$1
|
local pkg=$1
|
||||||
|
|
||||||
# Handle Debian-specific package name differences
|
# Handle Debian-specific package name differences
|
||||||
if [[ "$ID" == "debian" ]]; then
|
if [[ "$ID" == "debian" ]]; then
|
||||||
case "$pkg" in
|
case "$pkg" in
|
||||||
@@ -230,16 +232,16 @@ install_missing_packages() {
|
|||||||
local packages=("$@")
|
local packages=("$@")
|
||||||
local install_cmd_name
|
local install_cmd_name
|
||||||
local install_cmd=()
|
local install_cmd=()
|
||||||
|
|
||||||
if [ ${#packages[@]} -eq 0 ]; then
|
if [ ${#packages[@]} -eq 0 ]; then
|
||||||
echo -e "${GREEN}No packages to install${NC}"
|
echo -e "${GREEN}No packages to install${NC}"
|
||||||
echo "No packages to install" >> "$LOG_FILE"
|
echo "No packages to install" >> "$LOG_FILE"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\n${BLUE}=== Installing missing packages (Attempt $CURRENT_ATTEMPT of $MAX_INSTALL_ATTEMPTS) ===${NC}"
|
echo -e "\n${BLUE}=== Installing missing packages (Attempt $CURRENT_ATTEMPT of $MAX_INSTALL_ATTEMPTS) ===${NC}"
|
||||||
echo "=== Installing missing packages (Attempt $CURRENT_ATTEMPT of $MAX_INSTALL_ATTEMPTS) ===" >> "$LOG_FILE"
|
echo "=== Installing missing packages (Attempt $CURRENT_ATTEMPT of $MAX_INSTALL_ATTEMPTS) ===" >> "$LOG_FILE"
|
||||||
|
|
||||||
# Determine the best installation command
|
# Determine the best installation command
|
||||||
if check_command nala; then
|
if check_command nala; then
|
||||||
install_cmd=(sudo DEBIAN_FRONTEND=noninteractive nala install -y)
|
install_cmd=(sudo DEBIAN_FRONTEND=noninteractive nala install -y)
|
||||||
@@ -252,14 +254,14 @@ install_missing_packages() {
|
|||||||
echo -e "${YELLOW}Using apt-get for package installation${NC}"
|
echo -e "${YELLOW}Using apt-get for package installation${NC}"
|
||||||
echo "Using apt-get for package installation" >> "$LOG_FILE"
|
echo "Using apt-get for package installation" >> "$LOG_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Convert package list to distribution-specific names
|
# Convert package list to distribution-specific names
|
||||||
local install_list=()
|
local install_list=()
|
||||||
for pkg in "${packages[@]}"; do
|
for pkg in "${packages[@]}"; do
|
||||||
local actual_pkg=$(get_package_name "$pkg")
|
local actual_pkg=$(get_package_name "$pkg")
|
||||||
install_list+=("$actual_pkg")
|
install_list+=("$actual_pkg")
|
||||||
done
|
done
|
||||||
|
|
||||||
# Update package lists
|
# Update package lists
|
||||||
echo -e "${YELLOW}Updating package lists...${NC}"
|
echo -e "${YELLOW}Updating package lists...${NC}"
|
||||||
echo "Updating package lists" >> "$LOG_FILE"
|
echo "Updating package lists" >> "$LOG_FILE"
|
||||||
@@ -270,30 +272,30 @@ install_missing_packages() {
|
|||||||
echo -e "${GREEN}Running: sudo DEBIAN_FRONTEND=noninteractive apt-get update${NC}"
|
echo -e "${GREEN}Running: sudo DEBIAN_FRONTEND=noninteractive apt-get update${NC}"
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update | tee -a "$LOG_FILE"
|
sudo DEBIAN_FRONTEND=noninteractive apt-get update | tee -a "$LOG_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install packages
|
# Install packages
|
||||||
echo -e "${YELLOW}Installing packages: ${install_list[*]}${NC}"
|
echo -e "${YELLOW}Installing packages: ${install_list[*]}${NC}"
|
||||||
echo "Installing packages: ${install_list[*]}" >> "$LOG_FILE"
|
echo "Installing packages: ${install_list[*]}" >> "$LOG_FILE"
|
||||||
|
|
||||||
# Show the exact command being run for debugging
|
# Show the exact command being run for debugging
|
||||||
echo -e "${BLUE}Running: ${install_cmd[*]} ${install_list[*]}${NC}"
|
echo -e "${BLUE}Running: ${install_cmd[*]} ${install_list[*]}${NC}"
|
||||||
|
|
||||||
# Execute the install command with the package list
|
# Execute the install command with the package list
|
||||||
if ! "${install_cmd[@]}" "${install_list[@]}" 2>&1 | tee -a "$LOG_FILE"; then
|
if ! "${install_cmd[@]}" "${install_list[@]}" 2>&1 | tee -a "$LOG_FILE"; then
|
||||||
echo -e "${RED}Failed to install some packages. Check the log for details.${NC}"
|
echo -e "${RED}Failed to install some packages. Check the log for details.${NC}"
|
||||||
echo "Failed to install some packages" >> "$LOG_FILE"
|
echo "Failed to install some packages" >> "$LOG_FILE"
|
||||||
|
|
||||||
# Try to install packages one by one to identify problematic ones
|
# Try to install packages one by one to identify problematic ones
|
||||||
echo -e "${YELLOW}Trying to install packages individually...${NC}"
|
echo -e "${YELLOW}Trying to install packages individually...${NC}"
|
||||||
echo "Trying to install packages individually" >> "$LOG_FILE"
|
echo "Trying to install packages individually" >> "$LOG_FILE"
|
||||||
|
|
||||||
installed_this_round=()
|
installed_this_round=()
|
||||||
local failed_this_round=()
|
local failed_this_round=()
|
||||||
|
|
||||||
for i in "${!packages[@]}"; do
|
for i in "${!packages[@]}"; do
|
||||||
local pkg="${packages[$i]}"
|
local pkg="${packages[$i]}"
|
||||||
local actual_pkg="${install_list[$i]}"
|
local actual_pkg="${install_list[$i]}"
|
||||||
|
|
||||||
echo -en "Installing $pkg as $actual_pkg... "
|
echo -en "Installing $pkg as $actual_pkg... "
|
||||||
if "${install_cmd[@]}" "$actual_pkg" >> "$LOG_FILE" 2>&1; then
|
if "${install_cmd[@]}" "$actual_pkg" >> "$LOG_FILE" 2>&1; then
|
||||||
echo -e "${GREEN}✓${NC}"
|
echo -e "${GREEN}✓${NC}"
|
||||||
@@ -305,7 +307,7 @@ install_missing_packages() {
|
|||||||
failed_this_round+=("$pkg")
|
failed_this_round+=("$pkg")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
failed_packages=("${failed_this_round[@]}")
|
failed_packages=("${failed_this_round[@]}")
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
@@ -391,10 +393,10 @@ fi
|
|||||||
if [ -f "$HOME/shell/setup/packages.list" ]; then
|
if [ -f "$HOME/shell/setup/packages.list" ]; then
|
||||||
echo -e "${YELLOW}Testing package availability in repositories:${NC}"
|
echo -e "${YELLOW}Testing package availability in repositories:${NC}"
|
||||||
echo "Testing package availability:" >> "$LOG_FILE"
|
echo "Testing package availability:" >> "$LOG_FILE"
|
||||||
|
|
||||||
# Exclude commented lines and empty lines
|
# Exclude commented lines and empty lines
|
||||||
packages=$(grep -v '^//' "$HOME/shell/setup/packages.list" | grep -v -e '^$')
|
packages=$(grep -v '^//' "$HOME/shell/setup/packages.list" | grep -v -e '^$')
|
||||||
|
|
||||||
for pkg in $packages; do
|
for pkg in $packages; do
|
||||||
echo -en "Checking if $pkg is available in repos... "
|
echo -en "Checking if $pkg is available in repos... "
|
||||||
actual_pkg=$(get_package_name "$pkg")
|
actual_pkg=$(get_package_name "$pkg")
|
||||||
@@ -441,7 +443,7 @@ while [ $CURRENT_ATTEMPT -le $MAX_INSTALL_ATTEMPTS ]; do
|
|||||||
if [ -f "$HOME/shell/setup/packages.list" ]; then
|
if [ -f "$HOME/shell/setup/packages.list" ]; then
|
||||||
# Exclude commented lines and empty lines
|
# Exclude commented lines and empty lines
|
||||||
packages=$(grep -v '^//' "$HOME/shell/setup/packages.list" | grep -v -e '^$')
|
packages=$(grep -v '^//' "$HOME/shell/setup/packages.list" | grep -v -e '^$')
|
||||||
|
|
||||||
for pkg in $packages; do
|
for pkg in $packages; do
|
||||||
case "$pkg" in
|
case "$pkg" in
|
||||||
"bat")
|
"bat")
|
||||||
@@ -465,7 +467,7 @@ while [ $CURRENT_ATTEMPT -le $MAX_INSTALL_ATTEMPTS ]; do
|
|||||||
else
|
else
|
||||||
log_both "- Cowsay not found in PATH"
|
log_both "- Cowsay not found in PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! test_package "cowsay" "cowsay"; then
|
if ! test_package "cowsay" "cowsay"; then
|
||||||
((errors++))
|
((errors++))
|
||||||
missing_packages+=("$pkg")
|
missing_packages+=("$pkg")
|
||||||
@@ -486,7 +488,7 @@ while [ $CURRENT_ATTEMPT -le $MAX_INSTALL_ATTEMPTS ]; do
|
|||||||
else
|
else
|
||||||
echo -e "- Lolcat not found in PATH" | tee -a "$LOG_FILE"
|
echo -e "- Lolcat not found in PATH" | tee -a "$LOG_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! test_package "lolcat" "lolcat"; then
|
if ! test_package "lolcat" "lolcat"; then
|
||||||
((errors++))
|
((errors++))
|
||||||
missing_packages+=("$pkg")
|
missing_packages+=("$pkg")
|
||||||
@@ -500,24 +502,24 @@ while [ $CURRENT_ATTEMPT -le $MAX_INSTALL_ATTEMPTS ]; do
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Report missing packages
|
# Report missing packages
|
||||||
if [ ${#missing_packages[@]} -gt 0 ]; then
|
if [ ${#missing_packages[@]} -gt 0 ]; then
|
||||||
echo -e "\n${YELLOW}Missing packages:${NC}"
|
echo -e "\n${YELLOW}Missing packages:${NC}"
|
||||||
for pkg in "${missing_packages[@]}"; do
|
for pkg in "${missing_packages[@]}"; do
|
||||||
echo -e "- ${RED}$pkg${NC}"
|
echo -e "- ${RED}$pkg${NC}"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Count installed vs. total packages
|
# Count installed vs. total packages
|
||||||
total_pkgs=$(grep -v '^//' "$HOME/shell/setup/packages.list" | grep -v -e '^$' | wc -l)
|
total_pkgs=$(grep -v '^//' "$HOME/shell/setup/packages.list" | grep -v -e '^$' | wc -l)
|
||||||
installed_pkgs=$((total_pkgs - ${#missing_packages[@]}))
|
installed_pkgs=$((total_pkgs - ${#missing_packages[@]}))
|
||||||
echo -e "${GREEN}$installed_pkgs of $total_pkgs packages installed${NC} (${YELLOW}${#missing_packages[@]} missing${NC})"
|
echo -e "${GREEN}$installed_pkgs of $total_pkgs packages installed${NC} (${YELLOW}${#missing_packages[@]} missing${NC})"
|
||||||
echo "$installed_pkgs of $total_pkgs packages installed (${#missing_packages[@]} missing)" >> "$LOG_FILE"
|
echo "$installed_pkgs of $total_pkgs packages installed (${#missing_packages[@]} missing)" >> "$LOG_FILE"
|
||||||
|
|
||||||
# Install missing packages if we haven't reached the maximum attempts
|
# Install missing packages if we haven't reached the maximum attempts
|
||||||
if [ $CURRENT_ATTEMPT -lt $MAX_INSTALL_ATTEMPTS ]; then
|
if [ $CURRENT_ATTEMPT -lt $MAX_INSTALL_ATTEMPTS ]; then
|
||||||
install_missing_packages "${missing_packages[@]}"
|
install_missing_packages "${missing_packages[@]}"
|
||||||
|
|
||||||
echo -e "\n${BLUE}=== Installation Results ===${NC}"
|
echo -e "\n${BLUE}=== Installation Results ===${NC}"
|
||||||
if [ ${#installed_this_round[@]} -gt 0 ]; then
|
if [ ${#installed_this_round[@]} -gt 0 ]; then
|
||||||
echo -e "${GREEN}Successfully installed:${NC}"
|
echo -e "${GREEN}Successfully installed:${NC}"
|
||||||
@@ -526,7 +528,7 @@ while [ $CURRENT_ATTEMPT -le $MAX_INSTALL_ATTEMPTS ]; do
|
|||||||
done
|
done
|
||||||
echo "Successfully installed: ${installed_this_round[*]}" >> "$LOG_FILE"
|
echo "Successfully installed: ${installed_this_round[*]}" >> "$LOG_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ${#failed_packages[@]} -gt 0 ]; then
|
if [ ${#failed_packages[@]} -gt 0 ]; then
|
||||||
echo -e "${RED}Failed to install:${NC}"
|
echo -e "${RED}Failed to install:${NC}"
|
||||||
for pkg in "${failed_packages[@]}"; do
|
for pkg in "${failed_packages[@]}"; do
|
||||||
@@ -534,7 +536,7 @@ while [ $CURRENT_ATTEMPT -le $MAX_INSTALL_ATTEMPTS ]; do
|
|||||||
done
|
done
|
||||||
echo "Failed to install: ${failed_packages[*]}" >> "$LOG_FILE"
|
echo "Failed to install: ${failed_packages[*]}" >> "$LOG_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CURRENT_ATTEMPT=$((CURRENT_ATTEMPT + 1))
|
CURRENT_ATTEMPT=$((CURRENT_ATTEMPT + 1))
|
||||||
echo -e "\n${YELLOW}Continuing to next test iteration...${NC}"
|
echo -e "\n${YELLOW}Continuing to next test iteration...${NC}"
|
||||||
echo "Continuing to next test iteration" >> "$LOG_FILE"
|
echo "Continuing to next test iteration" >> "$LOG_FILE"
|
||||||
@@ -550,7 +552,7 @@ while [ $CURRENT_ATTEMPT -le $MAX_INSTALL_ATTEMPTS ]; do
|
|||||||
echo -e "${RED}packages.list file not found at $HOME/shell/setup/packages.list${NC}"
|
echo -e "${RED}packages.list file not found at $HOME/shell/setup/packages.list${NC}"
|
||||||
echo "packages.list file not found" >> "$LOG_FILE"
|
echo "packages.list file not found" >> "$LOG_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If no missing packages or we've reached max attempts, break out of the loop
|
# If no missing packages or we've reached max attempts, break out of the loop
|
||||||
if [ ${#missing_packages[@]} -eq 0 ] || [ $CURRENT_ATTEMPT -ge $MAX_INSTALL_ATTEMPTS ]; then
|
if [ ${#missing_packages[@]} -eq 0 ] || [ $CURRENT_ATTEMPT -ge $MAX_INSTALL_ATTEMPTS ]; then
|
||||||
break
|
break
|
||||||
@@ -563,11 +565,11 @@ done
|
|||||||
if [ -d "$HOME/.nvm" ]; then
|
if [ -d "$HOME/.nvm" ]; then
|
||||||
echo -e "NVM: ${GREEN}Installed${NC}"
|
echo -e "NVM: ${GREEN}Installed${NC}"
|
||||||
echo "NVM: Installed" >> "$LOG_FILE"
|
echo "NVM: Installed" >> "$LOG_FILE"
|
||||||
|
|
||||||
# Source NVM
|
# Source NVM
|
||||||
export NVM_DIR="$HOME/.nvm"
|
export NVM_DIR="$HOME/.nvm"
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||||
|
|
||||||
# Test Node.js installed by NVM
|
# Test Node.js installed by NVM
|
||||||
if check_command node; then
|
if check_command node; then
|
||||||
node_version=$(node -v)
|
node_version=$(node -v)
|
||||||
@@ -619,7 +621,7 @@ for dotfile in "${dotfiles[@]}"; do
|
|||||||
if [ -L "$dotfile" ]; then
|
if [ -L "$dotfile" ]; then
|
||||||
echo -e "Dotfile $dotfile: ${GREEN}Symlinked${NC}"
|
echo -e "Dotfile $dotfile: ${GREEN}Symlinked${NC}"
|
||||||
echo "Dotfile $dotfile: Symlinked" >> "$LOG_FILE"
|
echo "Dotfile $dotfile: Symlinked" >> "$LOG_FILE"
|
||||||
|
|
||||||
# Check if symlink is valid
|
# Check if symlink is valid
|
||||||
if [ -e "$dotfile" ]; then
|
if [ -e "$dotfile" ]; then
|
||||||
target=$(readlink -f "$dotfile")
|
target=$(readlink -f "$dotfile")
|
||||||
@@ -649,7 +651,7 @@ if [ $errors -eq 0 ]; then
|
|||||||
else
|
else
|
||||||
echo -e "${RED}Found $errors potential issues with your setup.${NC}"
|
echo -e "${RED}Found $errors potential issues with your setup.${NC}"
|
||||||
echo "Result: Found $errors potential issues" >> "$LOG_FILE"
|
echo "Result: Found $errors potential issues" >> "$LOG_FILE"
|
||||||
|
|
||||||
# Display missing packages if any
|
# Display missing packages if any
|
||||||
if [ ${#missing_packages[@]} -gt 0 ]; then
|
if [ ${#missing_packages[@]} -gt 0 ]; then
|
||||||
echo -e "\n${YELLOW}The following packages were not found:${NC}"
|
echo -e "\n${YELLOW}The following packages were not found:${NC}"
|
||||||
@@ -658,13 +660,13 @@ else
|
|||||||
echo -e " - ${RED}$pkg${NC}"
|
echo -e " - ${RED}$pkg${NC}"
|
||||||
echo " - $pkg" >> "$LOG_FILE"
|
echo " - $pkg" >> "$LOG_FILE"
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $CURRENT_ATTEMPT -gt $MAX_INSTALL_ATTEMPTS ]; then
|
if [ $CURRENT_ATTEMPT -gt $MAX_INSTALL_ATTEMPTS ]; then
|
||||||
echo -e "\n${RED}Reached maximum installation attempts ($MAX_INSTALL_ATTEMPTS).${NC}"
|
echo -e "\n${RED}Reached maximum installation attempts ($MAX_INSTALL_ATTEMPTS).${NC}"
|
||||||
echo -e "${YELLOW}Some packages could not be installed automatically.${NC}"
|
echo -e "${YELLOW}Some packages could not be installed automatically.${NC}"
|
||||||
echo "Reached maximum installation attempts" >> "$LOG_FILE"
|
echo "Reached maximum installation attempts" >> "$LOG_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "\n${BLUE}You can manually install these packages with:${NC}"
|
echo -e "\n${BLUE}You can manually install these packages with:${NC}"
|
||||||
echo -e " sudo apt-get install ${missing_packages[*]}"
|
echo -e " sudo apt-get install ${missing_packages[*]}"
|
||||||
fi
|
fi
|
||||||
@@ -688,12 +690,12 @@ if [[ "$ID" == "debian" ]]; then
|
|||||||
echo "1. Ensure Debian's 'universe' equivalent repositories are enabled (contrib, non-free)"
|
echo "1. Ensure Debian's 'universe' equivalent repositories are enabled (contrib, non-free)"
|
||||||
echo "2. Some packages like 'bat' may have different names in Debian (batcat)"
|
echo "2. Some packages like 'bat' may have different names in Debian (batcat)"
|
||||||
echo "3. Consider adding Debian-specific adjustments to setup.sh"
|
echo "3. Consider adding Debian-specific adjustments to setup.sh"
|
||||||
|
|
||||||
# Add specific Debian package name mappings
|
# Add specific Debian package name mappings
|
||||||
echo -e "\nOn Debian, you may need these package name adjustments:"
|
echo -e "\nOn Debian, you may need these package name adjustments:"
|
||||||
echo " - bat → batcat"
|
echo " - bat → batcat"
|
||||||
echo " - (add more as needed)"
|
echo " - (add more as needed)"
|
||||||
|
|
||||||
echo "Debian package name mappings may be required" >> "$LOG_FILE"
|
echo "Debian package name mappings may be required" >> "$LOG_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -701,16 +703,16 @@ fi
|
|||||||
check_bootstrapped_environment() {
|
check_bootstrapped_environment() {
|
||||||
echo -e "\n${BLUE}=== Checking for bootstrapped environment ===${NC}"
|
echo -e "\n${BLUE}=== Checking for bootstrapped environment ===${NC}"
|
||||||
echo "=== Checking for bootstrapped environment ===" >> "$LOG_FILE"
|
echo "=== Checking for bootstrapped environment ===" >> "$LOG_FILE"
|
||||||
|
|
||||||
if [ -d "$HOME/shell" ] && [ -f "$HOME/shell/bootstrap.sh" ]; then
|
if [ -d "$HOME/shell" ] && [ -f "$HOME/shell/bootstrap.sh" ]; then
|
||||||
echo -e "${GREEN}Environment appears to be bootstrapped:${NC}"
|
echo -e "${GREEN}Environment appears to be bootstrapped:${NC}"
|
||||||
echo "Environment is bootstrapped" >> "$LOG_FILE"
|
echo "Environment is bootstrapped" >> "$LOG_FILE"
|
||||||
|
|
||||||
# Check the shell repository structure
|
# Check the shell repository structure
|
||||||
if [ -d "$HOME/shell/setup" ] && [ -f "$HOME/shell/setup/setup.sh" ]; then
|
if [ -d "$HOME/shell/setup" ] && [ -f "$HOME/shell/setup/setup.sh" ]; then
|
||||||
echo -e " - ${GREEN}Setup directory and script present${NC}"
|
echo -e " - ${GREEN}Setup directory and script present${NC}"
|
||||||
echo "Setup directory and script: Present" >> "$LOG_FILE"
|
echo "Setup directory and script: Present" >> "$LOG_FILE"
|
||||||
|
|
||||||
# Check if setup.sh is executable
|
# Check if setup.sh is executable
|
||||||
if [ -x "$HOME/shell/setup/setup.sh" ]; then
|
if [ -x "$HOME/shell/setup/setup.sh" ]; then
|
||||||
echo -e " - ${GREEN}Setup script is executable${NC}"
|
echo -e " - ${GREEN}Setup script is executable${NC}"
|
||||||
@@ -723,12 +725,12 @@ check_bootstrapped_environment() {
|
|||||||
echo -e " - ${RED}Setup directory or setup.sh missing${NC}"
|
echo -e " - ${RED}Setup directory or setup.sh missing${NC}"
|
||||||
echo "Setup directory or setup.sh: Missing" >> "$LOG_FILE"
|
echo "Setup directory or setup.sh: Missing" >> "$LOG_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check packages.list
|
# Check packages.list
|
||||||
if [ -f "$HOME/shell/setup/packages.list" ]; then
|
if [ -f "$HOME/shell/setup/packages.list" ]; then
|
||||||
echo -e " - ${GREEN}Packages list present${NC}"
|
echo -e " - ${GREEN}Packages list present${NC}"
|
||||||
echo "Packages list: Present" >> "$LOG_FILE"
|
echo "Packages list: Present" >> "$LOG_FILE"
|
||||||
|
|
||||||
# Count packages in list
|
# Count packages in list
|
||||||
pkg_count=$(grep -v '^//' "$HOME/shell/setup/packages.list" | grep -v -e '^$' | wc -l)
|
pkg_count=$(grep -v '^//' "$HOME/shell/setup/packages.list" | grep -v -e '^$' | wc -l)
|
||||||
echo -e " - ${GREEN}Package list contains $pkg_count packages${NC}"
|
echo -e " - ${GREEN}Package list contains $pkg_count packages${NC}"
|
||||||
@@ -737,12 +739,12 @@ check_bootstrapped_environment() {
|
|||||||
echo -e " - ${RED}Packages list missing${NC}"
|
echo -e " - ${RED}Packages list missing${NC}"
|
||||||
echo "Packages list: Missing" >> "$LOG_FILE"
|
echo "Packages list: Missing" >> "$LOG_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check dotfiles directory
|
# Check dotfiles directory
|
||||||
if [ -d "$HOME/shell/dotfiles" ]; then
|
if [ -d "$HOME/shell/dotfiles" ]; then
|
||||||
echo -e " - ${GREEN}Dotfiles directory present${NC}"
|
echo -e " - ${GREEN}Dotfiles directory present${NC}"
|
||||||
echo "Dotfiles directory: Present" >> "$LOG_FILE"
|
echo "Dotfiles directory: Present" >> "$LOG_FILE"
|
||||||
|
|
||||||
# Check if dotfiles are properly symlinked
|
# Check if dotfiles are properly symlinked
|
||||||
dotfiles_linked=true
|
dotfiles_linked=true
|
||||||
for dotfile in "$HOME/.zshrc" "$HOME/.nanorc" "$HOME/.profile" "$HOME/.gitconfig"; do
|
for dotfile in "$HOME/.zshrc" "$HOME/.nanorc" "$HOME/.profile" "$HOME/.gitconfig"; do
|
||||||
@@ -759,7 +761,7 @@ check_bootstrapped_environment() {
|
|||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if $dotfiles_linked; then
|
if $dotfiles_linked; then
|
||||||
echo -e " - ${GREEN}Dotfiles are properly symlinked${NC}"
|
echo -e " - ${GREEN}Dotfiles are properly symlinked${NC}"
|
||||||
echo "Dotfiles symlinked: Yes" >> "$LOG_FILE"
|
echo "Dotfiles symlinked: Yes" >> "$LOG_FILE"
|
||||||
|
|||||||
Reference in New Issue
Block a user