Snapper: no question on btrfs; vendor the SysGuides scripts
- 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.
This commit is contained in:
+45
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# snapper-pre.sh
|
||||
# ----------------
|
||||
# Creates a PRE snapshot before a DNF5 transaction begins.
|
||||
#
|
||||
# This script:
|
||||
# - Generates a description using snapper-desc.sh
|
||||
# - Stores the description and snapshot number in /run for later use
|
||||
#
|
||||
# The stored data is used by the POST script to:
|
||||
# - Pair snapshots correctly
|
||||
# - Improve snapshot descriptions (especially for GUI installs)
|
||||
#
|
||||
# Project: sysguides-snapper-fedora
|
||||
# Author: Madhu Desai (SysGuides)
|
||||
# Website: https://sysguides.com
|
||||
# GitHub: https://github.com/SysGuides/sysguides-snapper-fedora
|
||||
|
||||
PID="$1"
|
||||
STATE_DIR="/run/snapper-actions"
|
||||
|
||||
# Ensure runtime directory exists with secure permissions
|
||||
mkdir -p "$STATE_DIR"
|
||||
chmod 700 "$STATE_DIR"
|
||||
|
||||
# On a fresh setup, DNF5 may fail with "filesystem error: cannot copy: packages.toml"
|
||||
# if this directory is missing, leaving an orphaned PRE snapshot with no POST.
|
||||
# This block ensures the directory exists before the transaction proceeds.
|
||||
if [[ ! -d /usr/lib/sysimage/libdnf5 ]]; then
|
||||
mkdir -p /usr/lib/sysimage/libdnf5
|
||||
restorecon -q /usr/lib/sysimage/libdnf5 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Get transaction description (GUI or CLI command)
|
||||
desc=$(/usr/local/bin/snapper-desc.sh "$PID")
|
||||
|
||||
# Store description for use in POST phase
|
||||
echo "$desc" > "$STATE_DIR/snapper_desc_${PID}"
|
||||
|
||||
# Create PRE snapshot and store snapshot number
|
||||
pre=$(snapper -c root create -c number -t pre -p -d "$desc") || exit 1
|
||||
|
||||
echo "$pre" > "$STATE_DIR/snapper_pre_${PID}"
|
||||
Reference in New Issue
Block a user