summaryrefslogtreecommitdiffstats
path: root/functions
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 /functions
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>
Diffstat (limited to 'functions')
-rw-r--r--functions68
1 files changed, 20 insertions, 48 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: