Fedora Setup

This commit is contained in:
MangoPig
2026-05-29 15:57:17 +01:00
parent d5bcda270d
commit 3f753d0dd0
8 changed files with 338 additions and 98 deletions

View File

@@ -1,19 +1,37 @@
# Makefile # Makefile
REBOOT_MARKER := .setup-reboot-required
# Default target # Default target
all: stow all: stow
# Full Setup # Full Setup
setup: setup:
bash ./scripts/base.sh @rm -f $(REBOOT_MARKER); \
bash ./scripts/node.sh bash ./scripts/base.sh; \
bash ./scripts/go.sh if [ -f $(REBOOT_MARKER) ]; then \
bash ./scripts/rust.sh rm -f $(REBOOT_MARKER); \
bash ./scripts/python.sh echo "Package layering finished. Reboot, then rerun make setup."; \
bash ./scripts/r.sh exit 0; \
make clean fi; \
make stow bash ./scripts/node.sh; \
@echo "Full setup completed." 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: base:
bash ./scripts/base.sh bash ./scripts/base.sh
@@ -34,9 +52,6 @@ update:
git pull origin main git pull origin main
make setup make setup
base:
bash ./scripts/base.sh
# Language Setups # Language Setups
node: node:
bash ./scripts/node.sh bash ./scripts/node.sh
@@ -72,4 +87,9 @@ test-ubuntu:
test-arch: test-arch:
@echo "Spawning Arch Container..." @echo "Spawning Arch Container..."
docker run -it --rm -e TERM=xterm-256color -v $(PWD):/root/dotfiles archlinux:latest \ 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" 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"

View File

