summaryrefslogtreecommitdiffstats
path: root/patches/httpd-2.0.64/0004-HACK-support-apxs-don-t-try-to-modify-the-config-fil.patch
blob: 9f9d1e695fe429fb979e77c0ee6dc0bd3d6356fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
From: Marc Kleine-Budde <mkl@pengutronix.de>
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 <mkl@pengutronix.de>
---
 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('', <FP>);
-        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 <containers>, so that the new LoadModule
-                # directive always appears *outside* of an <container>.
-
-                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*</.*$|mg);
-
-                if ($cntopen == $cntclose) {
-                    # fine. Last LoadModule is contextless.
-                    $content =~ s|^(.*\n#?\s*LoadModule\s+[^\n]+\n)|$1$c$lmd\n|s;
-                }
-                elsif ($cntopen < $cntclose) {
-                    error('Configuration file is not valid. There are sections'
-                          . ' closed before opened.');
-                    exit(1);
-                }
-                else {
-                    # put our cmd after the section containing the last
-                    # LoadModule.
-                    my $found =
-                    $content =~ s!\A (               # string and capture start
-                                  (?:(?:
-                                    ^\s*             # start of conf line with a
-                                    (?:[^<]|<[^/])   # directive which does not
-                                                     # start with '</'
-
-                                    .*(?:$)\n        # rest of the line.
-                                                     # the '$' is in parentheses
-                                                     # to avoid misinterpreting
-                                                     # the string "$\" as
-                                                     # perl variable.
-
-                                    )*               # catch as much as possible
-                                                     # of such lines. (including
-                                                     # zero)
-
-                                    ^\s*</.*(?:$)\n? # after the above, we
-                                                     # expect a config line with
-                                                     # a closing container (</)
-
-                                  ) {$cntopen}       # the whole pattern (bunch
-                                                     # of lines that end up with
-                                                     # a closing directive) must
-                                                     # be repeated $cntopen
-                                                     # times. That's it.
-                                                     # Simple, eh? ;-)
-
-                                  )                  # capture end
-                                 !$1$c$lmd\n!mx;
-
-                    unless ($found) {
-                        error('Configuration file is not valid. There are '
-                              . 'sections opened and not closed.');
-                        exit(1);
-                    }
-                }
-            } else {
-                # replace already existing LoadModule line
-                $content =~ s|^(.*\n)#?\s*$lmd_re[^\n]*\n|$1$c$lmd\n|s;
-            }
-            $lmd =~ m|LoadModule\s+(.+?)_module.*|;
-            notice("[$what module `$1' in $CFG_SYSCONFDIR/$CFG_TARGET.conf]");
-        }
-        my $amd;
-        foreach $amd (@amd) {
-            if ($content !~ m|\n#?\s*$amd|) {
-                 $content =~ s|^(.*\n#?\s*AddModule\s+[^\n]+\n)|$1$c$amd\n|sg;
-            } else {
-                 $content =~ s|^(.*\n)#?\s*$amd[^\n]*\n|$1$c$amd\n|sg;
-            }
-        }
-        if (@lmd or @amd) {
-            if (open(FP, ">$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('', <FP>);
+    #     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 <containers>, so that the new LoadModule
+    #             # directive always appears *outside* of an <container>.
+
+    #             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*</.*$|mg);
+
+    #             if ($cntopen == $cntclose) {
+    #                 # fine. Last LoadModule is contextless.
+    #                 $content =~ s|^(.*\n#?\s*LoadModule\s+[^\n]+\n)|$1$c$lmd\n|s;
+    #             }
+    #             elsif ($cntopen < $cntclose) {
+    #                 error('Configuration file is not valid. There are sections'
+    #                       . ' closed before opened.');
+    #                 exit(1);
+    #             }
+    #             else {
+    #                 # put our cmd after the section containing the last
+    #                 # LoadModule.
+    #                 my $found =
+    #                 $content =~ s!\A (               # string and capture start
+    #                               (?:(?:
+    #                                 ^\s*             # start of conf line with a
+    #                                 (?:[^<]|<[^/])   # directive which does not
+    #                                                  # start with '</'
+
+    #                                 .*(?:$)\n        # rest of the line.
+    #                                                  # the '$' is in parentheses
+    #                                                  # to avoid misinterpreting
+    #                                                  # the string "$\" as
+    #                                                  # perl variable.
+
+    #                                 )*               # catch as much as possible
+    #                                                  # of such lines. (including
+    #                                                  # zero)
+
+    #                                 ^\s*</.*(?:$)\n? # after the above, we
+    #                                                  # expect a config line with
+    #                                                  # a closing container (</)
+
+    #                               ) {$cntopen}       # the whole pattern (bunch
+    #                                                  # of lines that end up with
+    #                                                  # a closing directive) must
+    #                                                  # be repeated $cntopen
+    #                                                  # times. That's it.
+    #                                                  # Simple, eh? ;-)
+
+    #                               )                  # capture end
+    #                              !$1$c$lmd\n!mx;
+
+    #                 unless ($found) {
+    #                     error('Configuration file is not valid. There are '
+    #                           . 'sections opened and not closed.');
+    #                     exit(1);
+    #                 }
+    #             }
+    #         } else {
+    #             # replace already existing LoadModule line
+    #             $content =~ s|^(.*\n)#?\s*$lmd_re[^\n]*\n|$1$c$lmd\n|s;
+    #         }
+    #         $lmd =~ m|LoadModule\s+(.+?)_module.*|;
+    #         notice("[$what module `$1' in $CFG_SYSCONFDIR/$CFG_TARGET.conf]");
+    #     }
+    #     my $amd;
+    #     foreach $amd (@amd) {
+    #         if ($content !~ m|\n#?\s*$amd|) {
+    #              $content =~ s|^(.*\n#?\s*AddModule\s+[^\n]+\n)|$1$c$amd\n|sg;
+    #         } else {
+    #              $content =~ s|^(.*\n)#?\s*$amd[^\n]*\n|$1$c$amd\n|sg;
+    #         }
+    #     }
+    #     if (@lmd or @amd) {
+    #         if (open(FP, ">$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{