Skip to content
Snippets Groups Projects
Commit 2f919846 authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

Split up configure script

parent b72ffb1b
No related branches found
No related tags found
No related merge requests found
...@@ -117,6 +117,7 @@ export FEEDS ...@@ -117,6 +117,7 @@ export FEEDS
export GLUON_GENERATE := $(GLUONDIR)/scripts/generate.sh export GLUON_GENERATE := $(GLUONDIR)/scripts/generate.sh
export GLUON_CONFIGURE := $(GLUONDIR)/scripts/configure.pl
feeds: FORCE feeds: FORCE
......
Subproject commit c57f81b7c4a498828e54e8026a9178dbc639d87b Subproject commit 65769f82507c9771de137451aaa2a45c57708dc3
...@@ -4,37 +4,7 @@ use warnings; ...@@ -4,37 +4,7 @@ use warnings;
use strict; use strict;
my %config; our $CONFIG = do $ENV{GLUONDIR} . '/site/site.conf';
sub add_config { my $script = shift @ARGV;
my ($prefix, $c) = @_; do $script;
foreach my $key (keys $c) {
my $val = $c->{$key};
if (ref($val) eq 'HASH') {
add_config($key . '.', $val);
}
unless (ref($val)) {
$config{'@' . $prefix . $key . '@'} = $val;
}
}
}
sub read_config {
my $input = shift;
my $CONFIG = do $input;
add_config('', $CONFIG);
}
read_config 'site/site.conf';
my $regex = join '|', map {quotemeta} keys %config;
for (<>) {
s/($regex)/${config{$1}}/g;
print;
}
use warnings;
my %config;
sub add_config {
my ($prefix, $c) = @_;
foreach my $key (keys $c) {
my $val = $c->{$key};
if (ref($val) eq 'HASH') {
add_config($key . '.', $val);
}
unless (ref($val)) {
$config{'@' . $prefix . $key . '@'} = $val;
}
}
}
add_config('', $CONFIG);
my $regex = join '|', map {quotemeta} keys %config;
for (<>) {
s/($regex)/${config{$1}}/g;
print;
}
...@@ -4,8 +4,6 @@ set -e ...@@ -4,8 +4,6 @@ set -e
declare -a IN declare -a IN
GLUONDIR="$(dirname "$0")/.."
for ((i = 1; i < $#; i++)); do for ((i = 1; i < $#; i++)); do
IN[$i]="${!i}" IN[$i]="${!i}"
...@@ -23,7 +21,7 @@ for S in "${IN[@]}"; do ( ...@@ -23,7 +21,7 @@ for S in "${IN[@]}"; do (
D="$(dirname "$FILE")" D="$(dirname "$FILE")"
mkdir -p "$OUT/$D" mkdir -p "$OUT/$D"
(cd "$GLUONDIR"; scripts/configure.pl) < "$FILE" > "$OUT/$FILE" (cd "$GLUONDIR"; scripts/configure.pl scripts/generate.pl) < "$FILE" > "$OUT/$FILE"
chmod --reference="$FILE" "$OUT/$FILE" chmod --reference="$FILE" "$OUT/$FILE"
done done
); done ); done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment