mirror of
https://github.com/terrapkg/packages.git
synced 2026-06-23 03:50:40 +00:00
ef8dd9ff25
(cherry picked from commit c41b7b7bcf)
Co-authored-by: madomado <madonuko@outlook.com>
38 lines
1.1 KiB
RPMSpec
38 lines
1.1 KiB
RPMSpec
Name: dracut-strip-trigger
|
|
Version: 0
|
|
Release: 4%?dist
|
|
Summary: Strip initramfs aggressively
|
|
License: GPL-3.0-only
|
|
Requires: dracut installonlypkg(kernel)
|
|
Source0: LICENSE
|
|
|
|
%global _desc %{expand:
|
|
Strip initramfs automatically for each kernel update using --hostonly --aggressive-strip.
|
|
Do not install this package if you plan to use the system on different devices (e.g.
|
|
raw images like Raspberry Pi images).}
|
|
|
|
%description %_desc
|
|
|
|
%prep
|
|
cat<<EOF > README
|
|
%name %_desc
|
|
EOF
|
|
cp %{S:0} .
|
|
|
|
%files
|
|
%doc README
|
|
%license LICENSE
|
|
|
|
%post
|
|
echo 'Regenerating all initramfs…'
|
|
dracut --force --parallel --regenerate-all --hostonly --strip --aggressive-strip
|
|
echo 'All non-rescue initramfs have been regenerated.'
|
|
echo 'If you have problems booting up, use the rescue image, then uninstall `%name`.'
|
|
|
|
%transfiletriggerin -P 1 -- /boot
|
|
dracut --force --hostonly --strip --aggressive-strip $(stat --format '%Y %y $%n' /boot/initramfs* | sort -nr | cut -d$ -f2- | head -n1)
|
|
|
|
%postun
|
|
[ $1 = 0 ] && echo 'Regenerating all initramfs…'
|
|
[ $1 = 0 ] && dracut --force --parallel --regenerate-all --no-hostonly --strip
|