From: Marc Kleine-Budde Date: Fri, 27 Apr 2012 16:28:45 +0200 Subject: [PATCH] HACK: support/apxs: don't try to modify the config file Signed-off-by: Marc Kleine-Budde --- support/apxs.in | 224 +++++++++++++++++++++++++++--------------------------- 1 files changed, 112 insertions(+), 112 deletions(-) diff --git a/support/apxs.in b/support/apxs.in index cbefb3a..2bde471 100644 --- a/support/apxs.in +++ b/support/apxs.in @@ -527,118 +527,118 @@ if ($opt_i or $opt_e) { &execute_cmds(@cmds); # activate module via LoadModule/AddModule directive - if ($opt_a or $opt_A) { - if (not -f "$CFG_SYSCONFDIR/$CFG_TARGET.conf") { - error("Config file $CFG_SYSCONFDIR/$CFG_TARGET.conf not found"); - exit(1); - } - - open(FP, "<$CFG_SYSCONFDIR/$CFG_TARGET.conf") || die; - my $content = join('', ); - close(FP); - - if ($content !~ m|\n#?\s*LoadModule\s+|) { - error("Activation failed for custom $CFG_SYSCONFDIR/$CFG_TARGET.conf file."); - error("At least one `LoadModule' directive already has to exist."); - exit(1); - } - - my $lmd; - my $c = ''; - $c = '#' if ($opt_A); - foreach $lmd (@lmd) { - my $what = $opt_A ? "preparing" : "activating"; - my $lmd_re = $lmd; - $lmd_re =~ s/\s+/\\s+/g; - - if ($content !~ m|\n#?\s*$lmd_re|) { - # check for open , so that the new LoadModule - # directive always appears *outside* of an . - - my $before = ($content =~ m|^(.*\n)#?\s*LoadModule\s+[^\n]+\n|s)[0]; - - # the '()=' trick forces list context and the scalar - # assignment counts the number of list members (aka number - # of matches) then - my $cntopen = () = ($before =~ m|^\s*<[^/].*$|mg); - my $cntclose = () = ($before =~ m|^\s*$CFG_SYSCONFDIR/$CFG_TARGET.conf.new")) { - print FP $content; - close(FP); - system("cp $CFG_SYSCONFDIR/$CFG_TARGET.conf $CFG_SYSCONFDIR/$CFG_TARGET.conf.bak && " . - "cp $CFG_SYSCONFDIR/$CFG_TARGET.conf.new $CFG_SYSCONFDIR/$CFG_TARGET.conf && " . - "rm $CFG_SYSCONFDIR/$CFG_TARGET.conf.new"); - } else { - notice("unable to open configuration file"); - } - } - } + # if ($opt_a or $opt_A) { + # if (not -f "$CFG_SYSCONFDIR/$CFG_TARGET.conf") { + # error("Config file $CFG_SYSCONFDIR/$CFG_TARGET.conf not found"); + # exit(1); + # } + + # open(FP, "<$CFG_SYSCONFDIR/$CFG_TARGET.conf") || die; + # my $content = join('', ); + # close(FP); + + # if ($content !~ m|\n#?\s*LoadModule\s+|) { + # error("Activation failed for custom $CFG_SYSCONFDIR/$CFG_TARGET.conf file."); + # error("At least one `LoadModule' directive already has to exist."); + # exit(1); + # } + + # my $lmd; + # my $c = ''; + # $c = '#' if ($opt_A); + # foreach $lmd (@lmd) { + # my $what = $opt_A ? "preparing" : "activating"; + # my $lmd_re = $lmd; + # $lmd_re =~ s/\s+/\\s+/g; + + # if ($content !~ m|\n#?\s*$lmd_re|) { + # # check for open , so that the new LoadModule + # # directive always appears *outside* of an . + + # my $before = ($content =~ m|^(.*\n)#?\s*LoadModule\s+[^\n]+\n|s)[0]; + + # # the '()=' trick forces list context and the scalar + # # assignment counts the number of list members (aka number + # # of matches) then + # my $cntopen = () = ($before =~ m|^\s*<[^/].*$|mg); + # my $cntclose = () = ($before =~ m|^\s*$CFG_SYSCONFDIR/$CFG_TARGET.conf.new")) { + # print FP $content; + # close(FP); + # system("cp $CFG_SYSCONFDIR/$CFG_TARGET.conf $CFG_SYSCONFDIR/$CFG_TARGET.conf.bak && " . + # "cp $CFG_SYSCONFDIR/$CFG_TARGET.conf.new $CFG_SYSCONFDIR/$CFG_TARGET.conf && " . + # "rm $CFG_SYSCONFDIR/$CFG_TARGET.conf.new"); + # } else { + # notice("unable to open configuration file"); + # } + # } + # } } sub error{