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 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 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.sh restart" # Restart Plex
|
||||
alias plex-status="/home/acedanger/shell/plex.sh status" # Status check
|
||||
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 {}'"
|
||||
alias cat="bat"
|
||||
alias fd="fd"
|
||||
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
|
||||
;;
|
||||
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
|
||||
;;
|
||||
apt)
|
||||
|
||||
@@ -9,3 +9,6 @@ fzf
|
||||
zsh
|
||||
nala
|
||||
fd-find
|
||||
lazygit
|
||||
lazydocker
|
||||
eza
|
||||
131
setup/setup.sh
131
setup/setup.sh
@@ -39,7 +39,7 @@ determine_pkg_manager() {
|
||||
|
||||
# Set up package management based on OS
|
||||
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
|
||||
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
|
||||
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
|
||||
echo -e "${YELLOW}Updating package lists for Fedora...${NC}"
|
||||
sudo dnf check-update -y || true
|
||||
@@ -90,6 +98,19 @@ else
|
||||
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
|
||||
echo -e "${YELLOW}Setting up VS Code repository...${NC}"
|
||||
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
|
||||
fedora_pkg_map["bat"]="bat"
|
||||
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
|
||||
|
||||
# Process the package list based on OS
|
||||
install_pkg_list=()
|
||||
special_installs=()
|
||||
for pkg in "${pkgs[@]}"; do
|
||||
# Skip nala package on non-Debian/Ubuntu systems
|
||||
if [ "$pkg" = "nala" ] && [ "$OS_NAME" != "ubuntu" ] && [ "$OS_NAME" != "debian" ]; then
|
||||
continue
|
||||
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
|
||||
if [ "$OS_NAME" = "fedora" ] && [[ -n "${fedora_pkg_map[$pkg]}" ]]; then
|
||||
install_pkg_list+=("${fedora_pkg_map[$pkg]}")
|
||||
@@ -189,6 +228,44 @@ esac
|
||||
|
||||
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
|
||||
echo -e "${YELLOW}Installing Zsh...${NC}"
|
||||
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}"
|
||||
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
|
||||
clone_zsh_plugin() {
|
||||
local plugin_url=$1
|
||||
@@ -314,8 +377,14 @@ mkdir -p "$ZSH_CUSTOM"
|
||||
# Create a copy of the original aliases file for backup
|
||||
cp "$DOTFILES_SUBDIR/my-aliases.zsh" "$ALIASES_FILE.bak"
|
||||
|
||||
# First, copy all general aliases except those we'll modify based on OS
|
||||
grep -v "alias cat=" "$DOTFILES_SUBDIR/my-aliases.zsh" | grep -v "alias fd=" | grep -v "alias fzf=" > "$ALIASES_FILE"
|
||||
# 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=" | \
|
||||
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
|
||||
add_conditional_alias() {
|
||||
@@ -360,6 +429,34 @@ if command -v fzf &> /dev/null; then
|
||||
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
|
||||
# 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}"
|
||||
|
||||
@@ -17,18 +17,20 @@ MAX_INSTALL_ATTEMPTS=3
|
||||
CURRENT_ATTEMPT=1
|
||||
|
||||
# Log file
|
||||
# C log_both "\n${BLUE}Debugging lolcat package:${NC}" "Debugging lolcat package:"
|
||||
if [ -f "/usr/games/lolcat" ]; then
|
||||
log_both "- Lolcat found at /usr/games/lolcat"
|
||||
ls -la /usr/games/lolcat >> "$LOG_FILE"
|
||||
else
|
||||
log_both "- Lolcat not found at /usr/games/lolcat"
|
||||
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
||||
CONTAINER_INFO=""
|
||||
if [ -f /.dockerenv ]; then
|
||||
# We're in a container, try to get container info
|
||||
if [ -f /etc/os-release ]; then
|
||||
CONTAINER_INFO="$(grep '^ID=' /etc/os-release | cut -d'=' -f2 | tr -d '"')-"
|
||||
fi
|
||||
if check_command lolcat; then
|
||||
log_both "- Lolcat found in PATH"
|
||||
command -v lolcat >> "$LOG_FILE"
|
||||
else
|
||||
log_both "- Lolcat not found in PATH"
|
||||
fi
|
||||
|
||||
# Create logs directory if it doesn't exist
|
||||
LOGS_DIR="/tmp"
|
||||
if [ ! -d "$LOGS_DIR" ]; then
|
||||
mkdir -p "$LOGS_DIR"
|
||||
fi
|
||||
firectory if it doesn't exist and is writable
|
||||
# First, try creating the logs directory in case it doesn't exist
|
||||
if [ -d "/logs" ] || mkdir -p /logs 2>/dev/null; then
|
||||
|
||||
Reference in New Issue
Block a user