summaryrefslogtreecommitdiffstats
path: root/mkinitcpio
AgeCommit message (Collapse)AuthorFilesLines
2014-03-30make missing compression binaries a non-fatal warningDave Reisner1-2/+10
Fallback on no compression at all, since we don't want to make potentially poor assumptions about what the kernel might support. Fixes FS#39659.
2013-12-22Add -l flag when using lz4 compressionDave Reisner1-0/+3
This isn't documented, but it's needed since the kernel lz4 support is based on the original streaming format and not the newer default. Use -l to force the legacy codec. Fixup lsinitcpio to support the older format, and, add a warning when the newer format is detected. Who knows when this will be "resolved" ... Upstream discussion: https://code.google.com/p/lz4/issues/detail?id=102
2013-12-06prevent calling a preset from a presetDave Reisner1-1/+6
This is surely a configuration error as it's an infinite loop.
2013-11-27merge optkver into KERNELVERSIONDave Reisner1-6/+8
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-11-27mkinitcpio: Allow building an image without modulesThomas Bächler1-1/+1
The '-k none' switch prevents mkinitcpio from adding modules to the image and keeps it from bailing out when it cannot find any.
2013-11-24mkinitcpio: Improve output when -d option is used.Thomas Bächler1-3/+7
2013-11-24mkinitcpio: add -d optionThomas Bächler1-5/+10
The -d (--generatedir) option writes the root of the generated image directly to the specified directory. Useful for generating a shutdown-ramfs with mkinitcpio -d /run/initramfs/.
2013-09-09add mkinitcpio version marker in buildroot creationDave Reisner1-3/+0
It doesn't make any sense that this was added during the final image creation. This fixes a subtle bug that would manifest itself if the user archived the build root manually. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-08-28mkinitcpio: preserve permissions if run as rootDave Reisner1-1/+5
Running as non-root is usually for my own dev purposes, but someone might do this and be surprised when a directory/file that needs permissions other than root isn't preserved. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-08-28rely on libmount defaults for file locationsDave Reisner1-1/+2
Using --tab-file for findmnt calls is redundant if we can rely on the defaults. Sanitize the environment from any LIBMOUNT_* variables so that we can be sure of what file we're reading. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-07-08Generate /etc/ld.so.cache for imageDave Reisner1-0/+3
Shaves a trivial, but measurable, amount of time off of early userspace at the cost of a small cache file. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-05-07move install_modules to functions to allow for testingDave Reisner1-41/+0
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-05-07remove "arbitrary" limit from index_of()Dave Reisner1-7/+4
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-05-02mkinitcpio: ensure ERR trap propagates to install_modulesDave Reisner1-0/+2
Without this flag set, errors in install_modules are ignored, and mkinitcpio potentially exits without complaining about build problems when foolish people run out of disk (presumably after using /tmp as a build directory). Fixes FS#35037. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-04-24functions: implement add_firmwareDave Reisner1-1/+1
Add this as an abstraction for the various places firmware might exist. Additionally, don't complain about missing firmware unless *none* of it can be found -- and even then, only throw a warning. NB: this means that users building images without the autodetect hook and a rudimentary hook like "block" will see warnings which are going to cause panic, chaos, and upheaval. I fully expect that this will result in extra non-work for me in the form of closing invalid bug reports. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-03-13mkinitcpio: honor updates directory for firmwareDave Reisner1-0/+1
This also removes a check which would have otherwise hidden a missing firmware error from the user. FS#34255. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-02-28mkinitcpio: use consistent style in case statementDave Reisner1-18/+36
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-02-05Add -P, --allpresets optionDave Reisner1-10/+17
As a logical extension, allow the -p option to be specified multiple times in order to process several presets at once. Original-patch-by: Sébastien Luttringer <seblu@seblu.net> Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-01-21Do more to determine the color caps of the termDave Reisner1-16/+1
823e24 wasn't really correct, since running 'tput setaf 0' effectively sanity checks the terminfo as well as checking existance. However, it does nothing to affirm that the terminal is capable of supporting colors. Moreover, *never* fall back on the hardcoded escapes as doing so implies that we've found a broken terminfo and we have no idea what the terminal is capable of doing. This reverts commit 823e2454176d4381cd3acc30481e9d84cdc298b1.
2013-01-13factor out kver detection to functions fileDave Reisner1-18/+1
This leaves bash completion with a duplication, but this is intentional to avoid pulling in the entire functions file and worrying about pollution. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-01-12use type to determine availability of tputDave Reisner1-1/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-01-12mkinitcpio: avoid using 'file' to get kernel versionsDave Reisner1-2/+17
The kernel defines an offset at a fixed location within the bzImage which we can use to find the kernel version string. Since this is fairly important, reimplement the algorithm (which file almost surely uses) using low level tools to avoid the possibility that file may break or change its output, critically wounding mkinitcpio. Note that this change leaves 'file' in use for lsinitcpio compression detection. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-12-02mkinitcpio: use fancy unicode in -L output0.12.0Dave Reisner1-2/+4
Denote deprecation with unicode superscript footnote markers. Yes, this inherently limits us to 9 deprecation notices in its current form, but there really shouldn't ever be so many deprecated items at once. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-11-26handle deprecation notices in -H and -LDave Reisner1-18/+78
Separate out the printing from these flags to separate functions and examine each hook more closely, pointing out where it might be deprecated, and what should be used in place of it. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-11-26replace find_in_dirs with PATH= manipulationDave Reisner1-8/+7
Declaring our lookup paths like normal colon delimited PATHs lets us reuse them for builtins like source and type to do the same work that this function previously did. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-11-26selectively decompress modules on installDave Reisner1-6/+19
Don't make any assumptions about the compression on modules and scan the passed in module list for telltale extensions. This has the benefit of doing nothing when modules are uncompressed, and adds support for decompression of XZ modules. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-11-26unique _modpaths arrays in during buildDave Reisner1-10/+11
Declaring _modpaths as an associative array allows us to forego the printf|sort -u|xargs cp pipeline as we can guarantee that the array is already prepared. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-11-24obsolete old-style install hook APIDave Reisner1-2/+1
This removes any meaning from the definitions of MODULES, BINARIES, FILES, and SCRIPT within install hooks. It also removed the deprecated checked_modules() function, which is replaced by add_checked_modules(). Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-10-25Add -V/--version option to display version informationEric Bélanger1-2/+12
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
2012-10-21function: add a map() utility function0.11.0Dave Reisner1-3/+1
map() runs the first argument (a function) with each of the remaining arguments as $1. The return value of map() is only 0 if all the calls succeeded. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-10-21convert autodetect cache to hashDave Reisner1-3/+4
If mkinitcpio -s is run, we still flush this cache to disk before exiting. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-10-07ensure builtins are dash/underscore translatedDave Reisner1-2/+4
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-10-07mkinitcpio: remove find_moduledirDave Reisner1-20/+2
Using anything but /lib/modules isn't really sane, and it shouldn't be supported. If you want to use /usr/lib/modules, then /lib must be a symlink to usr/lib. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-10-07separate image building to functionsDave Reisner1-129/+137
Mostly in favor of scoping out some variables further. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-10-07honor -n for presetsDave Reisner1-0/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-10-07mkinitcpio: check for preset file by sourcing itDave Reisner1-42/+44
Instead of using a bash test, just source the preset file. If it fails, exit. This patch is a bit ugly because it remove a level of indentation.
2012-10-07commit to some level of style in variable namingDave Reisner1-101/+104
This is an ugly patch, and probably does more than I'd like it to. The idea is that mkinitcpio adopts some sort of consistent style which I'm actually happy with. I define 3 kinds of variables: 1) local variables: all lower case, and scoped within functions. Use freely, as they're well contained. 2) global variables: these are known to mkinitcpio internally, but are global in scope. They mainly carry runtime configuration and collected data during the image generation process. These are always lower case, but carry a leading underscore to denote that they're global. 3) "API" variables: also global in scope, but exist "outside" of mkinitcpio -- either drawn in from the configuration file, or "exported" to the install hooks. These are always all upper case. When introducing new variables, extreme care must be taken to pick names that will not conflict with the environment inherited by mkinitcpio. A HACKING file is introduced with a similar description of the above, and more. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-09-30mkinitcpio: munge modules.order before calling depmodDave Reisner1-1/+7
The initramfs installs all modules to kernel/ which devalues the modules.order file. To avoid any edge cases with the wrong module being loaded (because all matching modules for a given alias will be added), make sure that the modules.order file is actually valid. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-09-30functions: always treat ADDED_MODULES as a hashDave Reisner1-1/+1
Overlooked in b8d9c5cd2753e9. This change also assigns a value of "2" to builtin modules which are added to the the ADDED_MODULES array, to distinguish them from actual modules on disk. Using this, we can avoid adding builtins to the image's runtime config. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-09-24mkinitcpio: protect module install on $MODPATHSDave Reisner1-1/+1
This was always wrong and should have been braced by MODPATHS rather than ADDED_MODULES. However, since ADDED_MODULES now possibly contains modules that weren't actually added (builtins), creating an initramfs without modules causes cp to be passed a null string to be copied. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-09-24force bsdcpio to run with LANG=CDave Reisner1-1/+1
In case mkinitcpio is in run via chroot(1), this possibly silences a harmless warning about bsdcpio failing to set the default locale. This comes up fairly often with the recent install media and users think that it's something to be concerned about. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-09-17silently ignore builtin modulesDave Reisner1-0/+7
Assuming modules.builtin exists, add the module names it contains to the ADDED_MODULES hash so that we silently skip over them. Suggested-by: Matthew Monaco <dgbaley27@0x01b.net> Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-09-17declare ADDED_MODULES as associative arrayDave Reisner1-2/+2
Lookups in the hash table are far faster than traversing the entire array, as this grows O(n) and introduces a particularly noticeable slowdown on larger images. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-09-01mkinitcpio: refuse to run if image path isn't writeableDave Reisner1-0/+7
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-07-28mkinitcpio: rename longopt for --add to --addhooksDave Reisner1-7/+7
Rename this option so that it mirrors the longopt name for -S, --skiphooks. The original --add option remains behind in the option parser for backwards compatability, but no other references remain. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-07-28implement --moduleroot optionDave Reisner1-3/+7
This might be useful for creating an initramfs image as part of a kernel package. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-07-15initalize buildroot later, and out outside of hooksDave Reisner1-26/+9
mkinitcpio needs to be able to more tightly control the layout of the image. By moving this outside the control of the base hook, it's more reasonable to believe that a drop-in replacement for the base hook could be written, as it now only contains the utilities required for the /init that it provides. Being that initialize_buildroot is outside of a hook, we can make "raw" calls to coreutils that create the directories and symlinks, saving some overhead and forking. This also symlinks /usr/local/{lib,bin} into the common /usr/lib and /usr/bin, respectively, so that there's always a way to override libs and bins, and they're automatically pulled into our strict early init path of /usr/bin. Finally, we lump all this generally a little "later" in the early setup. This addresses an unseen "bug" wherein an extra temp directory that never gets used is created when leveraging a preset. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-07-15use last exit status as default arg for cleanupDave Reisner1-1/+3
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-08remove redundant header commentDave Reisner1-8/+1
I've adopted the convention of specifying the shebang for the interpreter any given install or runtime hook that a script runs under. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-08Use declare -f over type -t to avoid subshellsDave Reisner1-1/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>