summaryrefslogtreecommitdiffstats
path: root/functions
AgeCommit message (Collapse)AuthorFilesLines
2018-03-29ship /var/run as symlink to /runDave Reisner1-1/+2
This might not strictly be strictly needed, but systemd documents it as being a requirement, else it adds a var-run-bad taint flag.
2017-10-06Restore addition of modules from config fileDave Reisner1-1/+10
Broken by c5ad00c2. ref: https://bugs.archlinux.org/task/55870
2017-10-01add crc32c for ext4Dave Reisner1-0/+3
Might be needed for ext4 filesystems formatted with the metadata_csum option. ref: https://bugs.archlinux.org/task/54091
2017-10-01Avoid erroneous deprecation warningsDave Reisner1-5/+4
Consistently handle hooks as symlinks by relying on the exit status of readlink instead of an lstat and always, additionally, examine the hooks basenames to ensure that we aren't warning about foo deprecating foo (because the hook is a symlink to somewhere else that the hook is actually stored on disk. ref: https://bugs.archlinux.org/task/55323
2017-08-22make ldd parsing compatible with upstream glibc changesDave Reisner1-3/+3
https://sourceware.org/git/?p=glibc.git;a=commit;h=eedca9772e99c72ab4c3c34e43cc764250aa3e3c
2017-08-20functions: add_full_dir: path prefix strip-offErik Stromdahl1-4/+5
Add third argument to add_full_dir: strip_prefix. The strip_prefix will be stripped off from the destination path (path in the initramfs image) when adding files. Rationale: Make it easier to add rootfs overlay hooks when generating images. add_full_dir can be invoked in this way: add_full_dir /path/on/parent/rootfs-overlay * /path/on/parent/rootfs-overlay The above invocation will add all content of */path/on/parent/rootfs-overlay* into */* in the initramfs image. Signed-off-by: Erik Stromdahl <erik.stromdahl@gmail.com>
2017-08-20functions: add_full_dir: recursive filterErik Stromdahl1-1/+1
By passing the filter glob in all recursive invocations of add_full_dir, the filtering is performed on all subdirs and not just the top dir. This makes the implementation correspond to the documented behavior in the man page. Signed-off-by: Erik Stromdahl <erik.stromdahl@gmail.com>
2017-03-19arrayize config vars in mkinitcpio.confDave Reisner1-8/+15
allows for backwards compat by detecting and converting old-style string-based configs.
2017-03-14avoid erroring when a builtin-module can't be foundDave Reisner1-1/+1
This is harmless fallout from 5249350, which tries harder to re-add aliases of builtins.
2017-03-10functions: attempt to (re)add builtin modulesDave Reisner1-2/+2
crc32 is a builtin module in the Arch kernel but also a crypto module. Resolve by this only noting that a module is added if the value in the has is 1, and not 2 (indicating a builtin). While we're here, change the f2fs softdep of crc32 to crypto-crc32. ref: https://bugs.archlinux.org/task/49380
2016-11-20functions: f2fs softdeps on crc32, not libcrc32cDave Reisner1-1/+4
This really ought to be fixed in the module, but here we are again guessing at module requirements. ref: https://bugs.archlinux.org/task/49380
2016-11-20functions: fix typo in variable nameDave Reisner1-1/+1
builderrors -> _builderrors -- this makes binary dep resolution properly a builderror. As seen in: https://bugs.archlinux.org/task/51818
2016-06-27add f2fs quirk for libcrc32cDave Reisner1-1/+1
ref: https://bugs.archlinux.org/task/49380
2016-06-27handle the case of modinfo returning multiple modulesDave Reisner1-15/+14
This is true of more and more modules with the advent of aliases, e.g. $ modinfo -F filename crc32c /lib/modules/4.6.2-rampage/kernel/arch/x86/crypto/crc32c-intel.ko.gz /lib/modules/4.6.2-rampage/kernel/crypto/crc32c_generic.ko.gz
2016-06-27Handle softdeps in modulesDave Reisner1-5/+11
modinfo outputs softdeps which we can add if they exist (failing quietly on not-found). this obviates the need for some of our own module quirks. The output of modinfo can take many forms, as it's nearly freeform text in the .modinfo section of the kernel module. The basic form is: softdep: pre: foo But it might also be: softdep: pre: foo bar post: baz Or: softdep: pre: foo softdep: post: bar So just parse the entire line, discarding anything that ends with a ':'.
2014-08-04avoid compound conditional leading to spurious "errors"Dave Reisner1-2/+6
As seen: https://bbs.archlinux.org/viewtopic.php?id=185204 https://bbs.archlinux.org/viewtopic.php?id=185265
2014-06-21add second param to add_full_dir to allow filtering filesDave Reisner1-3/+4
Use this to only add files matching *.conf in the modconf hook. Fixes FS#39994.
2014-06-21add quirk for vfat nls moduleDave Reisner1-0/+1
Fixes FS#40217.
2014-03-23Add binary library deps directly, without symlink zooDave Reisner1-7/+1
Fixes FS#39560.
2014-03-05add btrfs module quirk for linux 3.14WorMzy Tykashi1-1/+1
This patch adds in some extra hackery to make sure that users with btrfs root filesystems don't end up with unusable initrds due to the following change made upstream [1]. TL;DR: The btrfs module has dropped it's libcrc32c dependency, so mkinitcpio no longer pulls in the crc32c module necessary for the btrfs module to be inserted. The crc32c module was only pulled in previously due to mkinitcpio hackery [2], so extra hackery now seems like the logical path. This problem can be experienced by using linux-mainline on an Arch machine with a btrfs root filesystem. Besides from this extra hackery, an alternative workaround would be for users in this situation to add crc32c to their MODULES aray in their mkintcpio.conf. Of course, this needs to be done ahead of the linux-3.14 upgrade for them to avoid the problem (assuming none of their other modules depend on libcrc32c). [1] http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg30912.html [2] https://projects.archlinux.org/mkinitcpio.git/tree/functions?id=v16#n398
2013-12-01Load build and run hooks from /etc/initcpioDave Reisner1-1/+5
This lets users shoot themselves in the foot more easily, as they can put their own modified hooks into /etc/initcpio/{hooks,install} to override those shipped by the distro in /usr/lib/initcpio. To make debugging easier, include the full path of the hook being used when mkinitcpio runs in verbose mode. Implements FS#37796.
2013-11-27mkinitcpio: Allow building an image without modulesThomas Bächler1-1/+5
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-24functions: error out when buildroot isn't writeableDave Reisner1-0/+5
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-11-24mkinitcpio: add -d optionThomas Bächler1-17/+18
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-24autodetect: read modaliases from uevent filesDave Reisner1-5/+7
As suggested by Harald Hoyer, this is more accurate for the sake of following where udev gets its modaliases from. In some rare cases, it may even be more complete than scraping the raw modalias files. Also, introduce a wrapper around modprobe so that the options passed are never ommitted, or wrongly specified. In this case, a subtle bug with the -r flag is fixed due to using the wrong variable with modprobe's -d flag. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-09-20functions: always add toplevel dir in add_full_dirDave Reisner1-1/+2
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-09-09add mkinitcpio version marker in buildroot creationDave Reisner1-0/+3
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-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-0/+41
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-05-07remove "arbitrary" limit from index_of()Dave Reisner1-4/+9
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-04-24functions: implement add_firmwareDave Reisner1-7/+25
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-04-21functions: return a count of failures from map, if possibleDave Reisner1-1/+1
I don't have any particular use case for this, but it might be nice to have this available in the future. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-03-13mkinitcpio: honor updates directory for firmwareDave Reisner1-2/+5
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-03-13mkinitcpio: fix reference to bad variable nameDave Reisner1-1/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-01-31functions: add /usr/lib64 -> lib symlink0.13.0Dave Reisner1-2/+8
Relegate this and the other lib64 symlink to x86_64, too, since we have no business creating this on i686. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-01-24symlink /lib64 -> usr/lib in imageDave Reisner1-0/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-01-21Do more to determine the color caps of the termDave Reisner1-0/+18
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-0/+22
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-12parseopts: remove superfluous continue/shift statementsDave Reisner1-5/+1
Found via apron. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-01-12functions: remove broken symlink errorDave Reisner1-4/+1
Due to using PATH lookups for hooks, we can't possibly end up with a broken symlink. The build will just error out on the hook not being found. Found via apron. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-01-12functions: always force a PATH lookup for typeDave Reisner1-3/+3
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-11-26functions: always return successfully if we ran a build hookDave Reisner1-0/+5
Removal of the old API (f85d28014134076) exposed the fact that a build hook returning an error would increment the builderrors. This isn't really wanted -- we don't want to declare a hard "pass/fail" for a hook, as the functions we actually care about passing/failing are the add_* functions which are of real concern (and already caught). Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-11-26handle deprecation notices in -H and -LDave Reisner1-0/+12
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-18/+5
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-26unique _modpaths arrays in during buildDave Reisner1-1/+1
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-24functions: only show the basename of a deprecated hookDave Reisner1-1/+2
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-11-24obsolete old-style install hook APIDave Reisner1-48/+20
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-11-11functions: avoid printing empty autodetect arrayDave Reisner1-2/+1
Fixes FS#32532. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-10-21function: add a map() utility function0.11.0Dave Reisner1-24/+15
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-4/+4
If mkinitcpio -s is run, we still flush this cache to disk before exiting. Signed-off-by: Dave Reisner <dreisner@archlinux.org>