Fedora Fix

This commit is contained in:
MangoPig
2026-05-31 20:48:18 +01:00
parent 3f753d0dd0
commit f1a2d08e14
5 changed files with 85 additions and 11 deletions

View File

@@ -7,7 +7,8 @@ all: stow
# Full Setup # Full Setup
setup: setup:
@rm -f $(REBOOT_MARKER); \ @set -e; \
rm -f $(REBOOT_MARKER); \
bash ./scripts/base.sh; \ bash ./scripts/base.sh; \
if [ -f $(REBOOT_MARKER) ]; then \ if [ -f $(REBOOT_MARKER) ]; then \
rm -f $(REBOOT_MARKER); \ rm -f $(REBOOT_MARKER); \
@@ -50,7 +51,7 @@ clean:
# Pull Git Updates # Pull Git Updates
update: update:
git pull origin main git pull origin main
make setup $(MAKE) setup
# Language Setups # Language Setups
node: node:

0
TODO.md Normal file
View File

View File

@@ -33,7 +33,7 @@ PACKAGES=(
python bison mercurial python bison mercurial
ripgrep fd bat fzf jq ripgrep fd bat fzf jq
btop httpie gnupg btop httpie gnupg
zoxide stow zoxide stow direnv
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
@@ -134,6 +134,7 @@ fi
if is_fedora_family; then if is_fedora_family; then
FINAL_PACKAGES+=(ca-certificates pkgconf-pkg-config cmake) 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 fi
echo -e "${BLUE} LOG:${YELLOW} Installing: ${NC}${FINAL_PACKAGES[*]}" echo -e "${BLUE} LOG:${YELLOW} Installing: ${NC}${FINAL_PACKAGES[*]}"
@@ -159,8 +160,24 @@ cp -f "$REPO_ROOT/bin/"* "$HOME/.local/bin/"
chmod +x "$HOME/.local/bin/"* chmod +x "$HOME/.local/bin/"*
if ! command -v rclone &> /dev/null; then if ! command -v rclone &> /dev/null; then
echo -e "${BLUE} LOG:${YELLOW} Installing Rclone (Latest)...${NC}" echo -e "${BLUE} LOG:${YELLOW} Installing Rclone CLI...${NC}"
curl https://rclone.org/install.sh | sudo bash
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 fi
if ! command -v earthly &> /dev/null; then if ! command -v earthly &> /dev/null; then
@@ -236,8 +253,17 @@ rm -f "$HOME/.zshrc" "$HOME/.zsh_aliases"
touch "$HOME/.zsh_secrets" touch "$HOME/.zsh_secrets"
# 7. Set Shell # 7. Set Shell
if [ "$SHELL" != "$(which zsh)" ]; then TARGET_SHELL="$(command -v zsh)"
sudo chsh -s "$(which zsh)" $(whoami) 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 fi
echo -e "${GREEN} LOG: Base System Setup Complete.${NC}" echo -e "${GREEN} LOG: Base System Setup Complete.${NC}"

View File

@@ -39,6 +39,39 @@ mark_reboot_required() {
echo "" 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() { install_packages() {
local packages=("$@") local packages=("$@")
@@ -59,11 +92,25 @@ install_packages() {
if is_fedora_family; then if is_fedora_family; then
if is_atomic_fedora; then if is_atomic_fedora; then
local requested_pkg
local missing_packages=() local missing_packages=()
declare -A requested_packages=()
local pkg 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 for pkg in "${packages[@]}"; do
rpm -q "$pkg" >/dev/null 2>&1 || missing_packages+=("$pkg") if rpm -q "$pkg" >/dev/null 2>&1; then
continue
fi
if [ -n "${requested_packages[$pkg]:-}" ]; then
continue
fi
missing_packages+=("$pkg")
done done
if [ ${#missing_packages[@]} -eq 0 ]; then if [ ${#missing_packages[@]} -eq 0 ]; then

View File

@@ -82,7 +82,7 @@ elif is_fedora_family; then
echo -e "${BLUE} LOG:${YELLOW} Fedora detected. Using system R...${NC}" echo -e "${BLUE} LOG:${YELLOW} Fedora detected. Using system R...${NC}"
install_status=0 install_status=0
install_packages R gcc-gfortran curl tar || install_status=$? install_packages R-core gcc-gfortran curl tar || install_status=$?
if [ "$install_status" -eq 42 ]; then if [ "$install_status" -eq 42 ]; then
exit 0 exit 0
elif [ "$install_status" -ne 0 ]; then elif [ "$install_status" -ne 0 ]; then
@@ -96,8 +96,8 @@ else
exit 1 exit 1
fi fi
echo -e "${BLUE} LOG:${YELLOW} Installing 'renv' package globally...${NC}" echo -e "${BLUE} LOG:${YELLOW} Installing 'renv' package in the user R library...${NC}"
$R_BIN -e 'if (!require("renv", quietly=TRUE)) install.packages("renv", repos="https://cloud.r-project.org")' $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." echo -e "${GREEN} SUCCESS:${NC} R setup completed."