summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-11-19 03:32:46 +0100
committerDave Reisner <dreisner@archlinux.org>2012-11-24 00:01:34 +0100
commitf85d28014134076217904885ea339e2f4c438df1 (patch)
tree0301d18f0d916084b20e24ad67b2c6fcdcee72af
parentac8499c08279b05dc582cc65d9e73deda5d38572 (diff)
downloadmkinitcpio-f85d28014134076217904885ea339e2f4c438df1.tar.gz
mkinitcpio-f85d28014134076217904885ea339e2f4c438df1.tar.xz
obsolete old-style install hook API
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>
-rw-r--r--functions68
-rwxr-xr-xmkinitcpio3
-rw-r--r--mkinitcpio.8.txt3
3 files changed, 22 insertions, 52 deletions
diff --git a/functions b/functions
index 8c44e43..e370190 100644
--- a/functions
+++ b/functions
@@ -288,21 +288,6 @@ add_checked_modules() {
return $(( !${#mods[*]} ))
}
-checked_modules() {
- # Returns a list of modules filtered by the list of autodetected modules.
- # $@: arguments to all_modules
- #
- # DEPRECATED: Use add_checked_modules instead
- #
-
- if (( ${#_autodetect_cache[*]} )); then
- all_modules "$@" | grep -xFf <(printf '%s\n' "${!_autodetect_cache[@]}")
- return 1
- else
- all_modules "$@"
- fi
-}
-
add_module() {
# Add a kernel module to the initcpio image. Dependencies will be
# discovered and added.
@@ -466,12 +451,9 @@ add_file() {
add_runscript() {
# Adds a runtime script to the initcpio image. The name is derived from the
- # script which calls it, though it can be overriden by passing the name of
- # the runtime hook as the first argument to the function. This shouldn't be
- # needed and is only left for legacy compatability reasons. It may not work
- # in future versions of mkinitcpio.
+ # script which calls it as the basename of the caller.
- local funcs fn script hookname=${SCRIPT:-${BASH_SOURCE[1]##*/}}
+ local funcs fn script hookname=${BASH_SOURCE[1]##*/}
if ! script=$(find_in_dirs "$hookname" "${_d_hooks[@]}"); then
error "runtime script for \`%s' not found" "$hookname"
@@ -554,38 +536,16 @@ add_binary() {
return 0
}
-parse_hook() {
- # parse key global variables set by install hooks. This function is called
- # prior to the start of hook processing, and after each hook's build
- # function is run.
+parse_config() {
+ # parse key global variables set by the config file.
+ set -f
map add_module $MODULES
map add_binary $BINARIES
map add_file $FILES
+ set +f
- if [[ $SCRIPT ]]; then
- add_runscript "$SCRIPT"
- fi
-}
-
-find_in_dirs() {
- local dir
-
- for dir in "${@:2}"; do
- if [[ -e $dir/$1 ]]; then
- printf '%s' "$dir/$1"
- return 0
- fi
- done
-
- return 1
-}
-
-write_image_config() {
- # write the config as runtime config and as a pristine build config
- # (for audting purposes) to the image.
-
- tee "$BUILDROOT/buildconfig" < "$_f_config" | {
+ tee "$BUILDROOT/buildconfig" < "$1" | {
. /dev/stdin
# sanitize of any extra whitespace
@@ -604,6 +564,19 @@ write_image_config() {
} >"$BUILDROOT/config"
}
+find_in_dirs() {
+ local dir
+
+ for dir in "${@:2}"; do
+ if [[ -e $dir/$1 ]]; then
+ printf '%s' "$dir/$1"
+ return 0
+ fi
+ done
+
+ return 1
+}
+
initialize_buildroot() {
# creates a temporary directory for the buildroot and initialize it with a
# basic set of necessary directories and symlinks
@@ -673,7 +646,6 @@ run_build_hook() {
# run
msg2 "Running build hook: [%s]" "${script##*/}"
build
- parse_hook
}
# vim: set ft=sh ts=4 sw=4 et:
diff --git a/mkinitcpio b/mkinitcpio
index 27902f1..beb5022 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -428,8 +428,7 @@ fi
map run_build_hook "${_hooks[@]}" || (( ++_builderrors ))
# process config file
-parse_hook
-write_image_config
+parse_config "$_f_config"
# switch out the error handler to catch all errors
trap -- RETURN
diff --git a/mkinitcpio.8.txt b/mkinitcpio.8.txt
index 0c415a6..f19250f 100644
--- a/mkinitcpio.8.txt
+++ b/mkinitcpio.8.txt
@@ -160,8 +160,7 @@ functions exist to facilitate this.
Adds a runtime hook to the image, which is a busybox ash compatible shell
script. The name of the script is guaranteed to match the name of the hook the
- script is called from. It *can* be overriden, but this is not recommended, as
- this only exists for legacy compatibility.
+ script is called from.
About Runtime Hooks
-------------------