Initial commit: Rocky Linux setup scripts (NVIDIA, DaVinci Resolve, fonts)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
28allday 2026-03-28 12:18:57 +00:00
commit ae4d33cdc0
3 changed files with 258 additions and 0 deletions

71
NVIDIA_rocky.sh Executable file
View file

@ -0,0 +1,71 @@
#!/usr/bin/env bash
# NVIDIA open-kernel driver on Rocky Linux 10 (RTX 2000-series+)
set -euo pipefail
trap 'echo "❌ Error on line $LINENO"; exit 1' ERR
need_root() {
if [[ $EUID -ne 0 ]]; then
echo "Please run as root: sudo $0"; exit 1
fi
}
log() { printf "\n==> %s\n" "$*"; }
need_root
# Robust arch detection (avoid `uname -i` which can be "unknown")
arch_m=$(uname -m)
case "$arch_m" in
x86_64) archdir="x86_64" ;;
aarch64|arm64) archdir="sbsa" ;;
*) echo "Unsupported arch: $arch_m"; exit 1 ;;
esac
log "Ensuring DNF plugins and enabling CRB…"
dnf -y install dnf-plugins-core
# CRB name is 'crb' on Rocky; fall back to helper if present
dnf config-manager --set-enabled crb || /usr/bin/crb enable || true
log "Enabling EPEL…"
dnf -y install epel-release || \
dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-10.noarch.rpm
log "Installing kernel build prerequisites for the running kernel…"
dnf -y install \
"kernel-devel-$(uname -r)" \
"kernel-headers-$(uname -r)" \
dkms make gcc elfutils-libelf-devel libglvnd-devel pciutils pkgconf mokutil
log "Adding NVIDIA's official RHEL10 repo (for Rocky 10)…"
repo_url="https://developer.download.nvidia.com/compute/cuda/repos/rhel10/${archdir}/cuda-rhel10.repo"
dnf config-manager --add-repo "${repo_url}"
dnf clean expire-cache
log "Installing NVIDIA open kernel driver (display + compute)…"
dnf -y install nvidia-driver kmod-nvidia-open-dkms nvidia-settings
# Optional guardrails (OK if missing)
dnf -y install dnf-plugin-nvidia || true
echo
if mokutil --sb-state 2>/dev/null | grep -qi enabled; then
cat <<'SB'
⚠️ Secure Boot is ENABLED.
Before rebooting, enroll the DKMS MOK key so the module can load:
sudo mokutil --import /var/lib/dkms/mok.pub
Youll set a one-time password and confirm enrollment on the next boot screen.
SB
else
echo "Secure Boot is disabled — no MOK enrollment needed."
fi
cat <<'POST'
All done. Now reboot to load the driver, then verify with:
sudo reboot
# after reboot:
nvidia-smi
If you ever see Nouveau conflicts, you can disable it with:
sudo grubby --args="nouveau.modeset=0 rd.driver.blacklist=nouveau" --update-kernel=ALL
sudo reboot
POST

43
fonts.sh Executable file
View file

@ -0,0 +1,43 @@
#!/bin/bash
# Exit on any error
set -e
# 1. Ensure running as root (or via sudo)
if [[ "$(id -u)" -ne 0 ]]; then
echo "Error: This script must be run as root (use sudo or login as root)."
exit 1
fi
# 2. Install necessary tools if not already installed
REQUIRED_PKGS=(rpm-build cabextract wget)
# Include ttmkfdir (or mkfontscale) if available/needed for font installation
REQUIRED_PKGS+=(ttmkfdir)
echo "Installing required packages: ${REQUIRED_PKGS[*]}"
dnf install -y "${REQUIRED_PKGS[@]}" 2>/dev/null || yum install -y "${REQUIRED_PKGS[@]}"
# 3. Download the Microsoft core fonts spec file from SourceForge
SPEC_URL="http://corefonts.sourceforge.net/msttcorefonts-2.5-1.spec"
echo "Downloading spec file from $SPEC_URL"
wget -O /tmp/msttcorefonts.spec "$SPEC_URL"
# 4. Build the RPM package for Microsoft core fonts
echo "Building RPM package for Microsoft TrueType core fonts..."
rpmbuild -bb /tmp/msttcorefonts.spec
# 5. Install the generated RPM (containing the TrueType font files)
FONT_RPM="$(find ~/rpmbuild/RPMS/noarch -name 'msttcorefonts*-*.noarch.rpm' -print -quit)"
if [[ -f "$FONT_RPM" ]]; then
echo "Installing $FONT_RPM"
rpm -ivh "$FONT_RPM"
else
echo "Error: Font RPM not found. Please check rpmbuild output for errors."
exit 1
fi
# 6. Update font cache so the system recognizes new fonts
echo "Updating font cache..."
fc-cache -fv
echo "Microsoft core fonts have been installed successfully."

