5 DEFAULTCFG
=/etc
/boot.cfg.default
6 LOCALCFG
=/etc
/boot.cfg.
local
9 INHERIT
="ahci acpi no_apic nobeep"
13 # This routine performs three tasks:
14 # - substitute variables in the configuration lines;
15 # - remove multiboot entries that refer to nonexistent kernels;
16 # - adjust the default option for line removal and different files.
17 # The last part is handled by the awk part of the routine.
21 # Substitute variables like $rootdevname and $args
22 line
=$
(eval echo \"$line\")
24 if ! echo "$line" |
grep -sq '^menu=.*multiboot'
30 # Check if the referenced kernel is present
31 kernel
=`echo "$line" | sed -n 's/.*multiboot[[:space:]]*\(\/[^[:space:]]*\).*/\1/p'`
34 echo "Warning: config contains entry for \"$kernel\" which is missing! Entry skipped." 1>&2
46 # A menu entry discarded by the kernel check above
57 # The menu count base as passed in by count_entries()
64 # Correct for the menu count base and store for later
74 # If a default was given, correct for removed lines
75 # (do not bother to warn if the default itself is gone)
77 for (i = default; i > 0; i--)
78 if (skip[i]) default--;
79 print "default=" default
87 echo -n "BASE="; grep -cs '^menu=' "$1"
92 echo root device
$ROOT not found
96 rootdevname
=`echo $ROOT | sed 's/\/dev\///'`
98 # Construct a list of inherited arguments for boot options to use. Note that
99 # rootdevname must not be passed on this way, as it is changed during setup.
101 for k
in $INHERIT; do
102 if sysenv |
grep -sq "^$k="; then
103 kv
=$
(sysenv |
grep "^$k=")
108 if [ -r $DEFAULTCFG ]
110 filter_entries
< $DEFAULTCFG >> $TMP
113 if [ -d /boot
/minix_latest
-o -h /boot
/minix_latest
]
115 latest
=`basename \`stat
-f "%Y" /boot
/minix_latest\
``
118 [ -d $DIRSBASE ] && for i
in `ls $DIRSBASE/`
120 build_name
="`basename $i`"
121 if [ "$build_name" != "$latest" ]
123 echo "menu=Start MINIX 3 ($build_name):load_mods $DIRSBASE/$i/mod*;multiboot $DIRSBASE/$i/kernel rootdevname=$rootdevname $args" >> $TMP
129 # If the local config supplies a "default" option, we assume that this
130 # refers to one of the options in the local config itself. Therefore,
131 # we increase this default by the number of options already present in
132 # the output so far. To this end, count_entries() inserts a special
133 # token that is recognized and filtered out by filter_entries().
134 (count_entries
$TMP; cat $LOCALCFG) | filter_entries
>> $TMP