Age | Commit message (Collapse) | Author | Files | Lines |
|
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>
|
|
This really should be moved into a man page.
FS#30042.
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>
|
|
This is what git is for. At this point, I've (re)written the majority of
the page anyways.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Fully document the recommended API for install hooks, and the various
hook points available for early userspace hooks.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This will allow us to tell how much time was spent in the initramfs,
which might be good for working on optimizations and making sure we
don't regress.
If a binary able to produce the timestamp is not installed this is a
noop.
I'll post separately an install hook to the systemd package that will
install systemd-timestamp. However, it would be trivial to replace this
by an independent implementation if people want to use this without
systemd.
With this patch I get the following on my (ancient) laptop:
$ systemd-analyze
Startup finished in 294ms (kernel) + 2684ms (initramfs) + 15741ms (userspace) = 18720ms
FWIW, 1 second is spent on inserting the needed modules, and 1.5 seconds
on mounting the rootfs (mounting btrfs is slow!).
Signed-off-by: Tom Gundersen <teg@jklm.no>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Mount separate /usr partitions voluntarily, as a late running hook.
This is an unfortunate patch that will no doubt result in some hatemail,
though it won't thoroughly break anyone to the point of not booting.
As a side effect, findmnt is no longer a requisite of the core /init, so
move it to the shutdown and usr hooks where it's required.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This will be handled by udev's run_earlyhook and run_cleanuphook,
respectively.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Even for uncompressed images, estimate the work being done to extract to
ramfs.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Read this out of the image config for -a output.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
We read the image a number of times. Extract the image to a temp
directory so we can just extract it once and use the filesystem to our
advantage. This requires a temp dir which we can nuke on an EXIT trap,
but the whole operation is sped is a bit, especially for larger images.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
We don't ship compressed manpages, and this never touched lsinitcpio's
generated page.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Run this later in init where we can delete the modules from the ramfs
before copying the image over to /run/initramfs.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
There's no need to keep this mildly dangerous script executable on the
filesystem.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This adds support for three more rounds of hooks during early userspace.
Users can define a 'run_latehook' in their hook script similar to the
declaration of 'run_hook' (which continue to run at the same point in
execution). These are run in the same order as the original "early"
hooks shortly after root is mounted.
Additionally, 'run_cleanup' hook can be defined which will run right
after the late hooks. These scripts are executed after mounting root in
reverse order of how they're clared in mkinitcpio'c config.
These late running hooks should take care of things such as:
- mounting /usr (possibly encrypted)
- moving config to the real root (mostly for liveCDs)
- shutting down previously started daemons (e.g. udev or dropbear)
Finally, we add run_earlyhook which is run as soon as possible. There
will likely be only a few subscribers to this, but udev will certainly
be one of them, as it needs to be started as early as possible when
present, to avoid problems with firmware loading.
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>
|
|
Abstract this out to the init_functions file, and allow this function
take 2+ parameters -- the hook name to be run, a user friendly short
description, and then the list of hook files to source from. While we're
at it, take advantage of the fact that hooks are now installed with
executable perms. If a hook isn't marked excutable, we skip it, thereby
removing our eval hack.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This never worked properly and only "fixed" the stupid bug that found
an edge case when either of these vars contains nothing more than a
single space.
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>
|
|
Avoid any delay in checking this option, as it only serves to fragment
the logic.
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>
|
|
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>
|
|
Rename get_kernelver -> resolve_kernelver, and ensure that it only does
what it's name advertises. Introduce find_moduledir to locate the
corresponding module directory in /usr/lib or /lib.
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 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>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This only happens when the terminfo file is missing, but its a simple
fix.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
fsck binaries might be outside of /sbin -- glob on all the common paths.
This almost matches what we use for util-linux's fsck search path, but
we omit the oddball /sbin/fs and /sbin/fs.d directories.
Note that this only affects non-autodetect images, since autodetect
resolves fsck helpers directly by name.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
devtmpfs is no longer supported elsewhere, so this is essentially dead
code.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
libblkid (and thus blkid) gain support for this in util-linux 2.22. This
block gets refactored slightly to cut out the monotony.
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>
|
|
Introduce _files_from_dir, which loops over arguments to find files in
the given directories. Additionally allow passing a flag which will
strip suffixes from any found files.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
$ mkinitcpio -L
==> Available hooks
/usr/bin/mkinitcpio: line 173: cd: /lib/initcpio/install: No such file or directory
sort and dedupe as well, since we deal with a hierarchy which may (for
some horrible reason) contain duplicates.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Thanks to Radoslaw Nadstawny (Rad3k) for writing this.
Satsifies FS#21022.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Print a more helpful message when no image is specified.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Always display the file size on disk, but also display the uncompressed
size for compressed images. Borrows my own size_to_human function from
paccache and elsewhere.
Before:
==> Compressed with: gzip
-> Compression ratio: .377
-> Estimated decompression time: 0.058s
After:
==> Size: 2.67 MiB
==> Compressed with: gzip
-> Uncompressed size: 7.07 MiB (.377 ratio)
-> Estimated decompression time: 0.059s
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Additionally, exit zero after returning.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|