@@ -12,15 +12,10 @@ NC='\033[0m'
DOTFILES_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DOTFILES_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
REPO_ROOT="$(dirname "$DOTFILES_DIR")" REPO_ROOT="$(dirname "$DOTFILES_DIR")"
source "$DOTFILES_DIR/lib/distro.sh"
echo -e "${BLUE} LOG:${YELLOW} Initializing Base System Layer...${NC}" 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 # Confirm Architecture
ARCH=$(uname -m) ARCH=$(uname -m)
if [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "aarch64" ]; then if [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "aarch64" ]; then
@@ -42,70 +37,118 @@ PACKAGES=(
bind nmap socat tcpdump net-tools bind nmap socat tcpdump net-tools
strace gdb hexyl strace gdb hexyl
ninja-build libcurl4-openssl-dev ninja-build libcurl4-openssl-dev
just
) )
FINAL_LIST="" FINAL_PACKAGES=()
for pkg in "${PACKAGES[@]}"; do for pkg in "${PACKAGES[@]}"; do
case "$pkg" in case "$pkg" in
"build-essential") "build-essential")
[ "$OS" == "arch" ] && pkg="base-devel" if is_arch_family; then
[ "$OS" == "ubuntu" ] && pkg="build-essential" 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") "python")
[ "$OS" == "arch" ] && pkg="python" if is_arch_family; then
[ "$OS" == "ubuntu" ] && pkg="python3 python3-pip python3-venv" 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") "fd")
[ "$OS" == "arch" ] && pkg="fd" if is_arch_family; then
[ "$OS" == "ubuntu" ] && pkg="fd-find" FINAL_PACKAGES+=(fd)
elif is_debian_family || is_fedora_family; then
FINAL_PACKAGES+=(fd-find)
fi
continue
;; ;;
"bat") "bat")
[ "$OS" == "arch" ] && pkg="bat" FINAL_PACKAGES+=(bat)
[ "$OS" == "ubuntu" ] && pkg="bat" continue
;; ;;
"openssl") "openssl")
[ "$OS" == "arch" ] && pkg="openssl" if is_arch_family; then
[ "$OS" == "ubuntu" ] && pkg="libssl-dev" 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") "bind")
[ "$OS" == "arch" ] && pkg="bind" if is_arch_family; then
[ "$OS" == "ubuntu" ] && pkg="dnsutils" FINAL_PACKAGES+=(bind)
elif is_debian_family; then
FINAL_PACKAGES+=(dnsutils)
elif is_fedora_family; then
FINAL_PACKAGES+=(bind-utils)
fi
continue
;; ;;
"ninja-build") "ninja-build")
[ "$OS" == "arch" ] && pkg="ninja" if is_arch_family; then
[ "$OS" == "ubuntu" ] && pkg="ninja-build" FINAL_PACKAGES+=(ninja)
elif is_debian_family || is_fedora_family; then
FINAL_PACKAGES+=(ninja-build)
fi
continue
;; ;;
"libcurl4-openssl-dev") "libcurl4-openssl-dev")
[ "$OS" == "arch" ] && pkg="curl" if is_arch_family; then
[ "$OS" == "ubuntu" ] && pkg="libcurl4-openssl-dev" 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 esac
FINAL_LIST="$FINAL_LIST $pkg" FINAL_PACKAGES+=("$pkg")
done done
if [ "$OS" == "arch" ] || [ "$OS" == "manjaro" ]; then if is_debian_family; then
FINAL_LIST="$FINAL_LIST" FINAL_PACKAGES+=(ca-certificates bsdmainutils pkg-config cmake)
fi fi
if [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then if is_fedora_family; then
FINAL_LIST="$FINAL_LIST ca-certificates bsdmainutils pkg-config cmake" FINAL_PACKAGES+=(ca-certificates pkgconf-pkg-config cmake)
fi fi
echo -e "${BLUE} LOG:${YELLOW} Installing: ${NC}$FINAL_LIST" echo -e "${BLUE} LOG:${YELLOW} Installing: ${NC}${FINAL_PACKAGES[*]}"
if [ "$OS" == "arch" ] || [ "$OS" == "manjaro" ]; then install_status=0
sudo pacman -S --noconfirm --needed $FINAL_LIST install_packages "${FINAL_PACKAGES[@]}" || install_status=$?
elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then if [ "$install_status" -eq 42 ]; then
sudo DEBIAN_FRONTEND=noninteractive apt-get update exit 0
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y $FINAL_LIST elif [ "$install_status" -ne 0 ]; then
exit "$install_status"
fi fi
if [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then if is_debian_family || is_fedora_family; then
echo -e "${BLUE} LOG:${YELLOW} Fixing Ubuntu binary names...${NC}" 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/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 [ -f /usr/bin/batcat ] && sudo ln -sf /usr/bin/batcat /usr/local/bin/bat
fi fi
@@ -120,6 +163,23 @@ if ! command -v rclone &> /dev/null; then
curl https://rclone.org/install.sh | sudo bash curl https://rclone.org/install.sh | sudo bash
fi 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 # Docker Installation
if command -v docker &> /dev/null; then if command -v docker &> /dev/null; then
echo -e "${GREEN} LOG: Docker is already installed.${NC}" echo -e "${GREEN} LOG: Docker is already installed.${NC}"
@@ -129,15 +189,25 @@ else
echo -e "${RED} >>> Please install Docker Desktop on Windows.${NC}" echo -e "${RED} >>> Please install Docker Desktop on Windows.${NC}"
else else
echo -e "${BLUE} LOG:${YELLOW} Installing Native Docker...${NC}" 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 pacman -S --noconfirm --needed docker docker-compose
sudo systemctl enable --now docker sudo systemctl enable --now docker
elif [ "$OS" == "ubuntu" ]; then elif is_debian_family; then
curl -fsSL https://get.docker.com | sh 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 fi
# Add user to group # Add user to group
sudo usermod -aG docker $(whoami) if getent group docker >/dev/null 2>&1; then
sudo usermod -aG docker $(whoami)
fi
fi fi
fi fi
@@ -170,4 +240,4 @@ if [ "$SHELL" != "$(which zsh)" ]; then
sudo chsh -s "$(which zsh)" $(whoami) sudo chsh -s "$(which zsh)" $(whoami)
fi fi
echo -e "${GREEN} LOG: Base System Setup Complete.${NC}" echo -e "${GREEN} LOG: Base System Setup Complete.${NC}"

View File

@@ -9,21 +9,30 @@ YELLOW='\033[1;33m'
GREEN='\033[1;32m' GREEN='\033[1;32m'
NC='\033[0m' NC='\033[0m'
if [ -f /etc/os-release ]; then SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. /etc/os-release source "$SCRIPT_DIR/lib/distro.sh"
OS=$ID
fi
echo -e "${BLUE} LOG:${YELLOW} Setting up C++ Tooling (LLVM/Clang)...${NC}" echo -e "${BLUE} LOG:${YELLOW} Setting up C++ Tooling (LLVM/Clang)...${NC}"
if [ "$OS" == "arch" ] || [ "$OS" == "manjaro" ]; then if is_arch_family; then
sudo pacman -S --noconfirm --needed clang cmake ninja lldb gdb CPP_PACKAGES=(clang cmake ninja lldb gdb)
elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then elif is_debian_family || is_fedora_family; then
sudo DEBIAN_FRONTEND=noninteractive apt-get update CPP_PACKAGES=(clang cmake ninja-build lldb gdb)
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y 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 fi
echo -e "${GREEN} SUCCESS:${NC} C++ Environment Ready." echo -e "${GREEN} SUCCESS:${NC} C++ Environment Ready."
echo -e " - Compiler: $(clang --version | head -n 1)" echo -e " - Compiler: $(clang --version | head -n 1)"
echo -e " - Builder: $(cmake --version | head -n 1)" echo -e " - Builder: $(cmake --version | head -n 1)"
echo -e " - Debugger: $(lldb --version | head -n 1)" echo -e " - Debugger: $(lldb --version | head -n 1)"

View File

@@ -13,6 +13,21 @@ NC='\033[0m'
export GVM_ROOT="$HOME/.programming/go" export GVM_ROOT="$HOME/.programming/go"
BOOTSTRAP_GO="$GVM_ROOT/bootstrap" BOOTSTRAP_GO="$GVM_ROOT/bootstrap"
ARCH="$(uname -m)"
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}" echo -e "${BLUE} LOG:${YELLOW} Setting up Go and GVM in ${GVM_ROOT}...${NC}"
if [ ! -d "$GVM_ROOT/scripts" ]; then if [ ! -d "$GVM_ROOT/scripts" ]; then
@@ -32,7 +47,7 @@ if [ ! -d "$BOOTSTRAP_GO" ]; then
echo -e "${BLUE} LOG:${YELLOW} Downloading Bootstrap Go...${NC}" echo -e "${BLUE} LOG:${YELLOW} Downloading Bootstrap Go...${NC}"
mkdir -p "$BOOTSTRAP_GO" mkdir -p "$BOOTSTRAP_GO"
wget -q https://go.dev/dl/go1.20.5.linux-amd64.tar.gz -O /tmp/go-bootstrap.tar.gz 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 tar -C "$BOOTSTRAP_GO" -xzf /tmp/go-bootstrap.tar.gz --strip-components=1
rm /tmp/go-bootstrap.tar.gz rm /tmp/go-bootstrap.tar.gz
@@ -63,4 +78,3 @@ fi
gvm use "$TARGET_VER" --default gvm use "$TARGET_VER" --default
echo -e "${GREEN} SUCCESS:${NC} Go setup completed." echo -e "${GREEN} SUCCESS:${NC} Go setup completed."

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

@@ -0,0 +1,84 @@
#!/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 ""
}
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 missing_packages=()
local pkg
for pkg in "${packages[@]}"; do
rpm -q "$pkg" >/dev/null 2>&1 || 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

