Age | Commit message (Collapse) | Author | Files | Lines |
|
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>
|
|
This frontend/backend split is no longer necessary without the notion of
a basedir.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This frontend/backend split is no longer necessary without the notion of
a basedir.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This frontend/backend split is no longer necessary without the notion of
a basedir.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This option is just a bad idea. Initramfs creation is too important to
get wrong, and running it from outside the root FS has too many gotchas,
the worst of them being:
- where do you pull hooks from?
- how do you resolve binary dependencies within the root?
In general, dealing with the extra luggage of the base directory makes the
codebase more complicated than it needs to be (see all the '_' prefixed
functions which are called from add functions). In favor of simplifying the
code, and making it more maintainable, kill this off and force the sane
option of chroot'ing into an install if the need arises.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
|
|
Display the name of the program.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This is a really ugly patch, but allows mkinitcpio to read hooks from
multiple locations, namely:
/usr/lib/initcpio/{install,hooks}
/lib/initcpio/{install,hooks}
Preference is given to the first, and all files included with mkinitcpio
are moved there.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
An error in logic here would cause the --try flag to be passed to all
modules after the first, if a hook added modules ending with a '?'.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
kmod is a bit noisier about unresolvable aliases, but we don't really
care for the purposes of creating the module whitelist.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
The function did its job, it just isn't going to add any deps. This
makes add_binary effectively a slightly more costly version of add_file.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Since we now silently overwrite instead of silently failing on existing
files and symlinks, we have a lot of sodeps which are overwritten by
various binaries -- udevd and udevadm being one example. Nip this in
add_binary by doing our own check and preventing addition of
pre-existing files in the $BUILDROOT.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This goes in hand with an earlier commit which changed behavior to
silenltly overwrite files rather than silently fail.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Now we fail silently if the file exists, which means there is no easy way to overwrite binaries.
I think it makes the most sense to do the following:
1) add all the busybox stuff as a basic system;
2) overwrite some of the links with any binaries we add to base hook;
3) allow users to write their own hooks to overwrite even more stuff.
This can now be done by this hook.
v2: make sure we are able to overwrite a symlink pointing to a directory
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
Two bugs: operands were swapped in call to _add_symlink, and missing
operand in call to _add_dir.
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Also make sure that simple variables are declared as null strings.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Without specifying this, xargs will split arguments on whitespace as
well as newlines, and will interpret quoting and backslashes. When the
delimiter is specified, every character is taken literally and only the
given delimiter in honored.
This sidesteps issues with broken modalias files as evidenced by a
MacBookAir3,1 or the bbs thread below:
https://bbs.archlinux.org/viewtopic.php?pid=971853
Also fixes FS#25450.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
We used to do this, but it was lost somewhere along the way in fixing up
basedir support. Add in a 'pathlookup' function which can do a search
within any given basedir.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Make sure these are completely safe for user input. Use the same three
step process in both cases:
1) Strip any trailing slash
2) Trim the string according to base/dir request
3) Print the result, defaulting to / if step 2 yielded an empty string
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
We conditionally, but naively, add modules in some of our install hooks,
but the kernel may not have these. Note that these modules can fail
silently by detecting a '?' suffix on the module name. In conjunction with
this, the add_module function now takes a flag, -t or --try, which will
ignore module not found errors from modinfo. The config file will also
support this syntax.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Since we no longer call _add_file from add_module, we lose our 'adding
file..' feedback on -v. Explicitly mention each module alongside
addition of the path/name to the associated arrays.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
These files will never be more than one line, and they're newline
delimited already. Moreover, adding the extra null delimiters appears to
do strange things in transit to modprobe.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This also removes a superfluous check on MODULEDIR, which is already
covered by get_kernver.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
the for loop is already a NOOP when the haystack is empty, so it already
falls through to the return 1.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
build an array of paths to modules, and install them all at once with
mkdir -p and cp --parents. Cuts back on our major source of calls to
install(1).
This is a tad ugly in that it creates some amount of data duplication,
keeping an array of paths in addition to module names. However, turns
out to be a worthwhile tradeoff as merging the two datasets into one
results in the need for massive string trimming.
|
|
Mostly, this groups "private" functions together, separate from public
functions.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
There's no use case for us calling cleanup without exiting afterwards,
so we can simplify all of our cleanup;exit; calls into just cleanup.
This means our sighandler is no longer needed (it wasn't really, to
begin with), but we split it up to make sure we exit with a posix-ish
128+signum exit value.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|