Name: grub-btrfs Version: 4.14 Release: 1%{?dist} Summary: Include btrfs snapshots in GRUB boot menu License: GPL-3.0-or-later URL: https://github.com/Antynea/grub-btrfs Source0: https://github.com/Antynea/grub-btrfs/archive/v%{version}.tar.gz BuildArch: noarch Requires: grub2 Requires: btrfs-progs Requires: bash %description grub-btrfs improves GRUB by automatically adding btrfs snapshots to the boot menu. You can boot your system from a snapshot directly from the GRUB menu. %prep %autosetup -n grub-btrfs-%{version} # Create Fedora/RHEL-specific config with correct paths # Fedora uses /boot/grub2 and grub2-mkconfig instead of Debian's /boot/grub sed -i 's|^#GRUB_BTRFS_GRUB_DIRNAME=.*|GRUB_BTRFS_GRUB_DIRNAME="/boot/grub2"|' config sed -i 's|^#GRUB_BTRFS_MKCONFIG=.*|GRUB_BTRFS_MKCONFIG=/usr/bin/grub2-mkconfig|' config sed -i 's|^#GRUB_BTRFS_SCRIPT_CHECK=.*|GRUB_BTRFS_SCRIPT_CHECK=grub2-script-check|' config %build # No compilation - project is shell scripts only : %install # Manual install (upstream Makefile requires root, which rpmbuild does not have) # Mirrors upstream Makefile with SYSTEMD=true, INITCPIO=false, OPENRC=false # Man pages install -Dm644 manpages/grub-btrfs.8.man %{buildroot}%{_mandir}/man8/grub-btrfs.8 install -Dm644 manpages/grub-btrfsd.8.man %{buildroot}%{_mandir}/man8/grub-btrfsd.8 # GRUB script and config install -Dm755 41_snapshots-btrfs %{buildroot}%{_sysconfdir}/grub.d/41_snapshots-btrfs install -Dm644 config %{buildroot}%{_sysconfdir}/default/grub-btrfs/config # Daemon binary and systemd service install -Dm755 grub-btrfsd %{buildroot}%{_bindir}/grub-btrfsd install -Dm644 grub-btrfsd.service %{buildroot}%{_unitdir}/grub-btrfsd.service # Documentation install -Dm644 LICENSE %{buildroot}%{_datadir}/licenses/%{name}/LICENSE install -Dm644 README.md %{buildroot}%{_datadir}/doc/%{name}/README.md install -Dm644 initramfs/readme.md %{buildroot}%{_datadir}/doc/%{name}/initramfs-overlayfs.md %files %license %{_datadir}/licenses/%{name}/LICENSE %doc %{_datadir}/doc/%{name}/README.md %doc %{_datadir}/doc/%{name}/initramfs-overlayfs.md %config(noreplace) %{_sysconfdir}/default/grub-btrfs/config %{_sysconfdir}/grub.d/41_snapshots-btrfs %{_bindir}/grub-btrfsd %{_unitdir}/grub-btrfsd.service %{_mandir}/man8/grub-btrfs.8* %{_mandir}/man8/grub-btrfsd.8* %post # regen grub configuration after installation if [ -x /usr/bin/grub2-mkconfig ] && [ -d /boot/grub2 ]; then # Update main grub.cfg if it exists if [ -f /boot/grub2/grub.cfg ]; then /usr/bin/grub2-mkconfig -o /boot/grub2/grub.cfg 2>/dev/null || true fi # On EFI systems, grub.cfg may be in EFI partition for efi_cfg in /boot/efi/EFI/*/grub.cfg /boot/efi/EFI/BOOT/grub.cfg; do if [ -f "$efi_cfg" ]; then grub2-mkconfig -o "$efi_cfg" 2>/dev/null || true fi done fi # Enable and start the grub-btrfsd daemon if [ $1 -eq 1 ]; then %systemd_post grub-btrfsd.service fi %preun if [ $1 -eq 0 ]; then %systemd_preun grub-btrfsd.service fi %postun # regenerate grub configuration after removal if [ $1 -eq 0 ] && [ -x /usr/bin/grub2-mkconfig ]; then if [ -f /boot/grub2/grub.cfg ]; then /usr/bin/grub2-mkconfig -o /boot/grub2/grub.cfg 2>/dev/null || true fi for efi_cfg in /boot/efi/EFI/*/grub.cfg /boot/efi/EFI/BOOT/grub.cfg; do if [ -f "$efi_cfg" ]; then grub2-mkconfig -o "$efi_cfg" 2>/dev/null || true fi done fi %changelog * Sat Mar 07 2026 Brandon Lester - %{version}-%{release} - initial package