summaryrefslogtreecommitdiffstats
path: root/mkinitcpio
AgeCommit message (Collapse)AuthorFilesLines
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>
2010-01-12Do not append a trailing /, remove it (fixed FS#17793)Thomas Bächler1-4/+2
The comment said it was appending a trailing /, but it was actually removed Recent fixes adjusted the code to do what the comment says, which is wrong here. This fixes the code and the comment.
2010-01-05Revert 1558dfbf3b2a42f43594acf6e3d8f9b329ff1133 and ↵Thomas Bächler1-17/+4
984cbd4eb023001668eea530e2b5ed2e57ba3693 and depend on bash There was no proper upgrade path for these changes. This can be reconsidered once a clean upgrade path is provided. Compatibility with non-bash shells is not as important as backwards-compatibility of existing configurations.
2009-09-04Exit with error if PRESETS seems to be defined as an array.Loui Chang1-2/+6
Signed-off-by: Loui Chang <louipc.ist@gmail.com> Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2009-09-01Defining PRESETS as a bash array is no longer supported.Loui Chang1-1/+10
PRESETS should be defined as a string in all mkinitcpio preset files for compatibility with dash. Signed-off-by: Loui Chang <louipc.ist@gmail.com> Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2009-09-01Replace all occurances of 'source' with a dot for dash compatibility.Loui Chang1-6/+6
Signed-off-by: Loui Chang <louipc.ist@gmail.com> Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2009-08-05Do not rely on -L test; use -h instead.Loui Chang1-1/+1
See `man dash` Signed-off-by: Loui Chang <louipc.ist@gmail.com> Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2009-08-05Eliminate bashisms so things work in dash.Loui Chang1-5/+5
Signed-off-by: Loui Chang <louipc.ist@gmail.com> Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2009-08-05Set $UID if unset, required by the autodetect hook.Loui Chang1-0/+4
$UID isn't set by default in dash. Signed-off-by: Loui Chang <louipc.ist@gmail.com> Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2009-06-06Add support for lzma and bzip2 compression for the imageThomas Bächler1-1/+2
2009-01-23Dry-run output check was reversed, whoopsAaron Griffin1-1/+1
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2009-01-21Change initial output when running a dry-run0.5.22Aaron Griffin1-1/+5
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2008-04-02Remove filelist sorting, as it causes random bugs0.5.18.1Thomas Bächler1-2/+0
2008-03-16Fix various coding style issuesThomas Bächler1-15/+15
2008-03-16Remove a warning during image generationThomas Bächler1-1/+0
2008-03-15Remove duplicate files from the filelist, gen_init_cpio actually adds them ↵0.5.18pre1Thomas Bächler1-0/+2
to the image twice
2008-03-15Fix trap call, always call cleanupThomas Bächler1-2/+10
2008-03-15Fix syntax error introduced in one of the last commitsThomas Bächler1-2/+2
2008-03-15Make presets more powerful: a fallback image can be generated without a ↵Thomas Bächler1-2/+12
separate configuration file