Add --remove flag to presets
Created by: rogueai
This is still WIP, but I wanted to get the general idea out for review before I get too far. I treated --remove
as an option to --preset|--allpresets
.
I still have some error handling to manage, e.g: when rm
fails for some reason (permissions, etc.), I get the usual rm errors, I'd like to add some pretty printed error messages.
I'm still debated over the way I changed process_preset
, I'm open to suggestions!
-
add remove flag as an option to --preset|--allpresets
+ error handling -
help/usage, man docs -
test functionality -
test completion
Sample output:
❯ ./mkinitcpio -P --remove
==> Removing image for preset: mkinitcpio.d/example.preset: 'default'
==> WARNING: Image not found: `/tmp/arch-linux.efi'
==> ERROR: Image not writable: `/tmp/initramfs-linux.img'
==> Removing image for preset: mkinitcpio.d/example.preset: 'fallback'
-> Removed: `/tmp/arch-linux-fallback.efi'
-> Removed: `/tmp/initramfs-linux-fallback.img'
==> Removing image for preset: mkinitcpio.d/hook.preset: 'default'
==> WARNING: Image not found: `/boot/initramfs-%PKGBASE%.img'
==> Removing image for preset: mkinitcpio.d/hook.preset: 'fallback'
==> WARNING: Image not found: `/boot/initramfs-%PKGBASE%-fallback.img'
==> Removing image for preset: mkinitcpio.d/test.preset: 'default'
==> ERROR: Image not writable: `/efi/EFI/arch/arch-linux.efi'
==> ERROR: Image not writable: `/boot/initramfs-linux.img'
==> Removing image for preset: mkinitcpio.d/test.preset: 'fallback'
==> ERROR: Image not writable: `/efi/EFI/arch/arch-linux-fallback.efi'
==> ERROR: Image not writable: `/boot/initramfs-linux-fallback.img'
Fixes #8 (closed)
Edited by nl6720