IMAGE-MINIMIZER(1)

πŸ“¦
version 44.7 Β· 2 versions
, in fedora 43, fedora 44

πŸ’– IMAGE-MINIMIZER πŸ’–

okay bestie, so this is image-minimizer from the Lorax manual β€” section 1, the "you can run me" section. she's a utility script whose whole job is removing files and packages, and she is so good at it.

✨ NAME ✨

image-minimizer β€” utility script to remove files and packages πŸ’…

Authors

Brian C. Lane <bcl@redhat.com> 🫢

image-minimizer is a script used as an interpreter for kickstart %post sections. basically: Anaconda just finished installing your system, and now this girl goes in and removes rpm packages and individual files off it. she's the cleanup crew. the after-party sweeper. iconic.

she processes a list of commands that tell her which files or rpms to remove… and which ones to keep. keeping is just as important as dropping, no cap.


πŸŽ€ IMAGE-MINIMIZER CMDLINE ARGUMENTS πŸŽ€

usage: image-minimizer [-h] [-i STRING] [--dryrun] [-v] STRING

⭐ Optional arguments

  • -h, --help β€” shows this help message and dips. literally just "what does this do" energy.
  • -i STRING, --installroot STRING β€” the root path that gets prepended to all your file patterns, and the installation root for RPM operations. if you don't say anything, it defaults to INSTALL_ROOT or /mnt/sysimage/. so yeah, she needs to know where she's living.
  • --dryrun β€” if you set this, no filesystem changes are made. nothing. zero. it's giving window shopping πŸ›οΈ β€” you get to see the whole plan without anything actually moving.
  • -v, --verbose β€” displays every single action as it's performed. she'll narrate her own life for you, and honestly? we love a transparent queen. πŸ‘‘

🌸 Positional arguments

  • STRING β€” filename to process.

πŸ’€ NOTES πŸ’€

okay so listen. when you're using this from the kickstart %post, you cannot pass any arguments to image-minimizer. at all. zero arguments. that's the rule, bestie. 😭

when you're using her from a kickstart, the image-minimizer package has to be available. she is not included on the standard boot.iso, so you're gonna need to include lorax in the %package section. fun part? you can then use image-minimizer to remove lorax from the install. she removes the very thing that brought her here. main character behavior, honestly. πŸ”₯

if you're using this with livemedia-creator, she can be installed on the host system instead, so that lorax isn't needed in the %package list β€” and in that case she doesn't need to be removed either. convenient. slay. ✨


πŸ‘‘ COMMANDS πŸ‘‘

commands go one per line, followed by a space, and then the package, file, or glob. the globs are Unix style pathname patterns using *, ?, and [] character ranges. globbing is implemented using the python glob module β€” so, iykyk. 🐍

  • drop <PATTERN> β€” this will remove files from the installation. bye bye πŸ¦‹
  • keep <PATTERN> β€” this will keep files, and it should follow any drop commands including globs. it's the "no wait, not that one!!" move.
  • droprpm <PATTERN> β€” remove matching rpm packages. dependencies are not removed, just the individual packages matching the glob. so be careful, fr fr.
  • keeprpm <PATTERN> β€” do not remove matching rpm packages. it should follow any droprpm commands that include globs. protection detail. πŸ›‘οΈ

🌈 EXAMPLE 🌈

example Anaconda %post usage:

%post --interpreter=image-minimizer --nochroot

drop /lib/modules/*/kernel/fs
keep /lib/modules/*/kernel/fs/ext*
keep /lib/modules/*/kernel/fs/mbcache*
keep /lib/modules/*/kernel/fs/squashfs

droprpm make
droprpm mtools
droprpm mysql-libs
droprpm perl
droprpm perl-Pod-*
droprpm syslinux
keeprpm perl-Pod-Simple

# Not needed after image-minimizer is done
droprpm lorax

%end

like… look at her. drop a whole directory, then keep exactly the pieces you want. that's a vibe check that passed. πŸ’–


🧚 AUTHOR 🧚

Weldr Team πŸ’œ

2024, Red Hat, Inc.


okay that's the whole page, bestie!! πŸŽ€ version 41.3, dated Aug 12, 2024 β€” mwah, love u, go minimize something responsibly. βœ¨πŸ’…πŸ«Ά

πŸ“¦ where this page comes from