]> git.deb.at Git - deb/packages.git/commitdiff
setup-site: Various improvements
authorFrank Lichtenheld <frank@lichtenheld.de>
Mon, 10 Dec 2007 18:37:46 +0000 (19:37 +0100)
committerFrank Lichtenheld <frank@lichtenheld.de>
Mon, 10 Dec 2007 20:28:40 +0000 (21:28 +0100)
Allow reading the variables from a config file
./setup-site.conf so that one doesn't have to
specify them each time.
Be less chatty per default but add -v option the
get the old behaviour.
Warn about too many arguments.

bin/setup-site
setup-site.conf [new file with mode: 0644]

index a0a7839460c2f14bbb7e029274c72730c00757b3..a3ceb98253c1c1132c2dd085bfccd85cea25fc66 100755 (executable)
@@ -1,22 +1,36 @@
 #!/bin/bash
 
-topdir=$1
-site=$2
+[ -f ./setup-site.conf ] && source ./setup-site.conf
 
-if [ -z "$topdir" -o -z "$site" ];
+if [ "$1" = "-v" ];
 then
-       echo "Usage: setup-site <topdir> <site>" >&2
+    verbose=1
+    shift
+fi
+
+if [ -n "$1" -a -n "$2" ];
+then
+    topdir=$1
+    site=$2
+    shift
+    shift
+fi
+
+if [ -z "$topdir" -o -z "$site" -o \( "$#" -gt 0 \) ];
+then
+       echo "Usage: setup-site [-v] [<topdir> <site>]" >&2
        exit 1
 fi
 
 echo -e "Using\n\ttopdir=$topdir\n\tsite=$site"
 
-find "$topdir" -maxdepth 2 -name '*.sed.in' | while read file;
+find "$topdir" -maxdepth 4 -name '*.sed.in' | while read file;
 do
        wdir=$(dirname "$file")
        newfile="$wdir/"$(basename "$file" .sed.in)
-       echo -e "processing\n\t$file\n->\t$newfile"
+       echo -e "processing\t$file"
+       [ -n "$verbose" ] && echo -e "->\t$newfile"
        cp -p "$file" "$newfile"
        sed -i -e "s#%SITE%#$site#g;s#%TOPDIR%#$topdir#g" "$newfile"
-       diff -u "$file" "$newfile"
+       [ -n "$verbose" ] && diff -u "$file" "$newfile"
 done
diff --git a/setup-site.conf b/setup-site.conf
new file mode 100644 (file)
index 0000000..edaf9b6
--- /dev/null
@@ -0,0 +1,2 @@
+topdir=/srv/packages.debian.org
+site=packages.debian.net