From: Frank Lichtenheld Date: Mon, 10 Dec 2007 18:37:46 +0000 (+0100) Subject: setup-site: Various improvements X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=23c6dbb18b991ee31b04a032c3168e13cfdefd19;p=deb%2Fpackages.git setup-site: Various improvements 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. --- diff --git a/bin/setup-site b/bin/setup-site index a0a7839..a3ceb98 100755 --- a/bin/setup-site +++ b/bin/setup-site @@ -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 " >&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] [ ]" >&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 index 0000000..edaf9b6 --- /dev/null +++ b/setup-site.conf @@ -0,0 +1,2 @@ +topdir=/srv/packages.debian.org +site=packages.debian.net