This repository has been archived by the owner on Nov 29, 2024. It is now read-only.
mkinitcpio adds distro-specific system, probing pacman binaries, and xfs_repair #24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, been up a long time so not sure what more to say, below is the commit comment.
I'm not a bash novice but it's not exactly my forté, and on top of that without being too familiar with the development process of KaOS, nor arch, nor PGKBUILDS, etc., there may want to be a number of reviews made before pulling this in fully :)
This commit adds a basic distribution-specific loading feature
for mkinitcpio configs, and an implementation that can use pacman
to add the binaries for a specfic package to the ramdisk.
The motivation for this was to add support for repairing the XFS
root or usr filesystem in case of a no-boot.
Both the general design and implementaion as well as the KaOS-specific
code and motivating case and will probably need a good reviewing and
possible modificaion as I did this in one very long night.
If the system drops into initramfs because of a dirty filesystem,
the
fsck
suite of programs is added, by default, from the upstreamarch implementation, that determines the root filesystem type and includes
these as necessary. However, XFS is not the usual target with linux and
the
fsck.xfs
utility cannot do much by itself - it refers the user tothe
xfsprogs
commandxfs_repair
.into the ramdisk, so that the filesystem can be repaired during the
boot process, rather than needing to chroot via e.g. a live CD
If KaOS moves to Illumos, the game will change significantly, but
whilst using a linux kernel, the OS has a significant number of differences
to most typical linuxen found today. So, I decided to aim for a way to
add extra utilities to the ramdisk to help repairs and debugging, both
for developers and end users, without doing too much manual work.
Based on the rolling-release model and the atomic level of KaOS
packages, I wrote this to extract the binary executables from a
given named package, and include these in the mkinitcpio image
The files are queried from installed pacman packages, and
can be run against an arbitrary callback to filter them, based
on directory location or filetype (links or not), for example.
Thus, if a package is added, that needs to be incorporated into
the ramdisk, a line can simply be added in
/usr/lib/initcpio/distros/kaos
This supporting pacman script may be of (some) use to other
distros too, hence the aim to separate it form the motivation
to write it:
the new hook
distro
was added, and this uses the output fromlsb_release (added dependency) to obtain the current OS' ID.
It then looks in the distros folder to find a file with this name,
in lower-case
The distros folder isn't a .d-style folder: one file is sourced
from it, and it is not expected to run everything in there; the
OS' script may have helper scripts not to be executed directly.
The idea also was to help tracing the OS' heritage: for example,
mint
coulde use functions fromubuntu
which could use functionsfrom
debian
, etc., so that upstream changes are incorporated,even if some are not executed, overwritten, or avoided.
this hook is added to the default configuration for any build,
in
/etc/mkinitcpio.conf
; if the distribution-specific file isfound, it is sourced, otherwise the hook is a no-op and the build
continues harmlessly.
Note: the build process warns that a command failed, yet the
process seems to function and the ramdisk works for me
TODO:
This could quickly explode the number of files included for, in
many cases, no good reason
inside it, so it would be mecessary to see what sort of scripts can be
included and what can't. I fear parsing the shebang may be too simple
to work, and dependencies would need to be extracted somehow
this now
'important', i.e. required for the core system, and which are extras,
not likely to be included. At the moment, the config for this search
is a const in the file, adn importance is just taken as 'does it live
in /{s,}bin?'