Compare commits

...

16 Commits

Author SHA1 Message Date
MangoPig
1e2515a21a Fedora Fix 2026-05-31 20:48:18 +01:00
MangoPig
5e7031d700 Fedora Setup 2026-05-29 15:57:17 +01:00
MangoPig
ad39f07b34 Accept pnpm 2026-05-25 16:41:54 +01:00
MangoPig
689a2dc079 R Script Fix 2026-05-05 11:18:52 +01:00
MangoPig
87fb89a6b7 Azure 2025-12-11 04:55:40 +00:00
MangoPig
d41626190d Adding curl too 2025-12-09 03:31:07 +00:00
MangoPig
f359bb68eb Add Ninja to base 2025-12-09 03:29:57 +00:00
MangoPig
69f7a5d4d5 Password no interactive 2025-12-06 10:10:29 +00:00
MangoPig
b0db2dfaf6 Adding a base setup 2025-12-06 10:01:13 +00:00
MangoPig
7743665917 Cpp 2025-12-06 09:27:49 +00:00
MangoPig
3ba98e21ad Changing Location 2025-12-05 19:49:08 +00:00
MangoPig
28027b31ab Fix 2025-12-05 19:27:06 +00:00
MangoPig
75ffecbfb6 Add clean and stow to setup 2025-12-05 19:25:37 +00:00
MangoPig
d3830840c2 Forgot parts of it 2025-12-05 19:10:41 +00:00
MangoPig
ece7ac7a0b Old Package Detection 2025-12-05 19:09:46 +00:00
MangoPig
cf670488ac Python 2025-12-05 19:01:00 +00:00
15 changed files with 842 additions and 155 deletions

View File

@@ -72,3 +72,23 @@ if grep -qEi "(Microsoft|WSL)" /proc/version &> /dev/null; then
fi
fi
fi
alias local-stt="python ~/Application/STT/stt.py"
# Vault
alias vl="vault login -method=userpass username=mangopig"
alias vs="vault status"
alias vkv="vault kv get"
alias vkvl="vault kv list"
# Proxy
proxy_on() {
export ALL_PROXY=socks5h://192.168.1.26:1080
export HTTP_PROXY=socks5h://192.168.1.26:1080
export HTTPS_PROXY=socks5h://192.168.1.26:1080
echo "Proxy ON (Mullvad NL)"
}
proxy_off() {
unset ALL_PROXY HTTP_PROXY HTTPS_PROXY
echo "Proxy OFF (direct)"
}

31
.zshenv Normal file
View File

@@ -0,0 +1,31 @@
# ENV File
export GOGC=500
# CodeGraphContext defaults
export CGC_RUNTIME_DB_TYPE=kuzudb
export KUZUDB_PATH="$HOME/.codegraphcontext/kuzudb"
export PATH=/home/mangopig/.opencode/bin:$PATH
export OPENCHAMBER_HOST=0.0.0.0
export AZURE_COGNITIVE_SERVICES_RESOURCE_NAME="$AZURE_URL"
export VAULT_ADDR="http://192.168.30.53:8200"
export OPENCHAMBER_UI_PASSWORD="$VM_SUDO_PASS"
export AZURE_RESOURCE_NAME="$AZURE_URL"
export PLANNOTATOR_PORT=9999
# OpenCode Secrets
export TAOBAO_API_KEY="sk-BCjuuzYOkaR0L1lBpcqP4N9VWnIh6XoVWghltVjBvk5GQneL"
export AZURE_OPENAI_API_KEY="6ebJTnqeDNv66eoYUmKscjb9bOmR1gE7vRcBnH9zLFnFT1Dy6a6XJQQJ99CBACfhMk5XJ3w3AAAAACOGDFaj"
export FOUNDRY_ANTHROPIC_API_KEY="$AZURE_OPENAI_API_KEY"
export CHROMA_OPENAI_API_KEY="$AZURE_OPENAI_API_KEY"
export OUTLINE_MOKU_TOKEN="ol_api_jZbStf5YaAxWlfT5fE79xgKPKW82cfUn8NaSK9"
export OUTLINE_MOKU_AUTHORIZATION="Bearer $OUTLINE_MOKU_TOKEN"
export DOKPLOY_API_KEY="CkiyeXRRImWOKeVkFAAfdoBjwHmbXoSKXNRWFwnhjKlhHnTkxBfVZDpvmXYAWgbQ"
export N8N_AUTH="725ce955821a3f92c9e85d428cd157a890c6209f254a8d31edca41ddc4b8a324"
export CONTEXT7_API_KEY="ctx7sk-3c4a0f0a-f9c4-4d45-a2a1-765f5dfa33ba"
export GITEA_ACCESS_TOKEN="51bd8f571def772ed54a3e8317189abaa7d5a1e5"
export NETDATA_TOKEN="67e9f974-be37-4bbd-9d1e-4541613fa119"
export OBSIDIAN_API_KEY="360159f3b5b72953b3dd28ebd8e24215117e67478a7333bcc6c0e43a4bfc3720"

63
.zshrc
View File

