Age | Commit message (Collapse) | Author | Files | Lines |
|
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>
|
|
This avoids an expensive stat call and some other unnecessary path
juggling.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Much to my chagrin, we're going back to using ldd directly, as it's
otherwise too difficult to account for odd setups, such as idiots
wanting to create multilib initramfs images, or more commonly -- a 64
bit kernel on a 32 bit userland. Fortunately, we don't suffer too large
a regression in speed compared to the previous implementation.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Cut back to a single call to modinfo, instead of 3, which yields roughly
a 30% decrease in execution time for a single run of add_module. This of
course varies by module but it's an overall win.
Suggested-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
The read loop will intentionally return 1 on EOF, but parse_hook will
interpret this as an error, and trip our error handler, reporting a
false positive failure.
|
|
Thanks-to: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Thanks-to: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Without this, we hit an infinte loop and crash when a legacy 'install'
function in a hook is encountered.
Thanks-to: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
This add proper support for a $BASEDIR, wherein as much as possible is
taken from the user specified root, instead of mixing and matching
binaries and modules. This avoids conflicts, particularly with binaries
like udev or module-init-tools which may have newer functionality that
the root in the $BASEDIR requires.
This is somewhat of a large patch, which involves a few key changes:
1) Add a new class of "private" functions: _add_*, which act as a "back
end" for the equivalent non-underscore-prefixed functions.
2) Refactor the add_* family of functions to use these new back end
functions. This generally simplifies the logic as we have a clear
division of labor.
3) Instead of using ldd, which is a glorified wrapper around the RTLD,
create a wrapper around the RTLD and invoke it ourselves. This is
basically just a small performance improvement -- the bulk of the
parsing done by this function's output is done in pure bash.
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
It would be better to catch errors in build as well, but this isn't
entirely feasible due to the expectation of some builtins to return
non-zero during normal operations (e.g., read returns 1 on EOF).
Addresses FS#20661
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
This is no longer used, as all of our module discovery functions will
return clean module names.
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
This requires some refactoring of how we handle TMPDIR declaration and
creation, as well as protecting the way we do cleanup so that we don't
error out when cleanup is called prior to TMPDIR being declared.
We also add a shortcut to the build root based on the TMPDIR for
convenience.
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
Always use bash's [[ ]], and apply (( )) where arithmetic calculations
are made. We also take a few other bash shortcuts to simplify code where
possible.
We also touch the Makefile here to adjust the sed'ing for directory
names.
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
Since we intentionally word split these variables, a variable containing
only white space will never trigger us to iterate on each for loop.
Therefore, the existance check is superfluous as it will always pass.
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
We don't need to add the destination directory -- we can assume this
will always be added by another function. We also ignore $BASEDIR as we
will never be passing in a path that contains a $BASEDIR so we don't
want to erroenous trim a path.
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
Output style and coloring is borrowed from makepkg with minor
adjustments. Most instances where we encounter fatal errors are replaced
with a 'die' function to wrap this up neatly. In addition, we introduce
the -n flag, for no-color.
As a side effect, we need to source the functions file earlier so we
have the output functions available earlier.
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
We also consolidate our empty variable declarations in mkinitcpio with a
simple declare.
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
This also adds a /bin/bash shebang to functions. While not technically
necessary, this ensures that vim gives us the correct syntax highlight
file.
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
Properly detect symlinks using the -L shell test, resolving and
recursing on discovery. This results in removing a lot of extraneous
variable declarations and code.
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
This is a departure from using gen_init_cpio, which proved to be a huge
bottleneck in performance. Tests for existance change from being a call
to grep, to a simple shell test.
In the process, we have to modify the behavior of the -s option, and we
lose the -a option.
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
This is never used by anything in the official repos. Kill it with
fire.
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
This was only ever used in the base layout, and it's not needed.
devices will be present if we're using devtmpfs, and created for us by
init if we mount on tmpfs.
Also, this is part of our move towards using bsdcpio instead of
gen_init_cpio, and as a side effect we can no longer support this. Any
devices that need to be created should be done so by the runtime hooks,
not the install time hooks.
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
Simplify and fix a few bugs in the process. We rely solely on modinfo
for obtaining information about module location, dependencies and
firmware. Add a small wrapper function for modinfo that will always
specify our $BASEDIR and $KERNELVERSION for us.
Also, kill off HAS_MODULES. Since we have ADDED_MODULES, which contains
all currently added modules, we can count the elements in this when it
comes time to decide to create depmod files.
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
Modify the sed filter to remove PIC addresses and ignore the first line
which will always be the vdso. Also remove the tls filter, as glibc has
had threaded support mainlined for many years now. If a user has a glibc
this old, we don't have support for them elsewhere (udev, kernel).
We also cleanup the logical flow through this function and remove a lot
of cruft that would always return true, or that didn't quite make sense.
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
Function all_modules() doesn't correctly detect module extension.
It's a one char removing patch.
Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
|
|
Do a single grep to compare the contents of the module file (if exists)
against the results of all_modules for the provided arguments. If
there's no module file, this is still just pass through to all_modules.
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
sanitize and print during module discovery. We also strip path names
during this process and null terminate path names for safety.
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
sort/uniq the modaliases files' contents, before passing _all_ of them
to modprobe -a. This cuts back on execution time as well as cleaning up
the resulting list of modules.
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
This saves a find and grep call for every module that is added more than
once, which can lead to significant savings in image generation time.
Generating a fallback image went from 80 seconds to 60 seconds after
this patch.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This is what we currently use in makepkg for the same purpose.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Rather than go through all the hoops, check if the module has already
been added by looking for its file path and skip the addition early if
we can. This helps especially in modules with many recursive
dependencies, and is most noticable when generating a full image with
many modules.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Replace all of the repeated calls to dirname and basename with our new
replacments. Also replace the 'grep ... /dev/null' idiom with calls to
'grep -q', which does exactly what we want.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|