Add implementation of LOAD_HELPERS_ONLY

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2010-01-21 10:30:54 -08:00
parent a248acb4d4
commit efc43b1b24
5 changed files with 20 additions and 6 deletions

View File

@ -334,9 +334,9 @@ sub generate_script_3($) {
save_progress_message 'Initializing...';
if ( $export ) {
my $fn = find_file 'modules';
my $fn = find_file $config{LOAD_HELPERS_ONLY} ? 'helpers' : 'modules';
if ( $fn ne "$globals{SHAREDIR}/modules" && -f $fn ) {
if ( -f $fn && ! $fn =~ "^$globals{SHAREDIR}/" ) {
emit 'echo MODULESDIR="$MODULESDIR" > ${VARDIR}/.modulesdir';
emit 'cat > ${VARDIR}/.modules << EOF';
open_file $fn;

View File

@ -189,7 +189,7 @@ our %config;
#
# Config options and global settings that are to be copied to output script
#
our @propagateconfig = qw/ DISABLE_IPV6 MODULESDIR MODULE_SUFFIX SUBSYSLOCK /;
our @propagateconfig = qw/ DISABLE_IPV6 MODULESDIR MODULE_SUFFIX LOAD_HELPERS_ONLY SUBSYSLOCK /;
#
# From parsing the capabilities file or detecting capabilities
#
@ -1962,7 +1962,7 @@ sub load_kernel_modules( ) {
my @moduledirectories = split /:/, $modulesdir;
if ( $moduleloader && open_file 'modules' ) {
if ( $moduleloader && open_file $config{LOAD_HELPERS_ONLY} ? 'helpers' : 'modules' ) {
my %loadedmodules;
$loadedmodules{$_}++ for split_list( $config{DONT_LOAD}, 'module' );

View File

@ -300,7 +300,7 @@ load_kernel_modules() # $1 = Yes, if we are to save moduleinfo in $VARDIR
[ -d $directory ] && moduledirectories="$moduledirectories $directory"
done
modules=$(find_file modules)
[ -n "$LOAD_HELPERS_ONLY" ] && modules=$(find_file helpers) || modules=$(find_file modules)
if [ -f $modules -a -n "$moduledirectories" ]; then
MODULES=$(lsmod | cut -d ' ' -f1)

View File

@ -265,7 +265,7 @@ load_kernel_modules() # $1 = Yes, if we are to save moduleinfo in $VARDIR
[ -d $directory ] && moduledirectories="$moduledirectories $directory"
done
modules=$(find_file modules)
[ -n "$LOAD_HELPERS_ONLY" ] && modules=$(find_file helpers) || modules=$(find_file modules)
if [ -f $modules -a -n "$moduledirectories" ]; then
MODULES=$(lsmod | cut -d ' ' -f1)

View File

@ -315,6 +315,20 @@ get_config() {
fi
;;
esac
case $LOAD_HELPERS_ONLY in
Yes|yes)
;;
No|no)
LOAD_HELPERS_ONLY=
;;
*)
if [ -n "$LOAD_HELPERS_ONLY" ]; then
echo " ERROR: Invalid LOAD_HELPERS_ONLY setting ($LOAD_HELPERS_ONLY)" >&2
exit 1
fi
;;
esac
}
#