From 9eb53c9d4f615e0af9f605281f07da3c99266d65 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Tue, 21 Nov 2006 21:52:29 +0000 Subject: [PATCH] Do some often needed adjustments when setting up a site with a central script --- bin/mod_perl-startup | 5 ----- bin/mod_perl-startup.sed.in | 5 +++++ bin/setup-site | 21 ++++++++++++++++++++ conf/{apache.conf => apache.conf.sed.in} | 20 ++++++++----------- config.sh => config.sh.sed.in | 19 ++++-------------- static/{packages.css => packages.css.sed.in} | 6 +++--- 6 files changed, 41 insertions(+), 35 deletions(-) delete mode 100644 bin/mod_perl-startup create mode 100644 bin/mod_perl-startup.sed.in create mode 100755 bin/setup-site rename conf/{apache.conf => apache.conf.sed.in} (85%) rename config.sh => config.sh.sed.in (72%) rename static/{packages.css => packages.css.sed.in} (92%) diff --git a/bin/mod_perl-startup b/bin/mod_perl-startup deleted file mode 100644 index 47d4b5d..0000000 --- a/bin/mod_perl-startup +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/perl - -use lib "/org/packages.debian.org/lib"; - -1; diff --git a/bin/mod_perl-startup.sed.in b/bin/mod_perl-startup.sed.in new file mode 100644 index 0000000..85d169d --- /dev/null +++ b/bin/mod_perl-startup.sed.in @@ -0,0 +1,5 @@ +#!/usr/bin/perl + +use lib "%TOPDIR%/lib"; + +1; diff --git a/bin/setup-site b/bin/setup-site new file mode 100755 index 0000000..8e720df --- /dev/null +++ b/bin/setup-site @@ -0,0 +1,21 @@ +#!/bin/bash + +topdir=$1 +site=$2 + +if [ -z "$topdir" -o -z "$site" ]; +then + echo "Usage: setup-site " >&2 + exit 1 +fi + +echo -e "Using\n\ttopdir=$topdir\n\tsite=$site" + +find "$topdir" -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" + sed -e "s#%SITE%#$site#g;s#%TOPDIR%#$topdir#g" "$file" > "$newfile" + diff -u "$file" "$newfile" +done diff --git a/conf/apache.conf b/conf/apache.conf.sed.in similarity index 85% rename from conf/apache.conf rename to conf/apache.conf.sed.in index f551e49..5f5dea4 100644 --- a/conf/apache.conf +++ b/conf/apache.conf.sed.in @@ -1,5 +1,5 @@ # Need to turn on negotiation_module - + Options +MultiViews +FollowSymLinks +Indexes AddHandler type-map var # Make sure that the srm.conf directive is commented out. @@ -78,20 +78,18 @@ ServerAdmin webmaster@debian.org - DocumentRoot /org/packages.debian.org/www/ - ServerName packages.debian.net - ErrorLog /var/log/apache/packages.debian.org-error.log - CustomLog /var/log/apache/packages.debian.org-access.log combined + DocumentRoot %TOPDIR%/www/ + ServerName %SITE% + ErrorLog /var/log/apache2/%SITE%-error.log + CustomLog /var/log/apache2/%SITE%-access.log combined -# ScriptAlias /cgi-bin /org/packages.debian.org/cgi-bin/ - - Alias /cgi-bin/ /org/packages.debian.org/cgi-bin/ + Alias /cgi-bin/ %TOPDIR%/cgi-bin/ PerlModule Apache::Registry PerlTaintCheck On SetHandler perl-script - PerlRequire /org/packages.debian.org/bin/mod_perl-startup + PerlRequire %TOPDIR%/bin/mod_perl-startup PerlInitHandler Apache::Reload PerlHandler Apache::Registry Options +ExecCGI @@ -99,10 +97,8 @@ allow from all - ScriptAlias /cgi-old /org/packages.debian.net/cgi-bin/ - RewriteEngine on - RewriteLog /var/log/apache/rewrite.log + RewriteLog /var/log/apache2/rewrite.log RewriteLogLevel 0 # we never want to rewrite those URLs diff --git a/config.sh b/config.sh.sed.in similarity index 72% rename from config.sh rename to config.sh.sed.in index eab1b2b..ea6703a 100644 --- a/config.sh +++ b/config.sh.sed.in @@ -1,7 +1,7 @@ -# Configuration for packages.debian.org +# Configuration for %SITE% # -topdir=/org/packages.debian.org +topdir=%TOPDIR% tmpdir=${topdir}/tmp bindir=${topdir}/bin @@ -11,11 +11,11 @@ filesdir=${topdir}/files htmldir=${topdir}/www archivedir=${topdir}/archive podir=${topdir}/po -localedir=/org/packages.debian.org/locale +localedir=%TOPDIR%/locale staticdir=${topdir}/static configdir=${topdir}/conf -# unset this if packages.debian.org moves somewhere where the packages files +# unset this if %SITE% moves somewhere where the packages files # cannot be obtained locally # localdir=/org/ftp.debian.org/ftp @@ -32,17 +32,6 @@ amd64_ftpsite=http://amd64.debian.net/debian kfreebsd_ftpsite=http://kfreebsd-gnu.debian.net/debian root="" -hostname="http://packages.debian.net" -search_page="http://packages.debian.net/" -search_url="/search" -webmaster=webmaster@debian.org -contact=debian-www@lists.debian.org -home="http://www.debian.org" -bug_url="http://bugs.debian.org/" -src_bug_url="http://bugs.debian.org/src:" -qa_url="http://packages.qa.debian.org/" -ddpo_url="http://qa.debian.org/developer.php?email=" -cn_help_url="http://www.debian.org/intro/cn" # Architectures # diff --git a/static/packages.css b/static/packages.css.sed.in similarity index 92% rename from static/packages.css rename to static/packages.css.sed.in index 64bdd10..00ab1b5 100644 --- a/static/packages.css +++ b/static/packages.css.sed.in @@ -56,17 +56,17 @@ #pdeps ul.uldep, #pdeps ul.uladep { list-style-type: disc; - list-style-image: url(http://packages.debian.org/Pics/dep.gif); + list-style-image: url(http://%SITE%/Pics/dep.gif); } #pdeps ul.ulrec, #pdeps ul.ulidep { list-style-type: disc; - list-style-image: url(http://packages.debian.org/Pics/rec.gif); + list-style-image: url(http://%SITE%/Pics/rec.gif); } #pdeps ul.ulsug { list-style-type: disc; - list-style-image: url(http://packages.debian.org/Pics/sug.gif); + list-style-image: url(http://%SITE%/Pics/sug.gif); } #pdeps ul.uldep li, #pdeps ul.ulrec li, #pdeps ul.ulsug li, #pdeps ul.uladep li, #pdeps ul.ulidep li { -- 2.39.2