From 66ab66ebccfc66a8d3afd6f331b4548f6cd973a7 Mon Sep 17 00:00:00 2001 From: Morten Linderud Date: Tue, 10 Sep 2019 22:54:25 +0200 Subject: Add flag to specify where to look for hooks. --- man/mkinitcpio.8.txt | 5 ++++- mkinitcpio | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/man/mkinitcpio.8.txt b/man/mkinitcpio.8.txt index 79dbee3..16b914e 100644 --- a/man/mkinitcpio.8.txt +++ b/man/mkinitcpio.8.txt @@ -36,11 +36,14 @@ Options Set 'directory' as the location where the initramfs is built. This might be useful to generate a shutdown ramfs in '/run/initramfs'. +*-D, \--hookdir* 'directory':: + Set 'directory' as the location where hooks will be searched for when + generating the image. + *-g, \--generate* 'filename':: Generate a CPIO image as 'filename'. Default: no; this means nothing will be written to the filesystem unless this option is specified. - *-H, \--hookhelp* 'hookname':: Output help for hookname 'hookname'. diff --git a/mkinitcpio b/mkinitcpio index db7a61a..42e78bf 100755 --- a/mkinitcpio +++ b/mkinitcpio @@ -56,6 +56,7 @@ usage: ${0##*/} [options] -s, --save Save build directory. (default: no) -d, --generatedir Write generated image into -t, --builddir Use DIR as the temporary build directory + -D, --hookdir Specify where to look for hooks. -V, --version Display version information and exit -v, --verbose Verbose output (default: no) -z, --compress Use an alternate compressor on the image @@ -408,6 +409,11 @@ while :; do shift _optmoduleroot=$1 ;; + -D|--hookdir) + shift + _d_hooks="$(readlink -f "$1")/hooks" + _d_install="$(readlink -f "$1")/install" + ;; --) shift break 2 -- cgit v1.2.3-24-g4f1b From 001a0559cd52d2ab600e31d192198062021e8898 Mon Sep 17 00:00:00 2001 From: Morten Linderud Date: Tue, 17 Sep 2019 20:01:28 +0200 Subject: [mkinitcpio] Support multiple hook paths --- mkinitcpio | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mkinitcpio b/mkinitcpio index 42e78bf..f40cd6d 100755 --- a/mkinitcpio +++ b/mkinitcpio @@ -14,6 +14,8 @@ _f_functions=functions _f_config=mkinitcpio.conf _d_hooks="$PWD/hooks:/usr/lib/initcpio/hooks:/lib/initcpio/hooks" _d_install="$PWD/install:/usr/lib/initcpio/install:/lib/initcpio/install" +_d_flag_hooks="" +_d_flag_install="" _d_firmware=({/usr,}/lib/firmware/updates {/usr,}/lib/firmware) _d_presets=mkinitcpio.d @@ -411,8 +413,8 @@ while :; do ;; -D|--hookdir) shift - _d_hooks="$(readlink -f "$1")/hooks" - _d_install="$(readlink -f "$1")/install" + _d_flag_hooks+="$1/hooks:" + _d_flag_install+="$1/install:" ;; --) shift @@ -426,6 +428,11 @@ if [[ -t 1 ]] && (( _optcolor )); then try_enable_color fi +if [[ -n $_d_flag_hooks && -n $_d_flag_install ]]; then + _d_hooks=$_d_flag_hooks + _d_install=$_d_flag_install +fi + # insist that /proc and /dev be mounted (important for chroots) # NOTE: avoid using mountpoint for this -- look for the paths that we actually # use in mkinitcpio. Avoids issues like FS#26344. -- cgit v1.2.3-24-g4f1b From 7984722e127d411d2c978eaa9665709b4a681485 Mon Sep 17 00:00:00 2001 From: Morten Linderud Date: Tue, 17 Sep 2019 21:42:02 +0200 Subject: [mkinitcpio] Fixup declaration and remove trailing : --- mkinitcpio | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mkinitcpio b/mkinitcpio index f40cd6d..9d4357e 100755 --- a/mkinitcpio +++ b/mkinitcpio @@ -14,8 +14,7 @@ _f_functions=functions _f_config=mkinitcpio.conf _d_hooks="$PWD/hooks:/usr/lib/initcpio/hooks:/lib/initcpio/hooks" _d_install="$PWD/install:/usr/lib/initcpio/install:/lib/initcpio/install" -_d_flag_hooks="" -_d_flag_install="" +_d_flag_{hooks,install}= _d_firmware=({/usr,}/lib/firmware/updates {/usr,}/lib/firmware) _d_presets=mkinitcpio.d @@ -429,8 +428,8 @@ if [[ -t 1 ]] && (( _optcolor )); then fi if [[ -n $_d_flag_hooks && -n $_d_flag_install ]]; then - _d_hooks=$_d_flag_hooks - _d_install=$_d_flag_install + _d_hooks=${_d_flag_hooks%:} + _d_install=${_d_flag_install%:} fi # insist that /proc and /dev be mounted (important for chroots) -- cgit v1.2.3-24-g4f1b From 60713cf838baeaa59b71788aaa0fb421b0ecbcd5 Mon Sep 17 00:00:00 2001 From: Giancarlo Razzolini Date: Fri, 4 Oct 2019 14:28:08 -0300 Subject: * Fix whitespace --- man/mkinitcpio.8.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/mkinitcpio.8.txt b/man/mkinitcpio.8.txt index 16b914e..a69cf20 100644 --- a/man/mkinitcpio.8.txt +++ b/man/mkinitcpio.8.txt @@ -37,7 +37,7 @@ Options useful to generate a shutdown ramfs in '/run/initramfs'. *-D, \--hookdir* 'directory':: - Set 'directory' as the location where hooks will be searched for when + Set 'directory' as the location where hooks will be searched for when generating the image. *-g, \--generate* 'filename':: -- cgit v1.2.3-24-g4f1b