Fedora Fix
This commit is contained in:
5
Makefile
5
Makefile
@@ -7,7 +7,8 @@ all: stow
|
||||
|
||||
# Full Setup
|
||||
setup:
|
||||
@rm -f $(REBOOT_MARKER); \
|
||||
@set -e; \
|
||||
rm -f $(REBOOT_MARKER); \
|
||||
bash ./scripts/base.sh; \
|
||||
if [ -f $(REBOOT_MARKER) ]; then \
|
||||
rm -f $(REBOOT_MARKER); \
|
||||
@@ -50,7 +51,7 @@ clean:
|
||||
# Pull Git Updates
|
||||
update:
|
||||
git pull origin main
|
||||
make setup
|
||||
$(MAKE) setup
|
||||
|
||||
# Language Setups
|
||||
node:
|
||||
|
||||
@@ -33,7 +33,7 @@ PACKAGES=(
|
||||
python bison mercurial
|
||||
ripgrep fd bat fzf jq
|
||||
btop httpie gnupg
|
||||
zoxide stow
|
||||
zoxide stow direnv
|
||||
bind nmap socat tcpdump net-tools
|
||||
strace gdb hexyl
|
||||
ninja-build libcurl4-openssl-dev
|
||||
@@ -134,6 +134,7 @@ fi
|
||||
|
||||
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[*]}"
|
||||
@@ -159,8 +160,24 @@ cp -f "$REPO_ROOT/bin/"* "$HOME/.local/bin/"
|
||||
chmod +x "$HOME/.local/bin/"*
|
||||
|
||||
if ! command -v rclone &> /dev/null; then
|
||||
echo -e "${BLUE} LOG:${YELLOW} Installing Rclone (Latest)...${NC}"
|
||||
curl https://rclone.org/install.sh | sudo bash
|
||||
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
|
||||
@@ -236,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}"
|
||||
|
||||
@@ -39,6 +39,39 @@ mark_reboot_required() {
|
||||
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=("$@")
|
||||
|
||||
@@ -59,11 +92,25 @@ install_packages() {
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
if [ ${#missing_packages[@]} -eq 0 ]; then
|
||||
|
||||
@@ -82,7 +82,7 @@ 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=$?
|
||||
install_packages R-core gcc-gfortran curl tar || install_status=$?
|
||||
if [ "$install_status" -eq 42 ]; then
|
||||
exit 0
|
||||
elif [ "$install_status" -ne 0 ]; then
|
||||
@@ -96,8 +96,8 @@ else
|
||||
exit 1
|
||||
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."
|
||||
|
||||
Reference in New Issue
Block a user