summaryrefslogtreecommitdiffstats
path: root/mkinitcpio
AgeCommit message (Collapse)AuthorFilesLines
2012-02-17mkinitcpio: unzip modules before image compressionTom Gundersen1-0/+3
This increases compression efficiency, which might be useful on an image containing a lot of modules. For the usecase I had in mind, this reduced the size by about a quarter. Signed-off-by: Tom Gundersen <teg@jklm.no> Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-02-14mkinitcpio: install all modules to a single dirDave Reisner1-6/+2
depmod doesn't care where modules are, within reason, and separating modules into the respective hierarchies only serves to irritate users who go looking for modules in the rootfs (aka me). Forget all this and dump everything into the kernel/ dir. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-02-14mkinitcpio: catch more buildtime errorsDave Reisner1-3/+6
Move the unsetting of the errtrace and ERR trap flags to after the image has been built. This lets us capture errors during module installation to the build root and the call to depmod. Either of these steps failing could be hazardous and should prompt a failure. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-28mkinitcpio: obsolete install as a buildhook functionDave Reisner1-7/+1
All official hooks have been using build() for quite some time now. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-11Keep modules.devname needed for on-demand module loadingGerardo Exequiel Pozzi1-2/+2
Otherwise we need to modprobe module manually. (Particulary I need this for archiso for using /dev/loop-control) Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
2012-01-05mkinitcpio: include modules.{builtin,order} for depmod callDave Reisner1-1/+6
When present, modules.order will allow depmod to order the binary module indicies for faster lookups and more deterministic behavior in resolving aliases. We can discard this file from the buildroot after depmod is called. modules.builtin.bin is added as well (generated from modules.builtin), to allow modprobe to not fail when a symbol is provided as a builtin. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-05mkinitcpio: remove hardcoded pathsDave Reisner1-1/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-12-26mkinitcpio: avoid color when stdout isn't a ttyDave Reisner1-1/+1
Follow suit with lsinitcpio (change 0495018d) and make output colorless on redirecting/piping stdout. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-12-17ensure MODULEDIR is declared with a trailing slashDave Reisner1-1/+1
This forces bash tests as well as utilities like find to dereference MODULEDIR in the odd case that it's a symlink. Addresses FS#27494 Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-12-05mkinitcpio: add VERSION stamp to imageDave Reisner1-1/+6
This is mostly a debugging aid. lsinitcpio will be taught to read this. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-29mkinitcpio: parse vars from config file lastDave Reisner1-2/+10
This lets the config file be an override for any files or binaries added by hooks. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-29mkinitcpio: warn when no modules are added to the imageDave Reisner1-0/+2
Maybe something went wrong with depmod after a kernel install, or the user grabbed a kernel directory for an old kernel. Either way, if you're using an initramfs, there's a very high probability that you'll have at least 1 module on it. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-25mkinitcpio: dereference symlinks when resolving kernverDave Reisner1-1/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-16mkinitcpio: ensure get_kernver always returns a kverDave Reisner1-12/+17
- Always call this function. At worst, just return the current kver. - Do all our error reporting from within the function. - Add an additional check for existance prior to allow for a more appropriate error message when we encounter a situation such as /boot not being mounted. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-16mkinitcpio: avoid stomping on TMPDIR from the environmentDave Reisner1-10/+13
cc36db45 was a bit too strict about localizing variables and blew out TMPDIR, which might be a legit variable sourced from the calling environment. Restore this behavior with a bit of refactoring, and additionally add in a check to make sure the temporary directory is writeable before proceeding. Fixes FS#26373. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-09mkinitcpio: avoid using mountpointDave Reisner1-2/+4
As it turns out, the mountpoint toy from util-linux isn't really at feature parity with sysvinit's. In particular, and with respect to v2.20: - It throws false negatives when /proc isn't mounted. Rather, it should fall back on using stat(2), as is the basis for sysvinit's tool. - when /proc is mounted with as source of 'none', it segfaults on a null dereference. Patches have been sent upstream to resolve these issues, but in the meantime, we're mounting /dev and /proc for very specific reasons. Instead of relying on a fork/exec to figure out if these API FS's are mounted, use a simple bash test to see if these specific needs are available within the FS. One of many possible fixes for FS#26344. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-01mkinitcpio: avoid creating savelist in main loopDave Reisner1-3/+3
If PRESET is set, we're in the main loop, not a worker process. No image will ever be created here, so there's never a need for saving any build dir. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-01remove duplicate "error" in error messageDave Reisner1-1/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-01use correct variable to reference compression methodDave Reisner1-1/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-01mkinitcpio: insist that /dev and /proc be mountedDave Reisner1-0/+4
This avoids errors with process substitutions in chroots, among other things. It's important that /proc be checked first as /etc/mtab might be a link to /proc/self/mounts. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-27mkinitcpio: keep going even when a hook isn't foundDave Reisner1-1/+2
Instead of bailing entirely, throw an error, and ensure that we exit with a non-zero status. The user might do something as simple as misspell a hook name which may or may not prevent a useful image from being created. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-27mkinitcpio: explicitly create $BUILDROOTDave Reisner1-0/+3
Avoids explosions if a user has no HOOKS in their config, as seen: https://bbs.archlinux.org/viewtopic.php?pid=966344 Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-27mkinitcpio: fix whitespace errors in error messagesDave Reisner1-2/+2
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-27mkinitcpio: simplify setting of SKIPHOOKSDave Reisner1-6/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-27ensure local scoping of variablesDave Reisner1-2/+2
Also make sure that simple variables are declared as null strings. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-07-09mkinitcpio: reference -h on failed option parsingDave Reisner1-2/+2
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-07-09mkinitcpio: add --quiet to bsdcpio without -vDave Reisner1-1/+3
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-07-04mkinitcpio: include version in help msgDave Reisner1-0/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-07-04fix module installation issues with BASEDIRDave Reisner1-1/+4
Broken in 491a99. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-07-04unify error messaging, both in grammar and outputDave Reisner1-9/+10
This also removes a superfluous check on MODULEDIR, which is already covered by get_kernver. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-07-04mkinitcpio: refactor BASEDIR resolutionDave Reisner1-11/+12
This should be performed first, to avoid false positives on any checks that would have been previously done before we knew our BASEDIR was valid. Remove usage of readlink here as well, and use pushd/pwd to resolve. The final trimming of any trailing slash (which might be the entire BASEDIR value) resolves an edge case bug where specifying a BASEDIR that resolved to '/' would cause explosions in add_symlink. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-07-03Merge branch 'working' of https://github.com/falconindy/mkinitcpio into workingThomas Bächler1-5/+2
2011-07-02cleanup rarely and unused variable declarationsDave Reisner1-5/+2
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-07-02Fix -k /path when -b is usedGerardo Exequiel Pozzi1-1/+1
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
2011-07-02install modules all at onceDave Reisner1-1/+4
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.
2011-07-02always exit from cleanupDave Reisner1-16/+8
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>
2011-07-01mkinitcpio: use msg instead of echo for hook helpDave Reisner1-1/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-07-01avoid touching the linker directlyDave Reisner1-17/+1
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>
2011-06-27mkinitcpio: fix resolution issues with RTLDDave Reisner1-3/+2
The _add_dir call is all wrong. The necessary paths are created by reversing the order of the _add_symlink and _add_file calls, as _add_file will take care of creating parent directories. Thanks-to: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-06-27install/base: use private API call to add configDave Reisner1-1/+1
We can't let add_file get its hands on the config file, because we need to be sure that an absolute path is honored. As a side effect, ensure that $BASEDIR is appended to the config file during preset processing. Thanks-to: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-06-26Use error function instead of echoSebastien Luttringer1-2/+2
Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
2011-06-26Print pretty message if no help is defined in hookSebastien Luttringer1-0/+4
Thanks to Dave Reisner for having suggested! Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
2011-06-26Fix printing of bash usage when asking for a bad hookSebastien Luttringer1-2/+6
before: mkinitcpio -H sex /sbin/mkinitcpio: line 105: /lib/initcpio/install/sex: No such file or directory Help for hook 'sex': GNU bash, version 4.2.10(2)-release (x86_64-unknown-linux-gnu) These shell commands are defined internally. Type `help' to see this list. after: mkinitcpio -H sex ==> ERROR: No hook sex Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
2011-06-25properly support $BASEDIRDave Reisner1-1/+19
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>
2011-06-25mkinitcpio: allow absolute paths to preset filesDave Reisner1-2/+6
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-25mkinitcpio: catch errors in parse_hookDave Reisner1-0/+14
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>
2011-06-25mkinitcpio: only show usage on requestDave Reisner1-2/+5
Display an actual error message for the user when they enter an incorrect option, or neglect to provide $OPTARG when needed. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-25mkinitcpio: allow overriding the compression methodDave Reisner1-1/+10
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-25remove support for -m to add a startup messageDave Reisner1-5/+1
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-19mkinitcpio: declare usage as a heredocDave Reisner1-18/+22
alphabetize the usage while we're at it