summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorScott James Remnant <scott@ubuntu.com>2009-12-16 17:47:49 +0000
committermaximilian attems <maks@debian.org>2010-04-05 04:09:43 +0200
commit553aa3742ca43b4ba4e87b2dea2c5d31cc43a124 (patch)
treeefc5a2caa83f7499bef8bca3cdbda43918c83660 /scripts
parent135b1620f5d591c6ffe6059124802d534d5473fb (diff)
downloadinitramfs-tools-553aa3742ca43b4ba4e87b2dea2c5d31cc43a124.tar.gz
initramfs-tools-553aa3742ca43b4ba4e87b2dea2c5d31cc43a124.zip
mkinitramfs: generate pre-cached boot order file
if tsort is available, use it instead of custom sorting code if a pre-cached order file is available, use that instead [ move cache_run_scripts from scripts/functions to hook-scripts as only used on mkinitramfs build and not on boot ] Signed-off-by: maximilian attems <maks@debian.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/functions27
1 files changed, 24 insertions, 3 deletions
diff --git a/scripts/functions b/scripts/functions
index 9b864ae..7b68255 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -186,9 +186,22 @@ reduce_prereqs()
done
}
+get_prereq_pairs()
+{
+ set_initlist
+ for gp_x in ${initlist}; do
+ echo ${gp_x} ${gp_x}
+ prereqs=$(${initdir}/${gp_x} prereqs)
+ for prereq in ${prereqs}; do
+ echo ${prereq} ${gp_x}
+ done
+ done
+}
+
call_scripts()
{
for cs_x in ${runlist}; do
+ [ -f ${initdir}/${cs_x} ] || continue
# mkinitramfs verbose output
if [ "${verbose}" = "y" ]; then
echo "Calling hook ${cs_x}"
@@ -205,9 +218,17 @@ run_scripts()
{
initdir=${1}
[ ! -d ${initdir} ] && return
- get_prereqs
- reduce_prereqs
- call_scripts
+
+ if [ -f ${initdir}/ORDER ]; then
+ . ${initdir}/ORDER
+ elif command -v tsort >/dev/null 2>&1; then
+ runlist=$(get_prereq_pairs | tsort)
+ call_scripts $2
+ else
+ get_prereqs
+ reduce_prereqs
+ call_scripts
+ fi
}
# Load custom modules first