#!/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" <