summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
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>
2012-05-16mmc: package as mode 644, not 755Dave Reisner1-0/+0
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-16refactor error tracking in build hooksDave Reisner2-8/+14
Rather than catching errors solely from parse_hook via an ERR trap, implement a RETURN trap which catches all errors from the core add_* functions. In the future, this may mean that support for MODULES/FILES/BINARIES within hooks goes away, and those variables remain only in the config. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-16document special kernel cmdline parametersDave Reisner2-0/+55
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-16mkinitcpio: separate logic to resolve kernel versionDave Reisner1-8/+22
Rename get_kernelver -> resolve_kernelver, and ensure that it only does what it's name advertises. Introduce find_moduledir to locate the corresponding module directory in /usr/lib or /lib. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-16use MODULEDIR as reference for *.(order|builtin) filesDave Reisner1-1/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-12remove unnecessary quoting/bracingDave Reisner2-9/+9
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-12functions: merge _add_symlink into add_symlinkDave Reisner1-19/+11
This frontend/backend split is no longer necessary without the notion of a basedir. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-12functions: merge _add_file into add_fileDave Reisner1-28/+16
This frontend/backend split is no longer necessary without the notion of a basedir. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-12function: merge _add_dir into add_dirDave Reisner1-17/+9
This frontend/backend split is no longer necessary without the notion of a basedir. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-12mkinitcpio: remove --basedir optionDave Reisner8-88/+45
This option is just a bad idea. Initramfs creation is too important to get wrong, and running it from outside the root FS has too many gotchas, the worst of them being: - where do you pull hooks from? - how do you resolve binary dependencies within the root? In general, dealing with the extra luggage of the base directory makes the codebase more complicated than it needs to be (see all the '_' prefixed functions which are called from add functions). In favor of simplifying the code, and making it more maintainable, kill this off and force the sane option of chroot'ing into an install if the need arises. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-03remove 'net' hooks. these belong to mkinitcpio-nfs-utils0.8.8Dave Reisner2-193/+0
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-03functions: firmware is now in /usr/libMatthew Monaco1-2/+2
2012-05-02ensure that cmdline added hooks are run properly in early initDave Reisner2-4/+15
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-02lsinitcpio: fallback on 80 cols when tput failsDave Reisner1-0/+3
This only happens when the terminfo file is missing, but its a simple fix. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-02fsck: try harder to find fsck binariesDave Reisner1-2/+2
fsck binaries might be outside of /sbin -- glob on all the common paths. This almost matches what we use for util-linux's fsck search path, but we omit the oddball /sbin/fs and /sbin/fs.d directories. Note that this only affects non-autodetect images, since autodetect resolves fsck helpers directly by name. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-28init_functions: remove non-devtmpfs caseDave Reisner1-6/+2
devtmpfs is no longer supported elsewhere, so this is essentially dead code. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-28init_functions: add support for PARTUUID tagsDave Reisner1-13/+6
libblkid (and thus blkid) gain support for this in util-linux 2.22. This block gets refactored slightly to cut out the monotony. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-22functions: align error output with GNU getopt_longDave Reisner1-8/+7
Display the name of the program. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-22functions: add missing local for iteratorDave Reisner1-0/+2
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-22bash-completion: avoid using cdDave Reisner1-4/+19
Introduce _files_from_dir, which loops over arguments to find files in the given directories. Additionally allow passing a flag which will strip suffixes from any found files. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-22mkinitcpio: check return of cd before listing hooksDave Reisner1-2/+2
$ mkinitcpio -L ==> Available hooks /usr/bin/mkinitcpio: line 173: cd: /lib/initcpio/install: No such file or directory sort and dedupe as well, since we deal with a hierarchy which may (for some horrible reason) contain duplicates. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-22mmc: add install hookDave Reisner1-0/+19
Thanks to Radoslaw Nadstawny (Rad3k) for writing this. Satsifies FS#21022. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-22create lsinitcpio symlink for bash completionDave Reisner1-0/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-22lsinitcpio: avoid exiting from usageDave Reisner1-4/+4
Print a more helpful message when no image is specified. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-22lsinitcpio: show file sizes in analyze outputDave Reisner1-3/+28
Always display the file size on disk, but also display the uncompressed size for compressed images. Borrows my own size_to_human function from paccache and elsewhere. Before: ==> Compressed with: gzip -> Compression ratio: .377 -> Estimated decompression time: 0.058s After: ==> Size: 2.67 MiB ==> Compressed with: gzip -> Uncompressed size: 7.07 MiB (.377 ratio) -> Estimated decompression time: 0.059s Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-22mkinitcpio: dont exit from usageDave Reisner1-2/+2
Additionally, exit zero after returning. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-22mkinitcpio.8: manpage cleanupDave Reisner1-2/+2
tweak styling of synopsis and link to lsintcpio in SEE ALSO Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-22Add manpage for lsinitcpioDave Reisner3-3/+69
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-22lsinitcpio: adopt parseopts for option parsingDave Reisner2-21/+41
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-22mkinitcpio: adopt parseopts for option parsingDave Reisner3-85/+132
Updates the doc and bash-completion, as well. Also adds the previously unmentioned -A option to the --help output. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-20functions: add parseopts for longopt funDave Reisner1-0/+138
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-18gitignore: ignore the right manpage sectionDave Reisner1-1/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-18bash-completion: align whitespace with rest of repoDave Reisner1-38/+38
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-16mkinitcpio: refuse to run without hooks definedDave Reisner1-0/+4
This still doesn't solve all our problems, but it gets us closer. There's no point in creating an image if HOOKS aren't present as this is the bread and butter of any sane mkinitcpio recipe. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-16mkinitcpio: refer to /usr/lib/modules uniformlyDave Reisner1-5/+5
This should have been done as part of b65cf9cd9. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-09btrfs: delete hooks -- these belong to core/btrfs0.8.7Dave Reisner2-22/+0
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-09hooks: use consistent shebang, modeline, function styleDave Reisner3-10/+15
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-09mdadm: fix raid[456] autodetectionDave Reisner1-1/+1
20509ade neglected to filter the raid456 module when detecting raid[456] arrays, which lead to non-bootable systems from the autodetect-enabled image. Signed-off-by: Dave Reisner <dreisner@archlinux.org>