@@ -12,6 +12,8 @@ NC='\033[0m'
DEFAULT_USER="mangopig" DEFAULT_USER="mangopig"
DEFAULT_UID="1000" DEFAULT_UID="1000"
DEFAULT_GID="1000" DEFAULT_GID="1000"
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$SCRIPT_DIR/lib/distro.sh"
if [ "$EUID" -ne 0 ]; then if [ "$EUID" -ne 0 ]; then
echo -e "${RED}Please run this script as root.${NC}" echo -e "${RED}Please run this script as root.${NC}"
@@ -19,10 +21,6 @@ if [ "$EUID" -ne 0 ]; then
fi fi
echo -e "${YELLOW}LOG: Detecting OS...${NC}" echo -e "${YELLOW}LOG: Detecting OS...${NC}"
if [ -f /etc/os-release ]; then
. /etc/os-release
OS=$ID
fi
echo -e "${YELLOW}LOG: Determining primary IPv4 address...${NC}" echo -e "${YELLOW}LOG: Determining primary IPv4 address...${NC}"
if command -v hostname >/dev/null 2>&1 && hostname -I >/dev/null 2>&1; then if command -v hostname >/dev/null 2>&1 && hostname -I >/dev/null 2>&1; then
@@ -37,18 +35,29 @@ fi
echo -e "${YELLOW}LOG: Updating system and installing base tools...${NC}" 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 pacman -Sy --noconfirm git make curl zsh sudo
SUDO_GROUP="wheel" SUDO_GROUP="wheel"
elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then elif is_debian_family; then
apt-get update apt-get update
apt-get install -y git make curl sudo zsh apt-get install -y git make curl sudo zsh
SUDO_GROUP="sudo" 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 else
echo -e "${RED}Unsupported OS: $OS${NC}" echo -e "${RED}Unsupported OS: $OS${NC}"
exit 1 exit 1
fi fi
ZSH_PATH="$(command -v zsh)"
if [ -t 0 ]; then if [ -t 0 ]; then
echo -e "${GREEN}---------------------------------------${NC}" echo -e "${GREEN}---------------------------------------${NC}"
echo -e "${GREEN} USER PROVISIONING WIZARD ${NC}" echo -e "${GREEN} USER PROVISIONING WIZARD ${NC}"
@@ -96,7 +105,7 @@ echo -e "${YELLOW}LOG: Configuring passwordless sudo...${NC}"
echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" > "/etc/sudoers.d/90-$USERNAME" echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" > "/etc/sudoers.d/90-$USERNAME"
chmod 0440 "/etc/sudoers.d/90-$USERNAME" chmod 0440 "/etc/sudoers.d/90-$USERNAME"
if [ "$OS" == "arch" ]; then if is_arch_family || is_fedora_family; then
sed -i 's/^# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/' /etc/sudoers sed -i 's/^# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/' /etc/sudoers
fi fi
@@ -106,4 +115,4 @@ sudo -u "$USERNAME" git clone https://git.mangopig.tech/MangoPig/Dot-Zsh.git "/h
echo -e "${GREEN}✅ Server Provisioned!" echo -e "${GREEN}✅ Server Provisioned!"
echo -e "${GREEN} sudo su - $USERNAME${NC} OR logout and SSH back in as $USERNAME@$IP.${NC}" echo -e "${GREEN} sudo su - $USERNAME${NC} OR logout and SSH back in as $USERNAME@$IP.${NC}"
echo -e "${GREEN} Then run cd ~/Config/Dot-Zsh && make setup ${NC}" echo -e "${GREEN} Then run cd ~/Config/Dot-Zsh && make setup ${NC}"

