summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2012-07-29autodetect: fix wrong flag passed to modprobe0.10Dave Reisner1-1/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-07-28mkinitcpio: rename longopt for --add to --addhooksDave Reisner3-9/+9
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 Reisner5-9/+16
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-24baseroot: add flagfile to indicate we're in an initramfsTom Gundersen1-1/+4
This is used by udev to deal with firmware requests for firmware that is not available until the real root. It will also be used by systemd to detect what to do, if that is ever used. ref: http://www.spinics.net/lists/linux-wireless/msg94522.html Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-07-24init_functions: use a consistent default rootdelayDave Reisner1-1/+1
init defaults to a rootdelay of 10, but poll_device falls back on a default of 5 if rootdelay is somehow manage during the hook run. Keep this consistent and use 10 seconds in both places. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-07-15lsinitcpio: comment on why bsdtar alone isn't good enoughDave Reisner1-1/+3
I almost deleted this, replacing it with only bsdtar. Add a comment so I'm not tempted to do this again. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-07-15initalize buildroot later, and out outside of hooksDave Reisner3-36/+36
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-07-15add 'strip' install hookDave Reisner1-0/+32
Mostly a convenience for myself, and anyone else who runs builds of things like util-linux or kmod, where having debug symbols on these libraries can add a large amount of weight to the image. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-13shutdown: don't alert udev on disable VGsDave Reisner1-1/+1
Fixes FS#30271. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-12Update module filter to be aware of hyphens in the MODULES arrayBrian Parsons1-1/+1
[dave: fix whitespace and re-add needed quoting] Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-08lsinitcpio: show only regular files as binaries0.9.2Dave Reisner1-2/+1
Show only regular files in /usr/bin instead of everything (including the mess of symlinks to busybox and kmod). It's also a nice to have since we're showing more about the multiple hook points now. This mostly restores the behavior prior to f7b8a6f0fd. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-08update dev PKGBUILDDave Reisner1-3/+1
- remove replaces - exchange udev with systemd-tools Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-08avoid reliance on sed, embrace awkDave Reisner2-3/+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-08bump copyright yearDave Reisner1-1/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-08Use declare -f over type -t to avoid subshellsDave Reisner2-2/+2
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-08functions: avoid adding nonexistant modules to configDave Reisner1-2/+6
If we didn't actually add a module to the image, avoid adding it to the runtime config for probing. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-08functions: style nitsDave Reisner1-3/+11
Avoid using compound commands where one side runs a command group. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-07init: run late/cleanup hooks before checking for initDave Reisner1-4/+3
This fixes a bug that made it impossible for systemd to be booted with a separate /usr partition. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-05fix doc error for add_full_dirDave Reisner1-3/+4
This function was incorrectly named in the manpage, and is misleading since it will add symlinks, rather than follow them, as of 96e616f06785. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-05explicitly unset build function before sourcingDave Reisner1-0/+1
This fixes an unlikely (and likely unseen) regression from 9a20048c6279cd. Without unsetting the build function before sourcing the hook file, we can't guarantee that we're running the build function tied to that specific file. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-02Don't report success when builderrors > 00.9.1Dave Reisner1-1/+1
Technically, we report success when we wrote an image to disk, but this might not be obvious to users, even with a blaring warning right before this line. If in the event builderrors is incremented at all, avoid reporting any sort of "success", since there might be cause for concern. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-02catch errors in ldd ELF dep resolutionDave Reisner1-1/+7
ldd reporting a library to be 'not found' is dangerous, and should be reported. Consider this a build error, which will hopefully prompt the user to reconsider before rebooting. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-01add hookpoints to --hookhelp outputDave Reisner2-6/+25
Generalize the awk program embedded in add_runscript and create a separate function which can be reused to display the specific hooks that a script has. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-01avoid subshell in adding --quiet to bsdcpioDave Reisner1-4/+13
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-01move running of hooks to separate functionDave Reisner2-42/+39
This allows us to declare sourced variables that we want to shield from stomping on our config variables, and without needing to use a subshell. Incidentally, this also fixes FS#29992 in a more permanent way. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-30update comments in configDave Reisner1-8/+5
This really should be moved into a man page. FS#30042. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-30add_full_dir: properly handle symlinks and empty dirsDave Reisner1-2/+5
Note that we're intentionally very liberal about what we accept for symlinks, and don't actually care if the target exists. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-19manpage: remove explcit author list0.9.0Dave Reisner2-11/+3
This is what git is for. At this point, I've (re)written the majority of the page anyways. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-19manpage: expand doc on build and runtime hooksDave Reisner1-10/+98
Fully document the recommended API for install hooks, and the various hook points available for early userspace hooks. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-18init: add timestamp at start of initramfs if binary existsTom Gundersen1-1/+8
This will allow us to tell how much time was spent in the initramfs, which might be good for working on optimizations and making sure we don't regress. If a binary able to produce the timestamp is not installed this is a noop. I'll post separately an install hook to the systemd package that will install systemd-timestamp. However, it would be trivial to replace this by an independent implementation if people want to use this without systemd. With this patch I get the following on my (ancient) laptop: $ systemd-analyze Startup finished in 294ms (kernel) + 2684ms (initramfs) + 15741ms (userspace) = 18720ms FWIW, 1 second is spent on inserting the needed modules, and 1.5 seconds on mounting the rootfs (mounting btrfs is slow!). Signed-off-by: Tom Gundersen <teg@jklm.no> Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-18usr: add usr mounting as a late running hookDave Reisner5-12/+33
Mount separate /usr partitions voluntarily, as a late running hook. This is an unfortunate patch that will no doubt result in some hatemail, though it won't thoroughly break anyone to the point of not booting. As a side effect, findmnt is no longer a requisite of the core /init, so move it to the shutdown and usr hooks where it's required. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-18init: remove hardcoded udev startup/shutdownDave Reisner1-16/+1
This will be handled by udev's run_earlyhook and run_cleanuphook, respectively. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-18lsinitcpio: Always show extraction timeDave Reisner1-2/+2
Even for uncompressed images, estimate the work being done to extract to ramfs. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-18lsinitcpio: add support for listing new hooksDave Reisner1-21/+20
Read this out of the image config for -a output. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-18lsinitcpio: extract the image to a tempdirDave Reisner1-18/+45
We read the image a number of times. Extract the image to a temp directory so we can just extract it once and use the filesystem to our advantage. This requires a temp dir which we can nuke on an EXIT trap, but the whole operation is sped is a bit, especially for larger images. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-18buildsys: fix clean targetDave Reisner1-1/+1
We don't ship compressed manpages, and this never touched lsinitcpio's generated page. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-18shutdown: convert to cleanup hookDave Reisner1-1/+2
Run this later in init where we can delete the modules from the ramfs before copying the image over to /run/initramfs. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-18shutdown: package as 644, install as 755Dave Reisner2-1/+1
There's no need to keep this mildly dangerous script executable on the filesystem. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-18init: add support for early, late and cleanup hooksDave Reisner1-2/+7
This adds support for three more rounds of hooks during early userspace. Users can define a 'run_latehook' in their hook script similar to the declaration of 'run_hook' (which continue to run at the same point in execution). These are run in the same order as the original "early" hooks shortly after root is mounted. Additionally, 'run_cleanup' hook can be defined which will run right after the late hooks. These scripts are executed after mounting root in reverse order of how they're clared in mkinitcpio'c config. These late running hooks should take care of things such as: - mounting /usr (possibly encrypted) - moving config to the real root (mostly for liveCDs) - shutting down previously started daemons (e.g. udev or dropbear) Finally, we add run_earlyhook which is run as soon as possible. There will likely be only a few subscribers to this, but udev will certainly be one of them, as it needs to be started as early as possible when present, to avoid problems with firmware loading. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-18mkinitcpio: write image config after install hooksDave Reisner3-15/+22
Break this out of install/base into a separate function. We need to be able to read from the RUNHOOKS array to accurately specify which hooks to execute at runtime. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-18init_functions: move running hooks to separate funcDave Reisner2-15/+18
Abstract this out to the init_functions file, and allow this function take 2+ parameters -- the hook name to be run, a user friendly short description, and then the list of hook files to source from. While we're at it, take advantage of the fact that hooks are now installed with executable perms. If a hook isn't marked excutable, we skip it, thereby removing our eval hack. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-18init: correct trimming of earlymodules and MODULESDave Reisner1-5/+2
This never worked properly and only "fixed" the stupid bug that found an edge case when either of these vars contains nothing more than a single space. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-18use new API for install hooksDave Reisner17-46/+49
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-18functions: introduce add_runscriptDave Reisner2-4/+45
This function adds a runtime script to the /hooks directory on the initramfs image. Note that this function will also install hooks with executable permissions for use by a later change to early init. With this commit, there are now methods available which can be used in place of the MODULES, FILES, BINARIES, and SCRIPT variables, as we now offer error checking on the add_* functions. Usage of the variables is deprecated, and these will no longer be read in a future version of mkinitcpio. This commit also lays the groundwork for the addition of more early userspace hooks. Runtime hook files are parsed for specific functions and variables (not yet used) are populated. These will eventually be written to the image config so that early userspace knows exactly what to run. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-16functions: introduce add_checked_modules and add_all_modulesDave Reisner1-2/+50
Instead of returning a list of modules which the caller should then add themselves or stuff into the MODULES string, call add_module for each candidate. This is basically a different wrapper around all_modules. DEPRECATION WARNING: This commit marks checked_modules as deprecated. Although it is not slated to go away, direct usage of all_modules is strongly discouraged. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-16move -g option checking to parseopts loopDave Reisner1-9/+5
Avoid any delay in checking this option, as it only serves to fragment the logic. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-16functions: move --try logic into add_moduleDave Reisner1-13/+16
Allow add_module to detect trailing ? characters for ignoring errors rather than passing -t or --try to add_module. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-16functions: remove get_dirname and get_basenameDave Reisner1-13/+1
A lot has changed since 643e98eeb42677 when these functions were implemented, and there is exactly 1 case of get_dirname left, and no calls to get_basename. Remove these, and use a PE in place of the remaining call. Signed-off-by: Dave Reisner <dreisner@archlinux.org>