[arch-projects] [mkinitcpio][PATCH 6/6] add -A option to specify extra hooks

Dave Reisner d at falconindy.com
Sat Mar 3 17:47:44 EST 2012


Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
 mkinitcpio       |    7 +++++--
 mkinitcpio.8.txt |    7 ++++++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/mkinitcpio b/mkinitcpio
index 58979bf..9f39d56 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -109,8 +109,11 @@ get_kernver() {
 trap 'cleanup 130' INT
 trap 'cleanup 143' TERM
 
-while getopts ':c:k:sb:g:p:m:nvH:LMhS:t:z:' arg; do
+while getopts ':A:c:k:sb:g:p:m:nvH:LMhS:t:z:' arg; do
     case $arg in
+        A) IFS=, read -r -a add <<< "$OPTARG"
+           ADDHOOKS+=("${add[@]}")
+           unset add ;;
         c) CONFIG=$OPTARG ;;
         k) optkver=$OPTARG ;;
         s) SAVELIST=1 ;;
@@ -309,7 +312,7 @@ for var in MODULES BINARIES FILES; do
     declare "cfg_$var=${!var}"
 done
 
-for hook in ${HOOKS}; do
+for hook in ${HOOKS} "${ADDHOOKS[@]}"; do
     in_array "$hook" "${SKIPHOOKS[@]}" && continue
     unset MODULES BINARIES FILES SCRIPT
     build() { error "$hook: no build function..."; return 1; }
diff --git a/mkinitcpio.8.txt b/mkinitcpio.8.txt
index eda5b58..ea68cfe 100644
--- a/mkinitcpio.8.txt
+++ b/mkinitcpio.8.txt
@@ -24,6 +24,11 @@ other features.
 
 Options
 -------
+*-A* 'hooks'::
+	Add the additional 'hooks' to the image. These will be processed in order
+	after all other hooks from the config file. Multiple hooks should be
+	comma-separated. This option can be specified multiple times.
+
 *-b* 'basedir'::
 	Use 'basedir' as a starting point for gathering information about the
 	currently running system. Default: /.
@@ -63,7 +68,7 @@ Options
 	file.
 
 *-S* 'hooks'::
-	Skip 'hooks' when generating the image. Several hooks should be comma-separated.
+	Skip 'hooks' when generating the image. Multiple hooks should be comma-separated.
 	This option can be specified multiple times.
 
 *-s*::
-- 
1.7.9.2



More information about the arch-projects mailing list