Age | Commit message (Collapse) | Author | Files | Lines |
|
Add this as an abstraction for the various places firmware might exist.
Additionally, don't complain about missing firmware unless *none* of it
can be found -- and even then, only throw a warning.
NB: this means that users building images without the autodetect hook
and a rudimentary hook like "block" will see warnings which are going
to cause panic, chaos, and upheaval. I fully expect that this will
result in extra non-work for me in the form of closing invalid bug
reports.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
I don't have any particular use case for this, but it might be nice to
have this available in the future.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This also removes a check which would have otherwise hidden a missing
firmware error from the user. FS#34255.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Relegate this and the other lib64 symlink to x86_64, too, since we have
no business creating this on i686.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
823e24 wasn't really correct, since running 'tput setaf 0' effectively
sanity checks the terminfo as well as checking existance. However, it
does nothing to affirm that the terminal is capable of supporting
colors.
Moreover, *never* fall back on the hardcoded escapes as doing so implies
that we've found a broken terminfo and we have no idea what the terminal
is capable of doing.
This reverts commit 823e2454176d4381cd3acc30481e9d84cdc298b1.
|
|
This leaves bash completion with a duplication, but this is intentional
to avoid pulling in the entire functions file and worrying about
pollution.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Found via apron.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Due to using PATH lookups for hooks, we can't possibly end up with a
broken symlink. The build will just error out on the hook not being
found.
Found via apron.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Removal of the old API (f85d28014134076) exposed the fact that a build
hook returning an error would increment the builderrors. This isn't
really wanted -- we don't want to declare a hard "pass/fail" for a hook,
as the functions we actually care about passing/failing are the add_*
functions which are of real concern (and already caught).
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Separate out the printing from these flags to separate functions and
examine each hook more closely, pointing out where it might be
deprecated, and what should be used in place of it.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Declaring our lookup paths like normal colon delimited PATHs lets us
reuse them for builtins like source and type to do the same work that
this function previously did.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Declaring _modpaths as an associative array allows us to forego the
printf|sort -u|xargs cp pipeline as we can guarantee that the array is
already prepared.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This removes any meaning from the definitions of MODULES, BINARIES,
FILES, and SCRIPT within install hooks. It also removed the deprecated
checked_modules() function, which is replaced by add_checked_modules().
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Fixes FS#32532.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
map() runs the first argument (a function) with each of the remaining
arguments as $1. The return value of map() is only 0 if all the calls
succeeded.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
If mkinitcpio -s is run, we still flush this cache to disk before
exiting.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
When reporting that a hook is deprecated, only show the hook name, not
the full resolved path.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This is an ugly patch, and probably does more than I'd like it to. The
idea is that mkinitcpio adopts some sort of consistent style which I'm
actually happy with. I define 3 kinds of variables:
1) local variables: all lower case, and scoped within functions. Use
freely, as they're well contained.
2) global variables: these are known to mkinitcpio internally, but are
global in scope. They mainly carry runtime configuration and collected
data during the image generation process. These are always lower case,
but carry a leading underscore to denote that they're global.
3) "API" variables: also global in scope, but exist "outside" of
mkinitcpio -- either drawn in from the configuration file, or "exported"
to the install hooks. These are always all upper case. When introducing
new variables, extreme care must be taken to pick names that will not
conflict with the environment inherited by mkinitcpio.
A HACKING file is introduced with a similar description of the above,
and more.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
It's okay to fully resolve the symlink to add the regular file it points
to, but avoid mangling the symlink name to try and preserve relative
links.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
For the purposes of accounting and debugging, it's nice to have this
around.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Overlooked in b8d9c5cd2753e9. This change also assigns a value of "2" to
builtin modules which are added to the the ADDED_MODULES array, to
distinguish them from actual modules on disk. Using this, we can avoid
adding builtins to the image's runtime config.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Lookups in the hash table are far faster than traversing the entire
array, as this grows O(n) and introduces a particularly noticeable
slowdown on larger images.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
In the case of a single arg, use readlink(1) to resolve the target of
the symlink. Document this, and additionally note the lack of guarantee
about the target of the symlink.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
These are low level enough that they should be part of the base layout,
similar to the filesystem package in userspace. Later hooks can easily
override these, if they really want to.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Booo. This broke my boot. Should never have been added in f3638aaa0937.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This was overlooked in 5f81d06e8b87.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This might be useful for creating an initramfs image as part of a kernel
package.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This is used by udev to deal with firmware requests for firmware that is
not available until the real root. It will also be used by systemd to
detect what to do, if that is ever used.
ref: http://www.spinics.net/lists/linux-wireless/msg94522.html
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
mkinitcpio needs to be able to more tightly control the layout of the
image. By moving this outside the control of the base hook, it's more
reasonable to believe that a drop-in replacement for the base hook could
be written, as it now only contains the utilities required for the /init
that it provides.
Being that initialize_buildroot is outside of a hook, we can make "raw"
calls to coreutils that create the directories and symlinks, saving some
overhead and forking.
This also symlinks /usr/local/{lib,bin} into the common /usr/lib and
/usr/bin, respectively, so that there's always a way to override libs
and bins, and they're automatically pulled into our strict early init
path of /usr/bin.
Finally, we lump all this generally a little "later" in the early setup.
This addresses an unseen "bug" wherein an extra temp directory that
never gets used is created when leveraging a preset.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
[dave: fix whitespace and re-add needed quoting]
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
If we didn't actually add a module to the image, avoid adding it to the
runtime config for probing.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Avoid using compound commands where one side runs a command group.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This fixes an unlikely (and likely unseen) regression from
9a20048c6279cd. Without unsetting the build function before sourcing the
hook file, we can't guarantee that we're running the build function tied
to that specific file.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
ldd reporting a library to be 'not found' is dangerous, and should be
reported. Consider this a build error, which will hopefully prompt the
user to reconsider before rebooting.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Generalize the awk program embedded in add_runscript and create a
separate function which can be reused to display the specific hooks that
a script has.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This allows us to declare sourced variables that we want to shield from
stomping on our config variables, and without needing to use a subshell.
Incidentally, this also fixes FS#29992 in a more permanent way.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Note that we're intentionally very liberal about what we accept for
symlinks, and don't actually care if the target exists.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Break this out of install/base into a separate function. We need to be
able to read from the RUNHOOKS array to accurately specify which hooks
to execute at runtime.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This function adds a runtime script to the /hooks directory on the
initramfs image. Note that this function will also install hooks with
executable permissions for use by a later change to early init.
With this commit, there are now methods available which can be used in
place of the MODULES, FILES, BINARIES, and SCRIPT variables, as we now
offer error checking on the add_* functions. Usage of the variables is
deprecated, and these will no longer be read in a future version of
mkinitcpio.
This commit also lays the groundwork for the addition of more early
userspace hooks. Runtime hook files are parsed for specific functions
and variables (not yet used) are populated. These will eventually be
written to the image config so that early userspace knows exactly
what to run.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Instead of returning a list of modules which the caller should then add
themselves or stuff into the MODULES string, call add_module for each
candidate. This is basically a different wrapper around all_modules.
DEPRECATION WARNING: This commit marks checked_modules as deprecated.
Although it is not slated to go away, direct usage of all_modules is
strongly discouraged.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Allow add_module to detect trailing ? characters for ignoring errors
rather than passing -t or --try to add_module.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
A lot has changed since 643e98eeb42677 when these functions were
implemented, and there is exactly 1 case of get_dirname left, and no
calls to get_basename. Remove these, and use a PE in place of the
remaining call.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Rather than catching errors solely from parse_hook via an ERR trap,
implement a RETURN trap which catches all errors from the core add_*
functions.
In the future, this may mean that support for MODULES/FILES/BINARIES
within hooks goes away, and those variables remain only in the config.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|