diff --git a/anda/system/dracut-strip-trigger/LICENSE b/anda/system/dracut-strip-trigger/LICENSE new file mode 120000 index 0000000000..5853aaea53 --- /dev/null +++ b/anda/system/dracut-strip-trigger/LICENSE @@ -0,0 +1 @@ +../../../LICENSE \ No newline at end of file diff --git a/anda/system/dracut-strip-trigger/anda.hcl b/anda/system/dracut-strip-trigger/anda.hcl new file mode 100644 index 0000000000..d6b890bd3f --- /dev/null +++ b/anda/system/dracut-strip-trigger/anda.hcl @@ -0,0 +1,5 @@ +project pkg { + rpm { + spec = "dracut-strip-trigger.spec" + } +} diff --git a/anda/system/dracut-strip-trigger/dracut-strip-trigger.spec b/anda/system/dracut-strip-trigger/dracut-strip-trigger.spec new file mode 100644 index 0000000000..3d6efb4912 --- /dev/null +++ b/anda/system/dracut-strip-trigger/dracut-strip-trigger.spec @@ -0,0 +1,37 @@ +Name: dracut-strip-trigger +Version: 0 +Release: 1%?dist +Summary: Strip initramfs aggressively +License: GPL-3.0-only +Requires(post): dracut +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< 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`.' + +%triggerin -- kernel +dracut --force --hostonly --strip --aggressive-strip + +%postun +echo 'Regenerating all initramfs…' +[ $1 = 0 ] && dracut --force --parallel --regenerate-all --no-hostonly --strip