Advanced upgrade :D
This commit is contained in:
parent
5b722cc099
commit
dc33ab44c4
27
.zsh_aliases
27
.zsh_aliases
@ -1,4 +1,4 @@
|
|||||||
# .zsh_aliases
|
# .zsh_aliases
|
||||||
|
|
||||||
# Aliases
|
# Aliases
|
||||||
alias c="clear"
|
alias c="clear"
|
||||||
@ -12,7 +12,12 @@ alias ll="eza --icons -la"
|
|||||||
|
|
||||||
alias grep="grep --color=auto"
|
alias grep="grep --color=auto"
|
||||||
|
|
||||||
alias update="sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y && sudo apt autoclean"
|
alias src="source ~/.zshrc && echo '🔄 Reloaded .zshrc'"
|
||||||
|
|
||||||
|
alias cat="bat"
|
||||||
|
alias fd="fd"
|
||||||
|
|
||||||
|
alias tree="eza --icons -T --git-ignore"
|
||||||
|
|
||||||
# Navigation
|
# Navigation
|
||||||
alias ..="cd .."
|
alias ..="cd .."
|
||||||
@ -37,22 +42,6 @@ alias cpu="lscpu"
|
|||||||
|
|
||||||
# Network
|
# Network
|
||||||
alias ip="ip -c" # IP command with colorized output
|
alias ip="ip -c" # IP command with colorized output
|
||||||
alias ports="netstat -tulanp" # List all listening ports
|
alias ports="ss -tulanp" # List all listening ports
|
||||||
alias myip="curl ifconfig.me" # Get public IP address
|
alias myip="curl ifconfig.me" # Get public IP address
|
||||||
alias pingg="ping google.com" # Network Testing
|
alias pingg="ping google.com" # Network Testing
|
||||||
|
|
||||||
# Docker
|
|
||||||
alias dps="docker ps" # Docker PS
|
|
||||||
alias dpsa="docker ps -a" # Docker PS All
|
|
||||||
alias drm="docker rm $(docker ps -a -q)" # Docker Remove All Stopped Containers
|
|
||||||
alias dclean="docker system prune -af" # Docker Clean All
|
|
||||||
|
|
||||||
dockcup() { # Docker Compose Up
|
|
||||||
local file="${1:-docker-compose.yaml}" # Default to docker-compose.yaml if no argument is given
|
|
||||||
docker compose -f "$file" up -d
|
|
||||||
}
|
|
||||||
|
|
||||||
dockcdown() { # Docker Compose Down
|
|
||||||
local file="${1:-docker-compose.yaml}" # Default to docker-compose.yaml if no argument is given
|
|
||||||
docker compose -f "$file" down
|
|
||||||
}
|
|
||||||
|
|||||||
96
.zshrc
96
.zshrc
@ -1,4 +1,4 @@
|
|||||||
# .zshrc
|
# .zshrc
|
||||||
|
|
||||||
# Path to your Oh My Zsh installation.
|
# Path to your Oh My Zsh installation.
|
||||||
export ZSH="$HOME/.oh-my-zsh"
|
export ZSH="$HOME/.oh-my-zsh"
|
||||||
@ -7,56 +7,68 @@ PROMPT="%B%~%b :: "
|
|||||||
RPROMPT="%n@%m"
|
RPROMPT="%n@%m"
|
||||||
|
|
||||||
# Plugins
|
# Plugins
|
||||||
plugins=(
|
plugins=(git zsh-syntax-highlighting zsh-autosuggestions)
|
||||||
git
|
|
||||||
zsh-syntax-highlighting
|
|
||||||
zsh-autosuggestions
|
|
||||||
)
|
|
||||||
|
|
||||||
source $ZSH/oh-my-zsh.sh
|
source $ZSH/oh-my-zsh.sh
|
||||||
|
|
||||||
# Add to PATH
|
# Golang and GVM
|
||||||
export PATH="$HOME/.local/bin:$PATH"
|
[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"
|
||||||
|
|
||||||
|
# Node and NVM (Lazy Load)
|
||||||
# GVM
|
|
||||||
[[ -s "/home/mangopig/.gvm/scripts/gvm" ]] && source "/home/mangopig/.gvm/scripts/gvm"
|
|
||||||
|
|
||||||
# Golang
|
|
||||||
# Ensure Go binary is in PATH
|
|
||||||
export GOROOT=/usr/local/go
|
|
||||||
export GOPATH=$HOME/Programming/go
|
|
||||||
export GOBIN=$GOPATH/bin
|
|
||||||
|
|
||||||
# Set PATH correctly
|
|
||||||
export PATH=$GOROOT/bin:$GOBIN:$GOPATH/bin:$PATH
|
|
||||||
|
|
||||||
# NVM
|
|
||||||
export NVM_DIR="$HOME/.nvm"
|
export NVM_DIR="$HOME/.nvm"
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
|
||||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
|
nvm_load() {
|
||||||
|
echo "💤 Waking up NVM..."
|
||||||
|
unset -f nvm node npm npx
|
||||||
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||||
|
"$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
nvm() { nvm_load "nvm" "$@"; }
|
||||||
|
node() { nvm_load "node" "$@"; }
|
||||||
|
npm() { nvm_load "npm" "$@"; }
|
||||||
|
npx() { nvm_load "npx" "$@"; }
|
||||||
|
|
||||||
|
# Rust and Cargo
|
||||||
|
[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"
|
||||||
|
|
||||||
# Zoxide
|
# Zoxide
|
||||||
eval "$(zoxide init --cmd cd zsh)"
|
eval "$(zoxide init --cmd cd zsh)"
|
||||||
|
|
||||||
# Source the aliases file
|
# Source Aliases & Secrets
|
||||||
source ~/.zsh_aliases
|
[ -f ~/.zsh_aliases ] && source ~/.zsh_aliases
|
||||||
|
[ -f ~/.zsh_secrets ] && source ~/.zsh_secrets
|
||||||
|
|
||||||
# Source Secrets
|
# Conda (Dynamic Path)
|
||||||
source ~/.zsh_secrets
|
# __conda_setup="$('$HOME/Programming/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
|
||||||
|
# if [ $? -eq 0 ]; then
|
||||||
|
# eval "$__conda_setup"
|
||||||
|
# else
|
||||||
|
# if [ -f "$HOME/Programming/miniconda3/etc/profile.d/conda.sh" ]; then
|
||||||
|
# . "$HOME/Programming/miniconda3/etc/profile.d/conda.sh"
|
||||||
|
# else
|
||||||
|
# export PATH="$HOME/Programming/miniconda3/bin:$PATH"
|
||||||
|
# fi
|
||||||
|
# fi
|
||||||
|
# unset __conda_setup
|
||||||
|
|
||||||
# >>> conda initialize >>>
|
# Add to PATH
|
||||||
# !! Contents within this block are managed by 'conda init' !!
|
export PATH="$HOME/.local/bin:$PATH"
|
||||||
__conda_setup="$('/home/mangopig/Programming/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
|
|
||||||
if [ $? -eq 0 ]; then
|
# ---------------------------------------------------------------------
|
||||||
eval "$__conda_setup"
|
# DYNAMIC VS CODE PATH (Run LAST)
|
||||||
else
|
# ---------------------------------------------------------------------
|
||||||
if [ -f "/home/mangopig/Programming/miniconda3/etc/profile.d/conda.sh" ]; then
|
|
||||||
. "/home/mangopig/Programming/miniconda3/etc/profile.d/conda.sh"
|
# Get Windows Username
|
||||||
else
|
WIN_USER=$(cmd.exe /c 'echo %USERNAME%' 2>/dev/null | tr -d '\r')
|
||||||
export PATH="/home/mangopig/Programming/miniconda3/bin:$PATH"
|
|
||||||
fi
|
# Define potential paths (User Install vs System Install)
|
||||||
|
VSCODE_USER="/mnt/c/Users/$WIN_USER/AppData/Local/Programs/Microsoft VS Code/bin"
|
||||||
|
VSCODE_SYS="/mnt/c/Program Files/Microsoft VS Code/bin"
|
||||||
|
|
||||||
|
# Add whichever exists to PATH
|
||||||
|
if [ -d "$VSCODE_USER" ]; then
|
||||||
|
export PATH="$PATH:$VSCODE_USER"
|
||||||
|
elif [ -d "$VSCODE_SYS" ]; then
|
||||||
|
export PATH="$PATH:$VSCODE_SYS"
|
||||||
fi
|
fi
|
||||||
unset __conda_setup
|
|
||||||
# <<< conda initialize <<<
|
|
||||||
|
|
||||||
|
|||||||
41
Makefile
Normal file
41
Makefile
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
# Makefile for Dotfiles
|
||||||
|
|
||||||
|
# Tells Make that these targets are not actual files
|
||||||
|
.PHONY: all setup stow clean update docker-test
|
||||||
|
|
||||||
|
# Default target (runs when you just type 'make')
|
||||||
|
all: stow
|
||||||
|
|
||||||
|
# Full Setup
|
||||||
|
setup:
|
||||||
|
bash setup.sh
|
||||||
|
|
||||||
|
# Just stow the dotfiles
|
||||||
|
stow:
|
||||||
|
stow . --target=$$HOME --ignore="setup.sh" --ignore=".git" --ignore=".gitignore" --ignore="README.md" --ignore=".zsh_secrets" --ignore=".zsh_secrets.example" --ignore="LICENSE" --ignore="Makefile"
|
||||||
|
@echo "Dotfiles linked."
|
||||||
|
|
||||||
|
# Clean old files and links
|
||||||
|
clean:
|
||||||
|
stow -D . --target=$$HOME
|
||||||
|
@echo "Links removed."
|
||||||
|
|
||||||
|
# Pull Git Updates
|
||||||
|
update:
|
||||||
|
git pull origin main
|
||||||
|
make setup
|
||||||
|
|
||||||
|
# Docker Tests
|
||||||
|
test-ubuntu:
|
||||||
|
@echo "Ubuntu Test"
|
||||||
|
docker run -it --rm -e TERM=xterm-256color -v $(PWD):/root/dotfiles ubuntu:latest \
|
||||||
|
bash -c "export DEBIAN_FRONTEND=noninteractive && \
|
||||||
|
apt-get update && \
|
||||||
|
apt-get install -y sudo git make curl && \
|
||||||
|
cd /root/dotfiles && \
|
||||||
|
make setup"
|
||||||
|
|
||||||
|
test-arch:
|
||||||
|
@echo "Spawning Arch Container..."
|
||||||
|
docker run -it --rm -e TERM=xterm-256color -v $(PWD):/root/dotfiles archlinux:latest \
|
||||||
|
bash -c "pacman -Sy --noconfirm base-devel git make sudo && cd /root/dotfiles && make setup"
|
||||||
195
setup.sh
Executable file
195
setup.sh
Executable file
@ -0,0 +1,195 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Variables
|
||||||
|
ZSH_CUSTOM="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}"
|
||||||
|
DOTFILES_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
# Bold Colors
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
BLUE='\033[1;34m'
|
||||||
|
RED='\033[1;31m'
|
||||||
|
GREEN='\033[1;32m'
|
||||||
|
NC='\033[0m'
|
||||||
|
|
||||||
|
# OS Detection
|
||||||
|
echo -e "${BLUE} LOG:${YELLOW} Checking System...${NC}"
|
||||||
|
|
||||||
|
if [ -f /etc/os-release ]; then
|
||||||
|
. /etc/os-release
|
||||||
|
OS=$ID
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Package Installation
|
||||||
|
PACKAGES=(
|
||||||
|
curl wget git sudo
|
||||||
|
zsh tmux
|
||||||
|
unzip tar gzip
|
||||||
|
build-essential
|
||||||
|
openssl
|
||||||
|
python bison mercurial
|
||||||
|
ripgrep fd bat fzf jq
|
||||||
|
btop httpie gnupg
|
||||||
|
zoxide stow
|
||||||
|
bind nmap socat tcpdump net-tools
|
||||||
|
strace gdb hexyl
|
||||||
|
)
|
||||||
|
|
||||||
|
FINAL_LIST=""
|
||||||
|
|
||||||
|
for pkg in "${PACKAGES[@]}"; do
|
||||||
|
case "$pkg" in
|
||||||
|
"build-essential")
|
||||||
|
[ "$OS" == "arch" ] && pkg="base-devel"
|
||||||
|
[ "$OS" == "ubuntu" ] && pkg="build-essential"
|
||||||
|
;;
|
||||||
|
"python")
|
||||||
|
[ "$OS" == "arch" ] && pkg="python"
|
||||||
|
[ "$OS" == "ubuntu" ] && pkg="python3 python3-pip python3-venv"
|
||||||
|
;;
|
||||||
|
"fd")
|
||||||
|
[ "$OS" == "arch" ] && pkg="fd"
|
||||||
|
[ "$OS" == "ubuntu" ] && pkg="fd-find"
|
||||||
|
;;
|
||||||
|
"bat")
|
||||||
|
[ "$OS" == "arch" ] && pkg="bat"
|
||||||
|
[ "$OS" == "ubuntu" ] && pkg="bat"
|
||||||
|
;;
|
||||||
|
"openssl")
|
||||||
|
[ "$OS" == "arch" ] && pkg="openssl"
|
||||||
|
[ "$OS" == "ubuntu" ] && pkg="libssl-dev"
|
||||||
|
;;
|
||||||
|
"bind")
|
||||||
|
[ "$OS" == "arch" ] && pkg="bind"
|
||||||
|
[ "$OS" == "ubuntu" ] && pkg="dnsutils"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
esac
|
||||||
|
|
||||||
|
FINAL_LIST="$FINAL_LIST $pkg"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Extra packages for specific distros
|
||||||
|
if [ "$OS" == "arch" ] || [ "$OS" == "manjaro" ]; then
|
||||||
|
FINAL_LIST="$FINAL_LIST eza"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then
|
||||||
|
FINAL_LIST="$FINAL_LIST ca-certificates bsdmainutils pkg-config cmake"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "${BLUE} LOG:${YELLOW} Installing: ${NC}$FINAL_LIST"
|
||||||
|
|
||||||
|
if [ "$OS" == "arch" ] || [ "$OS" == "manjaro" ]; then
|
||||||
|
sudo pacman -S --noconfirm --needed $FINAL_LIST
|
||||||
|
elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then
|
||||||
|
sudo DEBIAN_FRONTEND=noninteractive apt-get update
|
||||||
|
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y $FINAL_LIST
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then
|
||||||
|
echo -e "${BLUE} LOG:${YELLOW} Fixing Ubuntu binary names...${NC}"
|
||||||
|
[ -f /usr/bin/fdfind ] && sudo ln -sf /usr/bin/fdfind /usr/local/bin/fd
|
||||||
|
[ -f /usr/bin/batcat ] && sudo ln -sf /usr/bin/batcat /usr/local/bin/bat
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Docker Installation
|
||||||
|
if command -v docker &> /dev/null; then
|
||||||
|
echo -e "${GREEN} LOG: Docker is already installed. Skipping...${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${BLUE} LOG:${YELLOW} Docker not found. Installing Native Docker Engine...${NC}"
|
||||||
|
|
||||||
|
# ARCH LINUX
|
||||||
|
if [ "$OS" == "arch" ] || [ "$OS" == "manjaro" ]; then
|
||||||
|
sudo pacman -S --noconfirm --needed docker docker-compose
|
||||||
|
fi
|
||||||
|
|
||||||
|
# UBUNTU / DEBIAN
|
||||||
|
if [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then
|
||||||
|
echo -e "${BLUE} LOG:${YELLOW} Setting up Official Docker Repository...${NC}"
|
||||||
|
sudo install -m 0755 -d /etc/apt/keyrings
|
||||||
|
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
|
||||||
|
sudo chmod a+r /etc/apt/keyrings/docker.asc
|
||||||
|
|
||||||
|
echo \
|
||||||
|
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
|
||||||
|
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
|
||||||
|
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||||
|
|
||||||
|
sudo DEBIAN_FRONTEND=noninteractive apt-get update
|
||||||
|
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install NVM, GVM, Rustup
|
||||||
|
echo -e "${BLUE} LOG:${YELLOW} Installing NVM, GVM and Rustup...${NC}"
|
||||||
|
|
||||||
|
# NVM
|
||||||
|
if [ ! -d "$HOME/.nvm" ]; then
|
||||||
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
|
||||||
|
fi
|
||||||
|
|
||||||
|
# GVM
|
||||||
|
if [ ! -d "$HOME/.gvm" ]; then
|
||||||
|
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Rustup
|
||||||
|
if ! command -v rustup &> /dev/null; then
|
||||||
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install Eza with Cargo
|
||||||
|
echo -e "${BLUE} LOG:${YELLOW} Installing Eza via Cargo...${NC}"
|
||||||
|
if ! command -v eza &> /dev/null; then
|
||||||
|
source "$HOME/.cargo/env"
|
||||||
|
cargo install eza
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Docker Group
|
||||||
|
echo -e "${BLUE} LOG:${YELLOW} Setting up Docker group...${NC}"
|
||||||
|
if ! getent group docker > /dev/null 2>&1; then
|
||||||
|
sudo groupadd docker
|
||||||
|
fi
|
||||||
|
sudo usermod -aG docker $(whoami)
|
||||||
|
|
||||||
|
# Zsh and Oh My Zsh Setup
|
||||||
|
echo -e "${BLUE} LOG:${YELLOW} Setting up Oh My Zsh...${NC}"
|
||||||
|
if [ ! -d "$HOME/.oh-my-zsh" ]; then
|
||||||
|
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "${BLUE} LOG:${YELLOW} Installing Zsh plugins...${NC}"
|
||||||
|
if [ ! -d "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting" ]; then
|
||||||
|
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "$ZSH_CUSTOM/plugins/zsh-autosuggestions" ]; then
|
||||||
|
git clone https://github.com/zsh-users/zsh-autosuggestions "$ZSH_CUSTOM/plugins/zsh-autosuggestions"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Making Zsh the default shell
|
||||||
|
echo -e "${BLUE} LOG:${YELLOW} Setting Zsh as the default shell...${NC}"
|
||||||
|
if [ "$SHELL" != "$(which zsh)" ]; then
|
||||||
|
sudo chsh -s "$(which zsh)" $(whoami)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# File Cleanup
|
||||||
|
echo -e "${BLUE} LOG:${YELLOW} Cleaning up old configs...${NC}"
|
||||||
|
rm -f "$HOME/.zshrc" "$HOME/.zsh_aliases"
|
||||||
|
|
||||||
|
# Ensure secrets file exists
|
||||||
|
echo -e "${BLUE} LOG:${YELLOW} Ensuring secrets file exists...${NC}"
|
||||||
|
touch "$HOME/.zsh_secrets"
|
||||||
|
|
||||||
|
# Stow Dotfiles
|
||||||
|
echo -e "${BLUE} LOG:${YELLOW} Stowing dotfiles...${NC}"
|
||||||
|
cd "$DOTFILES_DIR"
|
||||||
|
stow . --target="$HOME" --ignore="setup.sh" --ignore=".git" --ignore=".gitignore" --ignore="README.md" --ignore=".zsh_secrets" --ignore=".zsh_secrets.example" --ignore="LICENSE" --ignore="Makefile"
|
||||||
|
|
||||||
|
# Finish
|
||||||
|
echo -e "${GREEN} LOG: Setup Complete! Please restart your terminal to apply all changes.${NC}"
|
||||||
|
echo -e "${GREEN} You may need to log out and back in for Docker group changes to take effect.${NC}"
|
||||||
|
echo -e "${GREEN} Setup GVM by running 'go listall' and 'gvm use [version] --default'.${NC}"
|
||||||
|
echo -e "${GREEN} Setup NVM by running 'nvm install --lts' and 'nvm use --lts'${NC}"
|
||||||
|
echo -e "${GREEN} Setup Rust by running 'rustup default stable'${NC}"
|
||||||
Loading…
x
Reference in New Issue
Block a user