]> git.deb.at Git - deb/packages.git/blob - bin/setup-site
[ARCHIVE] Use woody as default distro for Contents search
[deb/packages.git] / bin / setup-site
1 #!/bin/bash
2
3 [ -f ./setup-site.conf ] && source ./setup-site.conf
4
5 if [ "$1" = "-v" ];
6 then
7     verbose=1
8     shift
9 fi
10
11 if [ -n "$1" -a -n "$2" ];
12 then
13     topdir=$1
14     site=$2
15     shift
16     shift
17 fi
18
19 if [ -z "$topdir" -o -z "$site" -o \( "$#" -gt 0 \) ];
20 then
21         echo "Usage: setup-site [-v] [<topdir> <site>]" >&2
22         exit 1
23 fi
24
25 echo -e "Using\n\ttopdir=$topdir\n\tsite=$site"
26
27 find "$topdir" -maxdepth 4 -name '*.sed.in' | while read file;
28 do
29         wdir=$(dirname "$file")
30         newfile="$wdir/"$(basename "$file" .sed.in)
31         echo -e "processing\t$file"
32         [ -n "$verbose" ] && echo -e "->\t$newfile"
33         cp -p "$file" "$newfile"
34         sed -i -e "s#%SITE%#$site#g;s#%TOPDIR%#$topdir#g" "$newfile"
35         [ -n "$verbose" ] && diff -u "$file" "$newfile"
36 done