View File

@@ -9,22 +9,31 @@ GREEN='\033[1;32m'
RED='\033[1;31m' RED='\033[1;31m'
NC='\033[0m' NC='\033[0m'
# OS Detection SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -f /etc/os-release ]; then source "$SCRIPT_DIR/lib/distro.sh"
. /etc/os-release
OS=$ID
fi
# Install Build Dependencies # Install Build Dependencies
if [ "$OS" == "arch" ] || [ "$OS" == "manjaro" ]; then if is_arch_family; then
echo -e "${BLUE} LOG:${YELLOW} Installing Arch build dependencies...${NC}" echo -e "${BLUE} LOG:${YELLOW} Installing Arch build dependencies...${NC}"
sudo pacman -S --noconfirm --needed base-devel openssl zlib xz tk libffi bzip2 git PYTHON_BUILD_DEPS=(base-devel openssl zlib xz tk libffi bzip2 git)
elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then elif is_debian_family; then
echo -e "${BLUE} LOG:${YELLOW} Installing Debian build dependencies...${NC}" echo -e "${BLUE} LOG:${YELLOW} Installing Debian build dependencies...${NC}"
sudo DEBIAN_FRONTEND=noninteractive apt-get update 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)
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y make build-essential libssl-dev zlib1g-dev \ elif is_fedora_family; then
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \ echo -e "${BLUE} LOG:${YELLOW} Installing Fedora build dependencies...${NC}"
libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev git 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 fi
# Define the Black Box Location # Define the Black Box Location
@@ -66,4 +75,4 @@ fi
# Set Global Default # Set Global Default
pyenv global "$TARGET_VER" pyenv global "$TARGET_VER"
echo -e "${GREEN} SUCCESS:${NC} Python setup completed. Default is now Miniforge (Conda)." echo -e "${GREEN} SUCCESS:${NC} Python setup completed. Default is now Miniforge (Conda)."

View File

@@ -9,30 +9,38 @@ GREEN='\033[1;32m'
RED='\033[1;31m' RED='\033[1;31m'
NC='\033[0m' NC='\033[0m'
# OS Detection SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -f /etc/os-release ]; then source "$SCRIPT_DIR/lib/distro.sh"
. /etc/os-release
OS=$ID
fi
echo -e "${BLUE} LOG:${YELLOW} Detecting R installation strategy for $OS...${NC}" echo -e "${BLUE} LOG:${YELLOW} Detecting R installation strategy for $OS...${NC}"
if [ "$OS" == "arch" ] || [ "$OS" == "manjaro" ]; then if is_arch_family; then
echo -e "${BLUE} LOG:${YELLOW} Arch Linux detected. Using system R (Pacman)...${NC}" echo -e "${BLUE} LOG:${YELLOW} Arch Linux detected. Using system R (Pacman)...${NC}"
# Install R + Build Tools # Install R + Build Tools
sudo pacman -S --noconfirm --needed r gcc-fortran curl tar 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." echo -e "${GREEN} SUCCESS:${NC} R installed via Pacman."
R_BIN="R" R_BIN="R"
elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then elif is_debian_family; then
echo -e "${BLUE} LOG:${YELLOW} Installing Debian build dependencies...${NC}" echo -e "${BLUE} LOG:${YELLOW} Installing Debian build dependencies...${NC}"
sudo DEBIAN_FRONTEND=noninteractive apt-get update install_status=0
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y gfortran curl tar ca-certificates 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 if ! command -v rig >/dev/null 2>&1; then
echo -e "${BLUE} LOG:${YELLOW} Installing Rig for Debian/Ubuntu...${NC}" echo -e "${BLUE} LOG:${YELLOW} Installing Rig for Debian/Ubuntu...${NC}"
@@ -69,6 +77,23 @@ elif [ "$OS" == "ubuntu" ] || [ "$OS" == "debian" ]; then
fi fi
R_BIN="rig run" 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 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 fi
echo -e "${BLUE} LOG:${YELLOW} Installing 'renv' package globally...${NC}" echo -e "${BLUE} LOG:${YELLOW} Installing 'renv' package globally...${NC}"