summaryrefslogtreecommitdiffstats
path: root/mkinitcpio
AgeCommit message (Collapse)AuthorFilesLines
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
2011-06-19add -t option to specify alternate build directoryDave Reisner1-11/+23
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>
2011-06-19mkinitcpio: bashification, part 2/2Dave Reisner1-8/+7
mostly consists of syntax changes in the hook parsing loop. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-19mkinitcpio: bashification, part 1/2Dave Reisner1-8/+7
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>
2011-06-19overhaul output, introducing colorDave Reisner1-55/+56
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>
2011-06-16mkinitcpio: remove cruft in getopts loopDave Reisner1-6/+0
We shouldn't guess at what the user does and doesn't want, but rather verify after parsing that what we have is sane. Also, remove the default case label, as this will never be met. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-16declare SAVELIST, QUIET, SHOW_AUTOMODS as faux booleansDave Reisner1-9/+8
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-16mkinitcpio: refactor and bashify early path calculationsDave Reisner1-26/+27
This addresses a few issues with creation of images with a $BASEDIR, the most alarming that images would always be created on the real root filesystem, with no regard for any supplied base directory. This also cleans up some repetitive path declaration wrt BASEDIR and MODULEDIR. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-16declare all variables in mkinitcpioDave Reisner1-24/+15
We also consolidate our empty variable declarations in mkinitcpio with a simple declare. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-16use consistent vim modelinesDave Reisner1-1/+2
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>
2011-06-16mkinitcpio: bashify preset build loopDave Reisner1-29/+26
This mainly consists of removing all traces of eval and building the options into an array instead a simple variable. We also make sure that the SCRIPT var is unset, as it may be populated during hook processing. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-16mkinitcpio: allow specifying kernel ver as path to imageDave Reisner1-1/+28
update the example.preset to show this syntax as an alternative Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-16mkinitcpio: use simple PEs instead of externalsDave Reisner1-4/+4
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-16use bsdcpio to create imagesDave Reisner1-36/+38
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>
2011-06-16functions: refactor add_moduleDave Reisner1-1/+1
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>
2011-06-16mkinitcpio: deprecate install() in install hooksDave Reisner1-9/+14
This is an unfortunate name clash with a common utility and should be avoided. Rename the install function to 'build' and warn the user when we discover a hook using an 'install' function. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-16mkinitcpio: Unset GREP_OPTIONS to avoid broken imagesThomas Bächler1-0/+3
2011-06-07mkinitcpio: use binary hashed depmod filesDave Reisner1-3/+3
We can condense this logic into a loop as well, which cuts back on repetative code. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-05-16Don't print success/failure result on same lineDan McGee1-3/+3
Doing the `echo -n` call causes the shell to line-buffer the output anyway, meaning one doesn't see the first part until 'SUCCESS' or 'FAILURE' is printed. This means the last message on the screen is 'Generating module dependencies' when in fact we are actually generating the image, which can take a lot of time when XZ, etc. are used. Print the status on two lines, ensuring buffering is not causing problems with out output. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27Improve compression in mkinitcpioThomas Bächler1-1/+3
- Remove default -9 compression (FS#20954) - Make compressor options configurable - Add xz support and make sure xz uses crc32 checks
2011-02-27Use in_array instead of grep -w when checking SKIPHOOKS.Thomas Bächler1-3/+8
This fixes FS#22821.
2011-02-01Set pipefail before running get_init_cpioDave Reisner1-0/+1
This addresses FS#20638, where gen_init_cpio fails, but the pipeline still reports no error because gzip exits successfully. Setting pipefail insures that if anything goes wrong with gen_init_cpio, the operation is deemed a failure and the user isn't unknowingly left with a faulty initcpio. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-01Use install instead of mkdir/cpDan McGee1-3/+3
Saves a process invocation per kernel module. Based on work presented in FS#18347, and fixed to ensure we are using the install utility rather than our defined function. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31Use new helper functions instead of system commandsDan McGee1-4/+4
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>
2010-02-11Removed/changed messages/comments about klibc/kinitGerardo Exequiel Pozzi1-5/+4
Also remove comment about "modload" in conf. Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> Signed-off-by: Thomas Bächler <thomas@archlinux.org>
2010-02-08Fixed typo in commentEric Bélanger1-1/+1
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>