@@ -1,26 +1,30 @@
# .zshrc
# Path to your Oh My Zsh installation.
# Zsh Configuration
export ZSH="$HOME/.oh-my-zsh"
PROMPT="%B%~%b :: "
RPROMPT="%n@%m"
# Plugins
plugins=(git zsh-syntax-highlighting zsh-autosuggestions)
plugins=(git zsh-syntax-highlighting zsh-autosuggestions sudo rclone rust nvm golang conda pyenv)
source $ZSH/oh-my-zsh.sh
# Golang and GVM
[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"
# Programming Languages Root
export PROG_DIR="$HOME/.programming"
# Go and GVM (Black Box)
export GVM_ROOT="$PROG_DIR/go"
[[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"
# Node and NVM (Lazy Load)
export NVM_DIR="$HOME/.nvm"
export NVM_DIR="$PROG_DIR/node"
nvm_load() {
echo "💤 Waking up NVM..."
unset -f nvm node npm npx
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
"$@"
}
@@ -30,7 +34,27 @@ npm() { nvm_load "npm" "$@"; }
npx() { nvm_load "npx" "$@"; }
# Rust and Cargo
[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"
export RUSTUP_HOME="$PROG_DIR/rust/multirust"
export CARGO_HOME="$PROG_DIR/rust/cargo"
# Python (Pyenv + Miniconda)
export PYENV_ROOT="$PROG_DIR/python/pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
if command -v conda >/dev/null 2>&1; then
CONDA_BASE=$(conda info --base)
[ -f "$CONDA_BASE/etc/profile.d/conda.sh" ] && source "$CONDA_BASE/etc/profile.d/conda.sh"
fi
# R and Rig
export RIG_HOME="$PROG_DIR/r"
if [ -d "$RIG_HOME/bin" ]; then
export PATH="$RIG_HOME/bin:$PATH"
fi
# Zoxide
eval "$(zoxide init --cmd cd zsh)"
@@ -39,19 +63,14 @@ eval "$(zoxide init --cmd cd zsh)"
[ -f ~/.zsh_aliases ] && source ~/.zsh_aliases
[ -f ~/.zsh_secrets ] && source ~/.zsh_secrets
# Conda (Dynamic Path)
# __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
# Add to PATH
export PATH="$HOME/.local/bin:$PATH"
export PATH="/usr/local/go/bin:$PATH"
export PATH="$HOME/.local/bin:$CARGO_HOME/bin:$PATH"
export PATH="$GOPATH/bin:$PATH"
# opencode
if ! pgrep -f "openchamber.*7891" > /dev/null; then
openchamber --port 7891 >/dev/null 2>&1
fi
# direnv
eval "$(direnv hook zsh)"

View File

@@ -1,20 +1,46 @@
# Makefile for Dotfiles
# Makefile
REBOOT_MARKER := .setup-reboot-required
# Default target
all: stow
# Full Setup
setup:
@set -e; \
rm -f $(REBOOT_MARKER); \
bash ./scripts/base.sh; \
if [ -f $(REBOOT_MARKER) ]; then \
rm -f $(REBOOT_MARKER); \
echo "Package layering finished. Reboot, then rerun make setup."; \
exit 0; \
fi; \
bash ./scripts/node.sh; \
bash ./scripts/go.sh; \
bash ./scripts/rust.sh; \
bash ./scripts/python.sh; \
if [ -f $(REBOOT_MARKER) ]; then \
rm -f $(REBOOT_MARKER); \
echo "Package layering finished. Reboot, then rerun make setup."; \
exit 0; \
fi; \
bash ./scripts/r.sh; \
if [ -f $(REBOOT_MARKER) ]; then \
rm -f $(REBOOT_MARKER); \
echo "Package layering finished. Reboot, then rerun make setup."; \
exit 0; \
fi; \
$(MAKE) clean; \
$(MAKE) stow; \
echo "Full setup completed."
base:
bash ./scripts/base.sh
bash ./scripts/node.sh
bash ./scripts/go.sh
bash ./scripts/rust.sh
bash ./scripts/python.sh
@echo "Full setup completed."
@echo "Base setup completed."
# Just stow the dotfiles
stow:
stow . --target=$$HOME --ignore=".git" --ignore=".gitignore" --ignore="README.md" --ignore=".zsh_secrets" --ignore=".zsh_secrets.example" --ignore="LICENSE" --ignore="Makefile"
stow . --target=$$HOME --ignore=".git" --ignore=".gitignore" --ignore="README.md" --ignore=".zsh_secrets" --ignore=".zsh_secrets.example" --ignore="LICENSE" --ignore="Makefile" --ignore="bin" --ignore="scripts"
@echo "Dotfiles linked."
# Clean old files and links
@@ -25,10 +51,7 @@ clean:
# Pull Git Updates
update:
git pull origin main
make setup
base:
bash ./scripts/base.sh
$(MAKE) setup
# Language Setups
node:
@@ -43,6 +66,12 @@ rust:
python:
bash ./scripts/python.sh
r:
bash ./scripts/r.sh
cpp:
bash ./scripts/cpp.sh
storagebox:
bash ./scripts/storagebox.sh
@@ -60,3 +89,8 @@ 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"
test-fedora:
@echo "Spawning Fedora Container..."
docker run -it --rm -e TERM=xterm-256color -v $(PWD):/root/dotfiles fedora:latest \
bash -c "dnf install -y git make sudo curl which passwd procps-ng && cd /root/dotfiles && make setup"

0
TODO.md Normal file
View File

22
scripts/azure.sh Normal file
View File

@@ -0,0 +1,22 @@
#!/bin/bash
# Path: scripts/azure.sh
echo "Checking disks..."
lsblk | grep nvme
sudo mkfs.xfs -f /dev/nvme0n1
sudo mkdir -p /mnt/nvme
sudo mount /dev/nvme0n1 /mnt/nvme
sudo chown -R $USER:$USER /mnt/nvme
echo "NVMe mounted at /mnt/nvme"
df -h /mnt/nvme
# rclone sync -P --transfers=16 hetzner-box:models/Qwen3-30B-A3B-Instruct-2507 /mnt/nvme/Qwen3-30B-A3B-Instruct-2507
# rclone sync -P --transfers=16 /mnt/nvme/Qwen3-70B-Instruct-2024-12-04 hetzner-box:models/Qwen3-70B-Instruct-2024-12-04

View File

@@ -1,7 +1,9 @@
#!/bin/bash
# Path: scripts/base.sh
set -e
# Colors
BLUE='\033[1;34m'
YELLOW='\033[1;33m'
GREEN='\033[1;32m'
@@ -10,15 +12,10 @@ NC='\033[0m'
DOTFILES_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
REPO_ROOT="$(dirname "$DOTFILES_DIR")"
source "$DOTFILES_DIR/lib/distro.sh"
echo -e "${BLUE} LOG:${YELLOW} Initializing Base System Layer...${NC}"
# OS Detection
if [ -f /etc/os-release ]; then
. /etc/os-release
OS=$ID
fi
# Confirm Architecture
ARCH=$(uname -m)
if [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "aarch64" ]; then
@@ -26,31 +23,181 @@ if [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "aarch64" ]; then
exit 1
fi
# 2. Package Installation (OS Dependencies)
# Note: Removed 'go', 'npm', 'cargo' - these are handled by specific scripts
# 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
rclone
# 'eza' is REMOVED from here for Ubuntu logic below
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 direnv
bind nmap socat tcpdump net-tools
strace gdb hexyl
ninja-build libcurl4-openssl-dev
just
)
if [ "$OS" == "arch" ] || [ "$OS" == "manjaro" ]; then
# Arch has eza in the community repo
sudo pacman -Sy --noconfirm --needed "${PACKAGES[@]}" base-devel
elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then
sudo DEBIAN_FRONTEND=noninteractive apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y "${PACKAGES[@]}" bsdmainutils pkg-config cmake
FINAL_PACKAGES=()
for pkg in "${PACKAGES[@]}"; do
case "$pkg" in
"build-essential")
if is_arch_family; then
FINAL_PACKAGES+=(base-devel)
elif is_debian_family; then
FINAL_PACKAGES+=(build-essential)
elif is_fedora_family; then
FINAL_PACKAGES+=(gcc gcc-c++ make patch)
fi
continue
;;
"python")
if is_arch_family; then
FINAL_PACKAGES+=(python)
elif is_debian_family; then
FINAL_PACKAGES+=(python3 python3-pip python3-venv)
elif is_fedora_family; then
FINAL_PACKAGES+=(python3 python3-pip)
fi
continue
;;
"fd")
if is_arch_family; then
FINAL_PACKAGES+=(fd)
elif is_debian_family || is_fedora_family; then
FINAL_PACKAGES+=(fd-find)
fi
continue
;;
"bat")
FINAL_PACKAGES+=(bat)
continue
;;
"openssl")
if is_arch_family; then
FINAL_PACKAGES+=(openssl)
elif is_debian_family; then
FINAL_PACKAGES+=(libssl-dev)
elif is_fedora_family; then
FINAL_PACKAGES+=(openssl openssl-devel)
fi
continue
;;
"bind")
if is_arch_family; then
FINAL_PACKAGES+=(bind)
elif is_debian_family; then
FINAL_PACKAGES+=(dnsutils)
elif is_fedora_family; then
FINAL_PACKAGES+=(bind-utils)
fi
continue
;;
"ninja-build")
if is_arch_family; then
FINAL_PACKAGES+=(ninja)
elif is_debian_family || is_fedora_family; then
FINAL_PACKAGES+=(ninja-build)
fi
continue
;;
"libcurl4-openssl-dev")
if is_arch_family; then
FINAL_PACKAGES+=(curl)
elif is_debian_family; then
FINAL_PACKAGES+=(libcurl4-openssl-dev)
elif is_fedora_family; then
FINAL_PACKAGES+=(libcurl-devel)
fi
continue
;;
"gnupg")
if is_fedora_family; then
FINAL_PACKAGES+=(gnupg2)
else
FINAL_PACKAGES+=(gnupg)
fi
continue
;;
*)
esac
FINAL_PACKAGES+=("$pkg")
done
if is_debian_family; then
FINAL_PACKAGES+=(ca-certificates bsdmainutils pkg-config cmake)
fi
# Moving Pre-Built bin to /usr/local/bin
if is_fedora_family; then
FINAL_PACKAGES+=(ca-certificates pkgconf-pkg-config cmake)
FINAL_PACKAGES+=(R-core gcc-gfortran bzip2 bzip2-devel readline-devel sqlite sqlite-devel tk-devel libffi-devel xz xz-devel ncurses-devel zlib-devel findutils llvm)
fi
echo -e "${BLUE} LOG:${YELLOW} Installing: ${NC}${FINAL_PACKAGES[*]}"
install_status=0
install_packages "${FINAL_PACKAGES[@]}" || install_status=$?
if [ "$install_status" -eq 42 ]; then
exit 0
elif [ "$install_status" -ne 0 ]; then
exit "$install_status"
fi
if is_debian_family || is_fedora_family; then
echo -e "${BLUE} LOG:${YELLOW} Fixing fd/bat binary names when needed...${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
# Moving Pre-Built bin to .local/bin
mkdir -p "$HOME/.local/bin"
cp -f "$REPO_ROOT/bin/"* "$HOME/.local/bin/"
chmod +x "$HOME/.local/bin/"*
# 3. Docker Installation
if ! command -v rclone &> /dev/null; then
echo -e "${BLUE} LOG:${YELLOW} Installing Rclone CLI...${NC}"
case "$ARCH" in
x86_64)
RCLONE_ARCH="amd64"
;;
aarch64)
RCLONE_ARCH="arm64"
;;
esac
TEMP_DIR="$(mktemp -d)"
RCLONE_ZIP="$TEMP_DIR/rclone.zip"
curl -fLsS "https://downloads.rclone.org/rclone-current-linux-${RCLONE_ARCH}.zip" -o "$RCLONE_ZIP"
unzip -q "$RCLONE_ZIP" -d "$TEMP_DIR"
install -m 755 "$TEMP_DIR"/rclone-*-linux-"${RCLONE_ARCH}"/rclone "$HOME/.local/bin/rclone"
rm -rf "$TEMP_DIR"
fi
if ! command -v earthly &> /dev/null; then
echo -e "${BLUE} LOG:${YELLOW} Installing Earthly CLI...${NC}"
case "$ARCH" in
x86_64)
EARTHLY_ARCH="amd64"
;;
aarch64)
EARTHLY_ARCH="arm64"
;;
esac
curl -fLsS "https://github.com/earthly/earthly/releases/latest/download/earthly-linux-${EARTHLY_ARCH}" \
-o "$HOME/.local/bin/earthly"
chmod +x "$HOME/.local/bin/earthly"
fi
# Docker Installation
if command -v docker &> /dev/null; then
echo -e "${GREEN} LOG: Docker is already installed.${NC}"
else
@@ -59,18 +206,27 @@ else
echo -e "${RED} >>> Please install Docker Desktop on Windows.${NC}"
else
echo -e "${BLUE} LOG:${YELLOW} Installing Native Docker...${NC}"
if [ "$OS" == "arch" ]; then
if is_arch_family; then
sudo pacman -S --noconfirm --needed docker docker-compose
sudo systemctl enable --now docker
elif [ "$OS" == "ubuntu" ]; then
# (Simplified for brevity - standard Docker install logic)
elif is_debian_family; then
curl -fsSL https://get.docker.com | sh
elif is_fedora_family; then
if is_atomic_fedora; then
echo -e "${YELLOW} NOTE:${NC} Skipping native Docker auto-install on rpm-ostree systems."
echo -e "${YELLOW} NOTE:${NC} After reboot, install your preferred container runtime separately if needed."
else
sudo dnf install -y moby-engine docker-compose
sudo systemctl enable --now docker
fi
fi
# Add user to group
if getent group docker >/dev/null 2>&1; then
sudo usermod -aG docker $(whoami)
fi
fi
fi
# 4. Zsh & Configuration
if [ ! -d "$HOME/.oh-my-zsh" ]; then
@@ -97,8 +253,17 @@ rm -f "$HOME/.zshrc" "$HOME/.zsh_aliases"
touch "$HOME/.zsh_secrets"
# 7. Set Shell
if [ "$SHELL" != "$(which zsh)" ]; then
sudo chsh -s "$(which zsh)" $(whoami)
TARGET_SHELL="$(command -v zsh)"
CURRENT_LOGIN_SHELL="$(getent passwd "$(whoami)" | cut -d: -f7)"
if [ "$CURRENT_LOGIN_SHELL" != "$TARGET_SHELL" ]; then
if command -v chsh >/dev/null 2>&1; then
sudo chsh -s "$TARGET_SHELL" "$(whoami)"
elif command -v usermod >/dev/null 2>&1; then
sudo usermod -s "$TARGET_SHELL" "$(whoami)"
else
echo -e "${YELLOW} NOTE:${NC} Could not find chsh/usermod. Please change your login shell to $TARGET_SHELL manually."
fi
fi
echo -e "${GREEN} LOG: Base System Setup Complete.${NC}"

