Adds zenity profile picker (gaming / LLM / reset) with safe RAM guardrails, pkexec-based apply, and install.sh for Nobara/Fedora. Co-authored-by: Cursor <[email protected]>
71 lines
1.9 KiB
Bash
Executable File
71 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Install Z13 Memory Profiles for the current user
|
|
|
|
set -euo pipefail
|
|
|
|
SRC_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PREFIX="${PREFIX:-${HOME}/.local}"
|
|
INSTALL_DIR="${PREFIX}/share/z13-memory-profiles"
|
|
BIN_DIR="${PREFIX}/bin"
|
|
APP_DIR="${PREFIX}/share/applications"
|
|
|
|
echo "==> z13Profiler installer"
|
|
echo " Source: ${SRC_DIR}"
|
|
echo " Target: ${INSTALL_DIR}"
|
|
|
|
missing=()
|
|
for cmd in zenity python3; do
|
|
command -v "${cmd}" >/dev/null 2>&1 || missing+=("${cmd}")
|
|
done
|
|
|
|
if ((${#missing[@]})); then
|
|
echo "Missing dependencies: ${missing[*]}"
|
|
echo "Install with: sudo dnf install ${missing[*]} polkit"
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v pkexec >/dev/null 2>&1; then
|
|
echo "Note: pkexec not found — GUI apply will fall back to sudo."
|
|
echo " Recommended: sudo dnf install polkit"
|
|
fi
|
|
|
|
mkdir -p "${INSTALL_DIR}" "${BIN_DIR}" "${APP_DIR}"
|
|
|
|
rsync -a --delete \
|
|
--exclude='.git' \
|
|
--exclude='*.tar.gz' \
|
|
--exclude='package.sh' \
|
|
"${SRC_DIR}/" "${INSTALL_DIR}/"
|
|
|
|
chmod +x "${INSTALL_DIR}/bin/z13-memory-profiles"
|
|
chmod +x "${INSTALL_DIR}/install.sh" 2>/dev/null || true
|
|
|
|
ln -sf "${INSTALL_DIR}/bin/z13-memory-profiles" "${BIN_DIR}/z13-memory-profiles"
|
|
ln -sf "${INSTALL_DIR}/bin/z13-memory-profiles" "${BIN_DIR}/z13profiler"
|
|
|
|
cat > "${APP_DIR}/z13-memory-profiles.desktop" <<EOF
|
|
[Desktop Entry]
|
|
Version=1.0
|
|
Type=Application
|
|
Name=Z13 Memory Profiles
|
|
GenericName=Unified Memory Settings
|
|
Comment=Switch gaming and LLM RAM profiles on ROG Flow Z13 (GZ302)
|
|
Exec=${BIN_DIR}/z13-memory-profiles
|
|
Icon=preferences-system-memory
|
|
Terminal=false
|
|
Categories=System;Settings;
|
|
Keywords=VRAM;UMA;TTM;memory;Strix;Halo;GZ302;
|
|
StartupNotify=true
|
|
EOF
|
|
|
|
echo ""
|
|
echo "Installed."
|
|
echo " Command: z13-memory-profiles (alias: z13profiler)"
|
|
echo " Menu: Z13 Memory Profiles"
|
|
echo ""
|
|
echo "Optional (recommended for LLM): pipx install amd-debug-tools"
|
|
echo ""
|
|
echo "First run:"
|
|
echo " z13-memory-profiles --status"
|
|
echo " z13-memory-profiles"
|