Add Ninja to base

This commit is contained in:
MangoPig 2025-12-09 03:29:57 +00:00
parent 69f7a5d4d5
commit f359bb68eb
9 changed files with 20 additions and 89 deletions

11
.zshrc
View File

@ -14,12 +14,11 @@ source $ZSH/oh-my-zsh.sh
# Programming Languages Root
export PROG_DIR="$HOME/.programming"
# 1. Go and GVM (Black Box)
# Go and GVM (Black Box)
export GVM_ROOT="$PROG_DIR/go"
# Only source if the custom GVM exists
[[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"
# 2. Node and NVM (Lazy Load)
# Node and NVM (Lazy Load)
export NVM_DIR="$PROG_DIR/node"
nvm_load() {
@ -34,11 +33,11 @@ node() { nvm_load "node" "$@"; }
npm() { nvm_load "npm" "$@"; }
npx() { nvm_load "npx" "$@"; }
# 3. Rust and Cargo
# Rust and Cargo
export RUSTUP_HOME="$PROG_DIR/rust/multirust"
export CARGO_HOME="$PROG_DIR/rust/cargo"
# 4. Python (Pyenv + Miniconda)
# Python (Pyenv + Miniconda)
export PYENV_ROOT="$PROG_DIR/python/pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
@ -51,7 +50,7 @@ if command -v conda >/dev/null 2>&1; then
[ -f "$CONDA_BASE/etc/profile.d/conda.sh" ] && source "$CONDA_BASE/etc/profile.d/conda.sh"
fi
# 5. R and Rig
# R and Rig
export RIG_HOME="$PROG_DIR/r"
if [ -d "$RIG_HOME/bin" ]; then
export PATH="$RIG_HOME/bin:$PATH"

View File

@ -40,7 +40,7 @@ PACKAGES=(
btop httpie gnupg
zoxide stow
bind nmap socat tcpdump net-tools
strace gdb hexyl
strace gdb hexyl ninja-build
)
FINAL_LIST=""
@ -71,6 +71,10 @@ for pkg in "${PACKAGES[@]}"; do
[ "$OS" == "arch" ] && pkg="bind"
[ "$OS" == "ubuntu" ] && pkg="dnsutils"
;;
"ninja-build")
[ "$OS" == "arch" ] && pkg="ninja"
[ "$OS" == "ubuntu" ] && pkg="ninja-build"
;;
*)
esac
@ -111,7 +115,7 @@ if ! command -v rclone &> /dev/null; then
curl https://rclone.org/install.sh | sudo bash
fi
# 3. Docker Installation
# Docker Installation
if command -v docker &> /dev/null; then
echo -e "${GREEN} LOG: Docker is already installed.${NC}"
else
@ -124,7 +128,6 @@ else
sudo pacman -S --noconfirm --needed docker docker-compose
sudo systemctl enable --now docker
elif [ "$OS" == "ubuntu" ]; then
# (Simplified for brevity - standard Docker install logic)
curl -fsSL https://get.docker.com | sh
fi

View File

@ -9,7 +9,6 @@ YELLOW='\033[1;33m'
GREEN='\033[1;32m'
NC='\033[0m'
# OS Detection
if [ -f /etc/os-release ]; then
. /etc/os-release
OS=$ID

View File

@ -10,22 +10,15 @@ GREEN='\033[1;32m'
RED='\033[1;31m'
NC='\033[0m'
# 1. Define Custom GVM Root
export GVM_ROOT="$HOME/.programming/go"
BOOTSTRAP_GO="$GVM_ROOT/bootstrap"
echo -e "${BLUE} LOG:${YELLOW} Setting up Go and GVM in ${GVM_ROOT}...${NC}"
# 2. Install GVM (Manual Method)
# Check for 'scripts' dir instead of '.git', because we are going to delete .git
if [ ! -d "$GVM_ROOT/scripts" ]; then
echo -e "${BLUE} LOG:${YELLOW} Cloning GVM...${NC}"
git clone https://github.com/moovweb/gvm.git "$GVM_ROOT"
# CRITICAL FIX: Remove git metadata so GVM treats this as a valid installation
rm -rf "$GVM_ROOT/.git"
# Generate the GVM executable script from default
echo -e "${BLUE} LOG:${YELLOW} Configuring GVM scripts...${NC}"
cp "$GVM_ROOT/scripts/gvm-default" "$GVM_ROOT/scripts/gvm"
sed -i "s|^GVM_ROOT=.*|GVM_ROOT=\"$GVM_ROOT\"|" "$GVM_ROOT/scripts/gvm"
@ -35,7 +28,6 @@ else
echo -e "${GREEN} SKIP:${NC} GVM already installed."
fi
# 3. Install Universal Bootstrap Go
if [ ! -d "$BOOTSTRAP_GO" ]; then
echo -e "${BLUE} LOG:${YELLOW} Downloading Bootstrap Go...${NC}"
mkdir -p "$BOOTSTRAP_GO"
@ -49,22 +41,18 @@ else
echo -e "${GREEN} SKIP:${NC} Bootstrap Go already exists."
fi
# 4. Configure Environment for Installation
export PATH="$BOOTSTRAP_GO/bin:$PATH"
export GOROOT_BOOTSTRAP="$BOOTSTRAP_GO"
# Source GVM
set +e
source "$GVM_ROOT/scripts/gvm"
set -e
# Verify GVM loaded correctly
if ! command -v gvm &> /dev/null; then
echo -e "${RED} ERROR:${NC} GVM failed to load."
exit 1
fi
# 5. Install Target Version
TARGET_VER="go1.24.11"
if ! gvm list | grep -q "$TARGET_VER"; then

View File

@ -9,28 +9,20 @@ YELLOW='\033[1;33m'
GREEN='\033[1;32m'
NC='\033[0m'
# 1. Define Custom Path (The Black Box)
export NVM_DIR="$HOME/.programming/node"
echo -e "${BLUE} LOG:${YELLOW} Setting up Node.js (NVM) in ${NVM_DIR}...${NC}"
# 2. Install NVM (if missing)
if [ ! -d "$NVM_DIR" ]; then
mkdir -p "$NVM_DIR"
echo -e "${BLUE} LOG:${YELLOW} Installing NVM to custom path...${NC}"
# NVM_DIR is exported above, so the install script picks it up automatically.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | PROFILE=/dev/null bash
fi
# 3. Source NVM (Load it into current shell)
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
# 4. Install Node
if command -v nvm &> /dev/null; then
echo -e "${BLUE} LOG:${YELLOW} Installing Node LTS...${NC}"
# --no-progress suppresses the progress bar spam in logs
nvm install --lts --no-progress
nvm use --lts

View File

@ -4,7 +4,6 @@
set -e
# Colors
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
RED='\033[1;31m'
@ -14,20 +13,17 @@ DEFAULT_USER="mangopig"
DEFAULT_UID="1000"
DEFAULT_GID="1000"
# Root Check
if [ "$EUID" -ne 0 ]; then
echo -e "${RED}Please run this script as root.${NC}"
exit 1
fi
# OS Detection
echo -e "${YELLOW}LOG: Detecting OS...${NC}"
if [ -f /etc/os-release ]; then
. /etc/os-release
OS=$ID
fi
# IP Address Retrieval
echo -e "${YELLOW}LOG: Determining primary IPv4 address...${NC}"
if command -v hostname >/dev/null 2>&1 && hostname -I >/dev/null 2>&1; then
IP=$(hostname -I | awk '{print $1}')
@ -39,7 +35,6 @@ else
IP="127.0.0.1"
fi
# Install Prerequisites (Git, Make, Zsh, Sudo)
echo -e "${YELLOW}LOG: Updating system and installing base tools...${NC}"
if [ "$OS" == "arch" ] || [ "$OS" == "manjaro" ]; then
@ -54,7 +49,6 @@ else
exit 1
fi
# Interactive Prompts
if [ -t 0 ]; then
echo -e "${GREEN}---------------------------------------${NC}"
echo -e "${GREEN} USER PROVISIONING WIZARD ${NC}"
@ -70,13 +64,11 @@ if [ -t 0 ]; then
USER_GID=${INPUT_GID:-$DEFAULT_GID}
else
echo -e "${YELLOW}LOG: Non-interactive session detected. Using defaults.${NC}"
# Allow Environment Variables to override defaults in Docker/Headless
USERNAME=${USERNAME:-$DEFAULT_USER}
USER_UID=${USER_UID:-$DEFAULT_UID}
USER_GID=${USER_GID:-$DEFAULT_GID}
fi
# Group Creation
if getent group "$USER_GID" >/dev/null; then
echo -e "${YELLOW}LOG: Group with GID $USER_GID already exists. Using it.${NC}"
else
@ -84,39 +76,30 @@ else
groupadd -g "$USER_GID" "$USERNAME"
fi
# User Creation
if id "$USERNAME" &>/dev/null; then
echo -e "${YELLOW}LOG: User $USERNAME already exists. Skipping creation.${NC}"
else
echo -e "${YELLOW}LOG: Creating user $USERNAME...${NC}"
# Create user with specific UID, GID, Groups, and Shell
useradd -m -u "$USER_UID" -g "$USER_GID" -G "$SUDO_GROUP" -s "$ZSH_PATH" "$USERNAME"
echo -e "${GREEN}LOG: Setting password for $USERNAME...${NC}"
if [ -t 0 ]; then
echo -e "${GREEN}LOG: Setting password for $USERNAME...${NC}"
passwd "$USERNAME"
else
# Docker/Automated: Set password to be the same as username
echo -e "${YELLOW}LOG: Non-interactive: Setting password to '$USERNAME'...${NC}"
echo "$USERNAME:$USERNAME" | chpasswd
fi
fi
# Sudo Configuration (Passwordless)
echo -e "${YELLOW}LOG: Configuring passwordless sudo...${NC}"
echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" > "/etc/sudoers.d/90-$USERNAME"
chmod 0440 "/etc/sudoers.d/90-$USERNAME"
# Arch Specific: Uncomment wheel in sudoers if not already active
if [ "$OS" == "arch" ]; then
# Ensure the 'wheel' group is actually enabled in the main config if drop-in fails
sed -i 's/^# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/' /etc/sudoers
fi
# Cloning Dotfiles
echo -e "${YELLOW}LOG: Cloning dotfiles for $USERNAME...${NC}"
sudo -u "$USERNAME" git clone https://git.mangopig.tech/MangoPig/Dot-Zsh.git "/home/$USERNAME/Config/Dot-Zsh"

View File

@ -15,7 +15,7 @@ if [ -f /etc/os-release ]; then
OS=$ID
fi
# 1. Install Build Dependencies
# Install Build Dependencies
if [ "$OS" == "arch" ] || [ "$OS" == "manjaro" ]; then
echo -e "${BLUE} LOG:${YELLOW} Installing Arch build dependencies...${NC}"
sudo pacman -S --noconfirm --needed base-devel openssl zlib xz tk libffi bzip2 git
@ -27,13 +27,13 @@ elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev git
fi
# 2. Define the Black Box Location
# Define the Black Box Location
export PYENV_ROOT="$HOME/.programming/python/pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
echo -e "${BLUE} LOG:${YELLOW} Setting up Pyenv in ${PYENV_ROOT}...${NC}"
# 3. Install Pyenv
# Install Pyenv
if [ ! -d "$PYENV_ROOT" ]; then
echo -e "${BLUE} LOG:${YELLOW} Cloning Pyenv...${NC}"
git clone https://github.com/pyenv/pyenv.git "$PYENV_ROOT"
@ -49,7 +49,7 @@ fi
# Initialize Pyenv for this script session
eval "$(pyenv init -)"
# 4. Install Miniforge (The Community Standard)
# Install Miniforge (The Community Standard)
TARGET_VER="miniforge3-latest"
if ! pyenv versions | grep -q "$TARGET_VER"; then
@ -63,7 +63,7 @@ else
echo -e "${GREEN} SKIP:${NC} Miniforge already installed."
fi
# 5. Set Global Default
# Set Global Default
pyenv global "$TARGET_VER"
echo -e "${GREEN} SUCCESS:${NC} Python setup completed. Default is now Miniforge (Conda)."

View File

@ -17,45 +17,31 @@ fi
echo -e "${BLUE} LOG:${YELLOW} Detecting R installation strategy for $OS...${NC}"
# ------------------------------------------------------------------
# STRATEGY A: ARCH LINUX (Native Pacman)
# Arch always has the latest R kernel. We don't need Rig.
# ------------------------------------------------------------------
if [ "$OS" == "arch" ] || [ "$OS" == "manjaro" ]; then
echo -e "${BLUE} LOG:${YELLOW} Arch Linux detected. Using system R (Pacman)...${NC}"
# 1. Install R + Build Tools
# gcc-fortran is critical for compiling R packages
# Install R + Build Tools
sudo pacman -S --noconfirm --needed r gcc-fortran curl tar
echo -e "${GREEN} SUCCESS:${NC} R installed via Pacman."
# Define R binary path for the renv step later
R_BIN="R"
# ------------------------------------------------------------------
# STRATEGY B: UBUNTU/DEBIAN (Rig Version Manager)
# These distros have old R versions. We need Rig to get the latest.
# ------------------------------------------------------------------
elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then
# 1. Install Deps
echo -e "${BLUE} LOG:${YELLOW} Installing Debian build dependencies...${NC}"
sudo DEBIAN_FRONTEND=noninteractive apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y gfortran curl tar
# 2. Setup Rig Paths
export RIG_HOME="$HOME/.programming/r"
export RIG_BIN="$RIG_HOME/bin"
export PATH="$RIG_BIN:$PATH"
# 3. Install Rig Binary
if [ ! -f "$RIG_BIN/rig" ]; then
echo -e "${BLUE} LOG:${YELLOW} Downloading Rig binary...${NC}"
mkdir -p "$RIG_BIN"
# Robust URL Fetching
LATEST_REL_DATA=$(curl -s https://api.github.com/repos/r-lib/rig/releases/latest)
RIG_URL=$(echo "$LATEST_REL_DATA" | grep -o 'https://[^"]*rig-linux-[^"]*\.tar\.gz' | head -n 1)
@ -64,7 +50,6 @@ elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then
exit 1
fi
# Extract to temp
TEMP_EXTRACT=$(mktemp -d)
curl -L -s "$RIG_URL" | tar -xz -C "$TEMP_EXTRACT"
FOUND_BIN=$(find "$TEMP_EXTRACT" -name "rig" -type f | head -n 1)
@ -78,7 +63,6 @@ elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then
rm -rf "$TEMP_EXTRACT"
fi
# 4. Install R via Rig
TARGET_VER="release"
if ! "$RIG_BIN/rig" list | grep -q "release"; then
echo -e "${BLUE} LOG:${YELLOW} Installing R (${TARGET_VER})...${NC}"
@ -86,19 +70,11 @@ elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then
sudo "$RIG_BIN/rig" default "$TARGET_VER"
fi
# Define R binary path for the renv step
R_BIN="$RIG_BIN/rig run"
fi
# ------------------------------------------------------------------
# COMMON: RENV (Dependency Management)
# This works the same on both systems.
# ------------------------------------------------------------------
echo -e "${BLUE} LOG:${YELLOW} Installing 'renv' package globally...${NC}"
# We use a small R script to install renv if missing
# Note: On Arch, $R_BIN is just "R". On Ubuntu, it might be "rig run".
$R_BIN -e 'if (!require("renv", quietly=TRUE)) install.packages("renv", repos="https://cloud.r-project.org")'
echo -e "${GREEN} SUCCESS:${NC} R setup completed."

View File

@ -1,45 +1,36 @@
#!/bin/bash
set -e
# Path: scripts/rust.sh
set -e
BLUE='\033[1;34m'
YELLOW='\033[1;33m'
GREEN='\033[1;32m'
NC='\033[0m'
# 1. Define Custom Paths (The Black Box)
export RUSTUP_HOME="$HOME/.programming/rust/multirust"
export CARGO_HOME="$HOME/.programming/rust/cargo"
echo -e "${BLUE} LOG:${YELLOW} Setting up Rust (Rustup) in ${CARGO_HOME}...${NC}"
# 2. Install Rustup (if missing)
if [ ! -f "$CARGO_HOME/bin/rustup" ]; then
echo -e "${BLUE} LOG:${YELLOW} Installing Rustup to custom path...${NC}"
# Create parent dirs to be safe
mkdir -p "$RUSTUP_HOME" "$CARGO_HOME"
# Install: --no-modify-path keeps your .zshrc clean (we manage it manually)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path
else
echo -e "${GREEN} LOG: Rustup already installed in custom path.${NC}"
fi
# 3. Source Environment
# This loads cargo into the PATH for the rest of this script
if [ -f "$CARGO_HOME/env" ]; then
source "$CARGO_HOME/env"
fi
# 4. Verify and Update
if command -v cargo &> /dev/null; then
echo -e "${BLUE} LOG:${YELLOW} Updating toolchain...${NC}"
rustup default stable
rustup update
# CRITICAL FOR LEARNING: Install source code for the standard library
# This allows you to inspect 'std' code in your IDE (VS Code/Neovim)
echo -e "${BLUE} LOG:${YELLOW} Installing rust-src for 'Go to Definition'...${NC}"
rustup component add rust-src