38
scripts/cpp.sh Normal file
View File

@@ -0,0 +1,38 @@
#!/bin/bash
# Path: scripts/cpp.sh
set -e
BLUE='\033[1;34m'
YELLOW='\033[1;33m'
GREEN='\033[1;32m'
NC='\033[0m'
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$SCRIPT_DIR/lib/distro.sh"
echo -e "${BLUE} LOG:${YELLOW} Setting up C++ Tooling (LLVM/Clang)...${NC}"
if is_arch_family; then
CPP_PACKAGES=(clang cmake ninja lldb gdb)
elif is_debian_family || is_fedora_family; then
CPP_PACKAGES=(clang cmake ninja-build lldb gdb)
else
echo -e "${RED} ERROR:${NC} Unsupported OS: $OS"
exit 1
fi
install_status=0
install_packages "${CPP_PACKAGES[@]}" || install_status=$?
if [ "$install_status" -eq 42 ]; then
exit 0
elif [ "$install_status" -ne 0 ]; then
exit "$install_status"
fi
echo -e "${GREEN} SUCCESS:${NC} C++ Environment Ready."
echo -e " - Compiler: $(clang --version | head -n 1)"
echo -e " - Builder: $(cmake --version | head -n 1)"
echo -e " - Debugger: $(lldb --version | head -n 1)"

