- On btrfs, snapshots + zstd compression now just happen (no prompt); --snapper=no remains the explicit opt-out. - Vendor scripts/snapper-*.sh + config/snapper.actions from SysGuides/sysguides-snapper-fedora (MIT, upstream 0a28eb4) into vendor/snapper/ and install from there — no runtime clone of an external repo, and no dependency on exec bits (fixes the './install.sh: Permission denied' failure seen on the test VM). - grub-btrfs still cloned at runtime from Antynea/grub-btrfs with the Fedora config applied; everything else is local now.
50 lines
1.3 KiB
Bash
Executable File
50 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# snapper-gui-pkg.sh
|
|
# ------------------
|
|
# Captures the first package involved in a GUI-based transaction.
|
|
#
|
|
# This script:
|
|
# - Runs during DNF5 transaction events (pre_transaction hooks)
|
|
# - Detects if the transaction originated from a GUI
|
|
# - Records the first package name and action (install/remove)
|
|
#
|
|
# This allows snapshots to have meaningful descriptions like:
|
|
# "GUI install firefox"
|
|
#
|
|
# Only the first package is recorded to keep descriptions concise.
|
|
#
|
|
# Project: sysguides-snapper-fedora
|
|
# Author: Madhu Desai (SysGuides)
|
|
# Website: https://sysguides.com
|
|
# GitHub: https://github.com/SysGuides/sysguides-snapper-fedora
|
|
|
|
PID="$1"
|
|
ACTION="$2"
|
|
NAME="$3"
|
|
|
|
STATE_DIR="/run/snapper-actions"
|
|
DESC_FILE="$STATE_DIR/snapper_desc_${PID}"
|
|
PKG_FILE="$STATE_DIR/snapper_gui_${PID}"
|
|
|
|
# Read previously stored description (set in PRE phase)
|
|
desc=$(cat "$DESC_FILE" 2>/dev/null || echo "")
|
|
|
|
# Only proceed if this is a GUI transaction
|
|
[[ "$desc" != "GUI" ]] && exit 0
|
|
|
|
# Only capture the first package to avoid overwriting
|
|
[[ -f "$PKG_FILE" ]] && exit 0
|
|
|
|
# Determine action type and store description
|
|
case "$ACTION" in
|
|
I|U|D|R)
|
|
# Install / upgrade / downgrade / reinstall
|
|
echo "GUI install ${NAME}" > "$PKG_FILE"
|
|
;;
|
|
E|O)
|
|
# Erase / obsolete
|
|
echo "GUI remove ${NAME}" > "$PKG_FILE"
|
|
;;
|
|
esac
|