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

Add config generator scripts

parent fc6ad3d6
No related branches found
No related tags found
No related merge requests found
...@@ -115,6 +115,10 @@ src-link luci ../../packages_luci ...@@ -115,6 +115,10 @@ src-link luci ../../packages_luci
endef endef
export FEEDS export FEEDS
export GLUON_GENERATE := $(GLUONDIR)/scripts/generate.sh
feeds: FORCE feeds: FORCE
rm -f feeds.conf rm -f feeds.conf
echo "$$FEEDS" > feeds.conf echo "$$FEEDS" > feeds.conf
......
#!/usr/bin/perl
use warnings;
use strict;
my %config;
sub add_config {
my ($prefix, $c) = @_;
foreach my $key (keys $c) {
my $val = $c->{$key};
if (ref($val)) {
add_config($key . '.', $val);
}
else {
$config{'@' . $prefix . $key . '@'} = $val;
}
}
}
sub read_config {
my $input = shift;
my $CONFIG = do $input;
add_config('', $CONFIG);
}
read_config 'site/site.pl';
my $regex = join '|', map {quotemeta} keys %config;
for (<>) {
s/($regex)/${config{$1}}/g;
print;
}
#!/usr/bin/env bash
declare -a IN
GLUONDIR="$(dirname "$0")/.."
for ((i = 1; i < $#; i++)); do
IN[$i]="${!i}"
done
OUT="$(readlink -f "${!#}")"
for S in "${IN[@]}"; do (
cd "$(dirname "$S")"
NAME="$(basename "$S")"
IFS='
'
for FILE in $(find "$NAME" -type f); do
D="$(dirname "$FILE")"
mkdir -p "$OUT/$D"
(cd "$GLUONDIR"; scripts/configure.pl) < "$FILE" > "$OUT/$FILE"
chmod --reference="$FILE" "$OUT/$FILE"
done
); done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment