From my NixOS host machine, I have written — with the help of artificial intelligence (AI) — several shell functions that are imported into my LFS VM and provide basic package management functionality. These functions are part of both my host's and VM's shell profile. These functions can be found in my NixOS configuration user shell profile. lfs-custom-updates.py is used to parallelize and more efficiently check the versions of all custom packages to see if updates are available.
Table 1: Shell functions used for package management within the LFS VM. | Syntax (definition file hyperlink) | Description |
autobuild PACKAGE(S) [OPTION(S)] | Default: build and install the specified package(s), if and only if the latest version of the package is not already installed. LFS/Beyond LFS (BLFS) instructions were used to build most packages. Although, some packages were built using custom build scripts defined in ~/lfs_packaging. These custom build scripts have since become the primary source of software for the system, as it tends to be more reliable and easier to tweak. Options: --dry-run: show what actions would be executed to build and install the package. --strip: run stripping commands after build. --no-upstream: disable upstream version searching. --include-config: include configuration commands in the LFS/BLFS book entry. --rm-libs: remove old library versions after build (disabled by default). --lfs: search only in the LFS book. --blfs: search only in the BLFS book. --lfs-book <book>: specify LFS book (e.g., development, systemd, stable, or full URL). --blfs-book <book>: specify BLFS book (e.g., development, systemd, stable, or full URL). --skip-tests: skip test commands (make check/test, etc.). --ignore-test-failures: ignore test failures by appending '|| true' to test commands. -f/--force: force rebuild and installation even when latest version is already installed. -h/--help: show help message. |
autoremove PACKAGE(S) [OPTION(S)] | Default: remove the specified package(s), if and only if no other packages have libraries that depend on the package(s). Options: --dry-run: show what actions would be executed to remove the package. -f/--force: force removal, without regard for library dependencies. |
ls_old_libs [OPTION(S)] | List old installed versions of libraries. Options:
-d option it list files that depend on listed files. |
rm_book_src | Remove book source files. |
rm_lfp_src | Remove custom package source tarballs. |
rm_old_docs | Remove old unused documentation directories. |
rm_old_kerns | Remove old unused kernels. |
rm_old_libs | Remove old unused libraries. As for used old used libraries, rebuild packages that depend on the library and then remove it. |
rm_old_share [OPTION(S)] | Removes old unused /usr/share subdirectories. Options:
--dry-run shows what would be done without actually executing those actions. |
rm_src | Remove old source archives and directories (not including git repos). |
sync_to_vm | Only available on host; synchronize scripts from host to virtual machine. |
update [OPTION(s)] | Update packages. Options: --dry-run: Show what would be updated without downloading/building. -h/--help: Show help message. --no-upstream: Check only LFS/BLFS book versions (disable upstream tracking). -v/--verbose: Show custom package local and upstream versions during version checking. |
updatec [OPTION(s)] | Runs, in order, rm_old_docs, rm_old_kerns, rm_old_libs, rm_old_share and rm_src if and only if update runs without error. Options are passed directory to update. |
updates | Print table that list available updates (marked with [UPDATE]), as well as packages with missing inventories (marked with [FILES MISSING]) and packages with versioning failures (marked with [FAILED]). |