144
rocky_resolve.sh Executable file
View file

@ -0,0 +1,144 @@
#!/usr/bin/env bash
#
# install_resolve_rocky10_from_zip_fixed_v6.sh
# DaVinci Resolve installer for Rocky/RHEL 10 (NVIDIA) installing from ZIP in ~/Downloads.
# v6: add libXt (fixes 'libXt.so.6' missing for USD.plugin), keep zlib-ng compatibility skip.
#
set -Eeuo pipefail
log() { echo -e "[resolve-install] $*"; }
die() { echo -e "\e[31mERROR:\e[0m $*" >&2; exit 1; }
# Root required
if [[ ${EUID:-$(id -u)} -ne 0 ]]; then
die "Please run as root (e.g., sudo -i && bash $0)"
fi
# Target user
if [[ -n "${SUDO_USER:-}" && "${SUDO_USER}" != "root" ]]; then
TARGET_USER="$SUDO_USER"
else
TARGET_USER="$(ls -1 /home 2>/dev/null | head -n 1 || true)"
[[ -n "$TARGET_USER" ]] || TARGET_USER="root"
fi
USER_HOME="$(getent passwd "$TARGET_USER" | cut -d: -f6 || echo "/root")"
DOWNLOADS_DIR="${USER_HOME}/Downloads"
RESOLVE_PREFIX="/opt/resolve"
log "Target user: ${TARGET_USER}"
log "Downloads folder: ${DOWNLOADS_DIR}"
# Repos & deps
log "Enabling EPEL and installing required packages..."
if ! rpm -q epel-release &>/dev/null; then
dnf -y install epel-release || dnf -y install "https://dl.fedoraproject.org/pub/epel/epel-release-latest-10.noarch.rpm"
fi
dnf -y install unzip xcb-util-cursor mesa-libGLU libxcrypt-compat zlib libXt || die "Failed to install required packages."
dnf -y install libXrandr libXinerama libXcursor libXi fontconfig freetype || true
# Determine if we need to bypass BM's package checker (legacy 'zlib' rpm name)
NEED_SKIP=0
if ! rpm -q zlib &>/dev/null; then
if rpm -q zlib-ng-compat &>/dev/null && [[ -e /usr/lib64/libz.so.1 || -e /lib64/libz.so.1 ]]; then
log "Detected zlib-ng-compat provides libz.so.1 but 'zlib' RPM is absent. Will use SKIP_PACKAGE_CHECK=1."
NEED_SKIP=1
fi
fi
# Find newest ZIP
log "Looking for Resolve ZIP in ${DOWNLOADS_DIR} ..."
shopt -s nullglob
zip_candidates=( "${DOWNLOADS_DIR}"/DaVinci_Resolve_*.zip )
shopt -u nullglob
(( ${#zip_candidates[@]} )) || die "No DaVinci_Resolve_*.zip found in ${DOWNLOADS_DIR}."
ZIP_FILE="${zip_candidates[0]}"
for z in "${zip_candidates[@]}"; do [[ "$z" -nt "$ZIP_FILE" ]] && ZIP_FILE="$z"; done
log "Using ZIP: ${ZIP_FILE}"
# Extract
WORK_DIR="${DOWNLOADS_DIR}/.resolve_zip_extract.$$"
mkdir -p "$WORK_DIR"
log "Extracting ZIP into: ${WORK_DIR}"
unzip -q -o "$ZIP_FILE" -d "$WORK_DIR" || die "Failed to extract ZIP."
# Locate .run
shopt -s globstar nullglob
run_candidates=( "$WORK_DIR"/**/DaVinci_Resolve*Linux*.run "$WORK_DIR"/DaVinci_Resolve_*_Linux.run )
shopt -u nullglob
(( ${#run_candidates[@]} )) || die "Could not find a DaVinci Resolve .run installer inside the ZIP."
INSTALLER="${run_candidates[0]}"
for f in "${run_candidates[@]}"; do [[ "$f" -nt "$INSTALLER" ]] && INSTALLER="$f"; done
log "Found installer: ${INSTALLER}"
# Copy to /tmp and execute
TMPDIR="$(mktemp -d -p /tmp resolve-installer.XXXXXX)"
trap 'rm -rf "$TMPDIR" "$WORK_DIR"' EXIT
cp -f "$INSTALLER" "$TMPDIR/resolve.run"
chmod +x "$TMPDIR/resolve.run"
ftype="$(file -b "$TMPDIR/resolve.run" || true)"
log "Installer file type: ${ftype}"
log "Running Blackmagic installer... (GUI may open)"
if echo "$ftype" | grep -qiE 'shell script|text'; then
if (( NEED_SKIP )); then
SKIP_PACKAGE_CHECK=1 bash "$TMPDIR/resolve.run" || die "Blackmagic installer failed."
else
bash "$TMPDIR/resolve.run" || die "Blackmagic installer failed."
fi
else
if (( NEED_SKIP )); then
SKIP_PACKAGE_CHECK=1 "$TMPDIR/resolve.run" || die "Blackmagic installer failed."
else
"$TMPDIR/resolve.run" || die "Blackmagic installer failed."
fi
fi
# Post-install tweaks
if [[ -d "${RESOLVE_PREFIX}/libs" ]]; then
log "Applying GLib/Pango conflict workaround in ${RESOLVE_PREFIX}/libs ..."
pushd "${RESOLVE_PREFIX}/libs" >/dev/null
mkdir -p backup_conflicts
for patt in \
"libglib-2.0.so*" "libgobject-2.0.so*" "libgio-2.0.so*" "libgmodule-2.0.so*" "libgthread-2.0.so*" \
"libpango-1.0.so*" "libpangocairo-1.0.so*" "libpangoft2-1.0.so*"
do
for lib in $patt; do
[[ -e "$lib" ]] && mv -f "$lib" backup_conflicts/ || true
done
done
popd >/dev/null
else
log "WARNING: ${RESOLVE_PREFIX}/libs not found. Was the install path different?"
fi
# libcrypt link
if [[ -e /usr/lib64/libcrypt.so.1 ]]; then
ln -sf /usr/lib64/libcrypt.so.1 "${RESOLVE_PREFIX}/libs/libcrypt.so.1" && \
log "Linked /usr/lib64/libcrypt.so.1 into ${RESOLVE_PREFIX}/libs"
else
log "WARNING: /usr/lib64/libcrypt.so.1 not found. libxcrypt-compat may not have installed correctly."
fi
# Logs + user dirs
install -d -m 1777 "${RESOLVE_PREFIX}/logs"
for d in \
"${USER_HOME}/.local/share/DaVinciResolve" \
"${USER_HOME}/.config/Blackmagic Design" \
"${USER_HOME}/.BlackmagicDesign" \
"${USER_HOME}/.cache/BlackmagicDesign"
do
mkdir -p "$d" || true
chown -R "${TARGET_USER}:${TARGET_USER}" "$d" || true
done
# Sanity
if ! ldconfig -p | grep -q "libGLU.so.1"; then
die "libGLU.so.1 not found even after mesa-libGLU install."
fi
if ! ldconfig -p | grep -q "libXt.so.6"; then
die "libXt.so.6 not found even after libXt install."
fi
log "Installation complete."
log "Launch DaVinci Resolve as the normal user (${TARGET_USER}), NOT with sudo:"
log " ${RESOLVE_PREFIX}/bin/resolve"