View File

@@ -1,46 +1,80 @@
#!/bin/bash
# Path: scripts/go.sh
set -e
BLUE='\033[1;34m'
YELLOW='\033[1;33m'
GREEN='\033[1;32m'
RED='\033[1;31m'
NC='\033[0m'
echo -e "${BLUE} LOG:${YELLOW} Setting up Go (GVM)...${NC}"
export GVM_ROOT="$HOME/.programming/go"
BOOTSTRAP_GO="$GVM_ROOT/bootstrap"
# 1. Install GVM dependencies
unalias cd 2>/dev/null || true
ARCH="$(uname -m)"
# 2. Install GVM if missing
if [ ! -d "$HOME/.gvm" ]; then
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
case "$ARCH" in
x86_64)
GO_BOOTSTRAP_ARCH="amd64"
;;
aarch64)
GO_BOOTSTRAP_ARCH="arm64"
;;
*)
echo -e "${RED} ERROR:${NC} Unsupported architecture for Go bootstrap: $ARCH"
exit 1
;;
esac
echo -e "${BLUE} LOG:${YELLOW} Setting up Go and GVM in ${GVM_ROOT}...${NC}"
if [ ! -d "$GVM_ROOT/scripts" ]; then
echo -e "${BLUE} LOG:${YELLOW} Cloning GVM...${NC}"
git clone https://github.com/moovweb/gvm.git "$GVM_ROOT"
rm -rf "$GVM_ROOT/.git"
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"
echo -e "${GREEN} SUCCESS:${NC} GVM cloned and configured."
else
echo -e "${GREEN} SKIP:${NC} GVM already installed."
fi
# 3. Load GVM
[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"
if [ ! -d "$BOOTSTRAP_GO" ]; then
echo -e "${BLUE} LOG:${YELLOW} Downloading Bootstrap Go...${NC}"
mkdir -p "$BOOTSTRAP_GO"
# 4. Install Go
# Use a known stable version that exists. 1.24.11 is speculative. 1.24.0 is real.
TARGET_GO="go1.24.0"
wget -q "https://go.dev/dl/go1.20.5.linux-${GO_BOOTSTRAP_ARCH}.tar.gz" -O /tmp/go-bootstrap.tar.gz
tar -C "$BOOTSTRAP_GO" -xzf /tmp/go-bootstrap.tar.gz --strip-components=1
rm /tmp/go-bootstrap.tar.gz
if command -v gvm &> /dev/null; then
if [[ $(gvm list) != *"$TARGET_GO"* ]]; then
echo -e "${BLUE} LOG:${YELLOW} Installing $TARGET_GO...${NC}"
# Try Binary install first (Fastest/Safest)
gvm install "$TARGET_GO" -B || {
echo -e "${RED} LOG: Binary failed. Bootstrapping via go1.22.9...${NC}"
gvm install go1.22.9 -B
gvm use go1.22.9
gvm install "$TARGET_GO"
}
gvm use "$TARGET_GO" --default
echo -e "${GREEN} LOG: Go setup complete.$(go version)${NC}"
echo -e "${GREEN} SUCCESS:${NC} Bootstrap Go installed."
else
echo -e "${GREEN} LOG: $TARGET_GO already installed.${NC}"
echo -e "${GREEN} SKIP:${NC} Bootstrap Go already exists."
fi
else
echo -e "${RED} ERROR: GVM failed to load.${NC}"
export PATH="$BOOTSTRAP_GO/bin:$PATH"
export GOROOT_BOOTSTRAP="$BOOTSTRAP_GO"
set +e
source "$GVM_ROOT/scripts/gvm"
set -e
if ! command -v gvm &> /dev/null; then
echo -e "${RED} ERROR:${NC} GVM failed to load."
exit 1
fi
TARGET_VER="go1.24.11"
if ! gvm list | grep -q "$TARGET_VER"; then
echo -e "${BLUE} LOG:${YELLOW} Installing ${TARGET_VER}...${NC}"
gvm install "$TARGET_VER" --prefer-binary
fi
gvm use "$TARGET_VER" --default
echo -e "${GREEN} SUCCESS:${NC} Go setup completed."

131
scripts/lib/distro.sh Normal file
View File

@@ -0,0 +1,131 @@
#!/bin/bash
# Shared distro helpers for install scripts.
SCRIPT_LIB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="${REPO_ROOT:-$(dirname "$(dirname "$SCRIPT_LIB_DIR")")}"
REBOOT_MARKER="${REBOOT_MARKER:-$REPO_ROOT/.setup-reboot-required}"
if [ -f /etc/os-release ]; then
. /etc/os-release
OS="${ID}"
OS_LIKE="${ID_LIKE:-}"
else
echo "Unable to detect operating system: /etc/os-release not found."
return 1 2>/dev/null || exit 1
fi
is_arch_family() {
[[ "$OS" == "arch" || "$OS" == "manjaro" || " $OS_LIKE " == *" arch "* ]]
}
is_debian_family() {
[[ "$OS" == "ubuntu" || "$OS" == "debian" || " $OS_LIKE " == *" debian "* ]]
}
is_fedora_family() {
[[ "$OS" == "fedora" || "$OS" == "bazzite" || " $OS_LIKE " == *" fedora "* || " $OS_LIKE " == *" rhel "* ]]
}
is_atomic_fedora() {
is_fedora_family && command -v rpm-ostree >/dev/null 2>&1 && [ -f /run/ostree-booted ]
}
mark_reboot_required() {
touch "$REBOOT_MARKER"
echo ""
echo " REBOOT REQUIRED: Fedora atomic package layering finished."
echo " Please reboot, then rerun the same make target."
echo ""
}
get_atomic_requested_packages() {
local python_bin=""
local candidate
for candidate in python3 python /usr/libexec/platform-python; do
if command -v "$candidate" >/dev/null 2>&1; then
python_bin="$candidate"
break
fi
done
if [ -z "$python_bin" ]; then
return 0
fi
rpm-ostree status --json 2>/dev/null | "$python_bin" -c '
import json, sys
try:
data = json.load(sys.stdin)
except Exception:
raise SystemExit(0)
for deployment in data.get("deployments", []):
if deployment.get("booted"):
for key in ("requested-packages", "requested-local-packages"):
for package in deployment.get(key, []):
if package:
print(package)
break
'
}
install_packages() {
local packages=("$@")
if [ ${#packages[@]} -eq 0 ]; then
return 0
fi
if is_arch_family; then
sudo pacman -S --noconfirm --needed "${packages[@]}"
return 0
fi
if is_debian_family; then
sudo DEBIAN_FRONTEND=noninteractive apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y "${packages[@]}"
return 0
fi
if is_fedora_family; then
if is_atomic_fedora; then
local requested_pkg
local missing_packages=()
declare -A requested_packages=()
local pkg
while IFS= read -r requested_pkg; do
[ -n "$requested_pkg" ] && requested_packages["$requested_pkg"]=1
done < <(get_atomic_requested_packages)
for pkg in "${packages[@]}"; do
if rpm -q "$pkg" >/dev/null 2>&1; then
continue
fi
if [ -n "${requested_packages[$pkg]:-}" ]; then
continue
fi
missing_packages+=("$pkg")
done
if [ ${#missing_packages[@]} -eq 0 ]; then
return 0
fi
sudo rpm-ostree install "${missing_packages[@]}"
mark_reboot_required
return 42
fi
sudo dnf install -y "${packages[@]}"
return 0
fi
echo "Unsupported OS: $OS"
return 1
}

View File

@@ -1,33 +1,39 @@
#!/bin/bash
set -e # Exit on error
# Path: scripts/node.sh
set -e
BLUE='\033[1;34m'
YELLOW='\033[1;33m'
GREEN='\033[1;32m'
NC='\033[0m'
echo -e "${BLUE} LOG:${YELLOW} Setting up Node.js (NVM)...${NC}"
export NVM_DIR="$HOME/.programming/node"
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
export NVM_DIR="$HOME/.nvm"
echo -e "${BLUE} LOG:${YELLOW} Setting up Node.js (NVM) in ${NVM_DIR}...${NC}"
# 1. Install NVM
if [ ! -d "$NVM_DIR" ]; then
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
mkdir -p "$NVM_DIR"
echo -e "${BLUE} LOG:${YELLOW} Installing NVM to custom path...${NC}"
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | PROFILE=/dev/null bash
fi
# 2. Load NVM
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
# 3. Install Node
if command -v nvm &> /dev/null; then
echo -e "${BLUE} LOG:${YELLOW} Installing LTS...${NC}"
nvm install --lts
echo -e "${BLUE} LOG:${YELLOW} Installing Node LTS...${NC}"
nvm install --lts --no-progress
nvm use --lts
echo -e "${BLUE} LOG:${YELLOW} Installing Global Tools...${NC}"
# set +e is safer for npm global installs which can be noisy
set +e
npm install -g pnpm yarn
set -e
echo -e "${BLUE} LOG:${YELLOW} Enabling Corepack (pnpm/yarn)...${NC}"
corepack enable
echo -e "${GREEN} LOG: Node setup complete. $(node -v)${NC}"
echo -e "${GREEN} LOG: Package Managers: pnpm $(pnpm -v), yarn $(yarn -v)${NC}"
else
echo -e "${RED} ERROR: NVM failed to load from $NVM_DIR${NC}"
exit 1
fi

View File

@@ -1,7 +1,9 @@
#!/bin/bash
# Path: scripts/provision.sh
set -e
# Colors
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
RED='\033[1;31m'
@@ -10,21 +12,16 @@ NC='\033[0m'
DEFAULT_USER="mangopig"
DEFAULT_UID="1000"
DEFAULT_GID="1000"
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$SCRIPT_DIR/lib/distro.sh"
# 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}')
@@ -36,22 +33,31 @@ 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
if is_arch_family; then
pacman -Sy --noconfirm git make curl zsh sudo
SUDO_GROUP="wheel"
elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then
elif is_debian_family; then
apt-get update
apt-get install -y git make curl sudo
apt-get install -y git make curl sudo zsh
SUDO_GROUP="sudo"
elif is_fedora_family; then
if is_atomic_fedora; then
echo -e "${RED}Provisioning on Fedora atomic systems is not supported by this root script.${NC}"
echo -e "${RED}Use the normal user workflow and run make setup after login instead.${NC}"
exit 1
fi
dnf install -y git make curl sudo zsh
SUDO_GROUP="wheel"
else
echo -e "${RED}Unsupported OS: $OS${NC}"
exit 1
fi
# Interactive Prompts
ZSH_PATH="$(command -v zsh)"
if [ -t 0 ]; then
echo -e "${GREEN}---------------------------------------${NC}"
echo -e "${GREEN} USER PROVISIONING WIZARD ${NC}"
@@ -67,13 +73,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
@@ -81,31 +85,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
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
if is_arch_family || is_fedora_family; then
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

@@ -1,15 +1,78 @@
#!/bin/bash
# Path: scripts/python.sh
set -e
# Bold Colors
YELLOW='\033[1;33m'
BLUE='\033[1;34m'
RED='\033[1;31m'
YELLOW='\033[1;33m'
GREEN='\033[1;32m'
RED='\033[1;31m'
NC='\033[0m'
# Python Setup
echo -e "${BLUE} LOG:${YELLOW} Setting up Python environment...${NC}"
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$SCRIPT_DIR/lib/distro.sh"
# MiniConda Installation
# Install Build Dependencies
if is_arch_family; then
echo -e "${BLUE} LOG:${YELLOW} Installing Arch build dependencies...${NC}"
PYTHON_BUILD_DEPS=(base-devel openssl zlib xz tk libffi bzip2 git)
elif is_debian_family; then
echo -e "${BLUE} LOG:${YELLOW} Installing Debian build dependencies...${NC}"
PYTHON_BUILD_DEPS=(make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev git)
elif is_fedora_family; then
echo -e "${BLUE} LOG:${YELLOW} Installing Fedora build dependencies...${NC}"
PYTHON_BUILD_DEPS=(make gcc gcc-c++ patch zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel tk-devel libffi-devel xz xz-devel ncurses-devel findutils git)
else
echo -e "${RED} ERROR:${NC} Unsupported OS: $OS"
exit 1
fi
install_status=0
install_packages "${PYTHON_BUILD_DEPS[@]}" || install_status=$?
if [ "$install_status" -eq 42 ]; then
exit 0
elif [ "$install_status" -ne 0 ]; then
exit "$install_status"
fi
# 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}"
# 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"
echo -e "${BLUE} LOG:${YELLOW} Compiling Pyenv dynamic bash extension...${NC}"
cd "$PYENV_ROOT" && src/configure && make -C src
echo -e "${GREEN} SUCCESS:${NC} Pyenv installed."
else
echo -e "${GREEN} SKIP:${NC} Pyenv already installed."
fi
# Initialize Pyenv for this script session
eval "$(pyenv init -)"
# Install Miniforge (The Community Standard)
TARGET_VER="miniforge3-latest"
if ! pyenv versions | grep -q "$TARGET_VER"; then
echo -e "${BLUE} LOG:${YELLOW} Installing ${TARGET_VER}...${NC}"
echo -e "${YELLOW} NOTE: This avoids Anaconda licensing issues and uses conda-forge default.${NC}"
pyenv install "$TARGET_VER"
echo -e "${GREEN} SUCCESS:${NC} Miniforge installed."
else
echo -e "${GREEN} SKIP:${NC} Miniforge already installed."
fi
# Set Global Default
pyenv global "$TARGET_VER"
echo -e "${GREEN} SUCCESS:${NC} Python setup completed. Default is now Miniforge (Conda)."

103
scripts/r.sh Normal file
View File

@@ -0,0 +1,103 @@
#!/bin/bash
# Path: scripts/r.sh
set -e
BLUE='\033[1;34m'
YELLOW='\033[1;33m'
GREEN='\033[1;32m'
RED='\033[1;31m'
NC='\033[0m'
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$SCRIPT_DIR/lib/distro.sh"
echo -e "${BLUE} LOG:${YELLOW} Detecting R installation strategy for $OS...${NC}"
if is_arch_family; then
echo -e "${BLUE} LOG:${YELLOW} Arch Linux detected. Using system R (Pacman)...${NC}"
# Install R + Build Tools
install_status=0
install_packages r gcc-fortran curl tar || install_status=$?
if [ "$install_status" -eq 42 ]; then
exit 0
elif [ "$install_status" -ne 0 ]; then
exit "$install_status"
fi
echo -e "${GREEN} SUCCESS:${NC} R installed via Pacman."
R_BIN="R"
elif is_debian_family; then
echo -e "${BLUE} LOG:${YELLOW} Installing Debian build dependencies...${NC}"
install_status=0
install_packages gfortran curl tar ca-certificates || install_status=$?
if [ "$install_status" -eq 42 ]; then
exit 0
elif [ "$install_status" -ne 0 ]; then
exit "$install_status"
fi
if ! command -v rig >/dev/null 2>&1; then
echo -e "${BLUE} LOG:${YELLOW} Installing Rig for Debian/Ubuntu...${NC}"
DEB_ARCH=$(dpkg --print-architecture)
case "$DEB_ARCH" in
amd64|arm64)
;;
*)
echo -e "${RED} ERROR:${NC} Unsupported Debian architecture for Rig: $DEB_ARCH"
exit 1
;;
esac
LATEST_REL_DATA=$(curl -fsSL https://api.github.com/repos/r-lib/rig/releases/latest)
RIG_URL=$(echo "$LATEST_REL_DATA" | grep -o "https://[^\"]*r-rig_[^\"]*_${DEB_ARCH}\.deb" | head -n 1)
if [ -z "$RIG_URL" ]; then
echo -e "${RED} ERROR:${NC} Could not find Rig .deb download URL for architecture: $DEB_ARCH"
exit 1
fi
TEMP_DEB=$(mktemp --suffix=.deb)
curl -fLsS "$RIG_URL" -o "$TEMP_DEB"
sudo apt-get install -y "$TEMP_DEB"
rm -f "$TEMP_DEB"
fi
TARGET_VER="release"
if ! rig list | grep -q "release"; then
echo -e "${BLUE} LOG:${YELLOW} Installing R (${TARGET_VER})...${NC}"
sudo rig add "$TARGET_VER" --without-cran-mirror
sudo rig default "$TARGET_VER"
fi
R_BIN="rig run"
elif is_fedora_family; then
echo -e "${BLUE} LOG:${YELLOW} Fedora detected. Using system R...${NC}"
install_status=0
install_packages R-core gcc-gfortran curl tar || install_status=$?
if [ "$install_status" -eq 42 ]; then
exit 0
elif [ "$install_status" -ne 0 ]; then
exit "$install_status"
fi
R_BIN="R"
else
echo -e "${RED} ERROR:${NC} Unsupported OS: $OS"
exit 1
fi
echo -e "${BLUE} LOG:${YELLOW} Installing 'renv' package in the user R library...${NC}"
$R_BIN -e 'user_lib <- path.expand(Sys.getenv("R_LIBS_USER", unset = "~/R/library")); dir.create(user_lib, recursive = TRUE, showWarnings = FALSE); .libPaths(c(user_lib, .libPaths())); if (!require("renv", quietly=TRUE)) install.packages("renv", lib = user_lib, repos = "https://cloud.r-project.org")'
echo -e "${GREEN} SUCCESS:${NC} R setup completed."

View File

@@ -1,23 +1,41 @@
#!/bin/bash
# Path: scripts/rust.sh
set -e
BLUE='\033[1;34m'
YELLOW='\033[1;33m'
GREEN='\033[1;32m'
NC='\033[0m'
echo -e "${BLUE} LOG:${YELLOW} Setting up Rust (Rustup)...${NC}"
export RUSTUP_HOME="$HOME/.programming/rust/multirust"
export CARGO_HOME="$HOME/.programming/rust/cargo"
# 1. Install Rustup
if ! command -v rustup &> /dev/null; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo -e "${BLUE} LOG:${YELLOW} Setting up Rust (Rustup) in ${CARGO_HOME}...${NC}"
if [ ! -f "$CARGO_HOME/bin/rustup" ]; then
echo -e "${BLUE} LOG:${YELLOW} Installing Rustup to custom path...${NC}"
mkdir -p "$RUSTUP_HOME" "$CARGO_HOME"
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
# 2. Source Environment
[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"
if [ -f "$CARGO_HOME/env" ]; then
source "$CARGO_HOME/env"
fi
# 3. Update to Stable
if command -v cargo &> /dev/null; then
echo -e "${BLUE} LOG:${YELLOW} Updating toolchain...${NC}"
rustup default stable
rustup update
echo -e "${BLUE} LOG:${YELLOW} Installing rust-src for 'Go to Definition'...${NC}"
rustup component add rust-src
echo -e "${GREEN} LOG: Rust setup complete. $(cargo --version)${NC}"
else
echo -e "${RED} ERROR: Cargo not found in PATH. Check CARGO_HOME.${NC}"
exit 1
fi