From 174f75eac881f7157ea8791d36491e5d5ba71225 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Fri, 28 Nov 2008 10:34:05 +0000 Subject: [PATCH] Create a directory suitable for mirroring the site This only includes all the data and code needed to run the site, not to update it. --- .gitignore | 1 + README.Mirror | 29 +++++++++++++++++++++ bin/create_mirror | 58 +++++++++++++++++++++++++++++++++++++++++ bin/daily.sed.in | 3 +++ conf/apache.conf.sed.in | 2 +- 5 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 README.Mirror create mode 100755 bin/create_mirror diff --git a/.gitignore b/.gitignore index 87f52c2..ec46515 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,6 @@ archive config.sh cache tmp +mirror *~ *.ttc diff --git a/README.Mirror b/README.Mirror new file mode 100644 index 0000000..479f459 --- /dev/null +++ b/README.Mirror @@ -0,0 +1,29 @@ + +To only operate a mirror of packages.d.o, the following packages +need to be installed: + + liblocale-maketext-lexicon-perl + libi18n-acceptlanguage-perl + libnumber-format-perl + libcompress-zlib-perl + libhtml-parser-perl + libmldbm-perl + libtext-iconv-perl + libclass-accessor-perl + liburi-perl + libtemplate-perl + liblingua-stem-perl + libsearch-xapian-perl (bpo) + + apache2-mpm-worker + libapache2-mod-perl2 + +The following apache modules need to be active + + rewrite + expires + perl + setenvif + alias + negotiation + diff --git a/bin/create_mirror b/bin/create_mirror new file mode 100755 index 0000000..da17e90 --- /dev/null +++ b/bin/create_mirror @@ -0,0 +1,58 @@ +#!/bin/bash + +set -e + +topdir="$1" +[ -n "$topdir" -a -d "$topdir" ] || exit 1 +mirror="$topdir/mirror" + +mkdir -p "$mirror" + +STAMP=$(date "+%Y%m%d%H%M") +new="$mirror/$STAMP" +mkdir $new + +if lockfile -! -r2 -300 "$mirror/mirror.lock" +then + echo "couldn't aquire mirror.lock in due time" + exit 1; +fi + +mkdir -p "$new/cache" +chmod 777 "$new/cache" + +cd "$new" +ln -f "$topdir/config.sh" +ln -f "$topdir/README.Mirror" + +mkdir -p "$new/bin" +cd "$new/bin" +ln -f "$topdir/bin/mod_perl-startup" + +mkdir -p "$new/conf" +cd "$new/conf" +ln -f "$topdir/conf/apache.conf" + +mkdir -p "$new/cgi-bin" +cd "$new/cgi-bin" +ln -f "$topdir/cgi-bin/dispatcher.pl" + +for d in lib files templates po www +do + mkdir -p "$new/$d" + rsync -avH --link-dest "$topdir/$d" \ + --exclude '*.new' --exclude '*.sed.in' \ + --exclude '*.slices' --exclude '*~' \ + --exclude '*.lock' --exclude '*.ttc' --exclude 'logs/' \ + --exclude 'packages/*/' --exclude 'changelogs.*' \ + --exclude 'changelogs/**/log' \ + --exclude "/auto" --exclude "/Search" --exclude "/perl" \ + --delete-excluded --delete-after \ + "$topdir/$d/" "$new/$d/" +done + +ln -sfT $new $mirror/current +find $mirror -mindepth 1 -maxdepth 1 -not -name "${STAMP}" -type d -print0 \ + | xargs --no-run-if-empty -0 rm -rf + +rm -f "$mirror/mirror.lock" diff --git a/bin/daily.sed.in b/bin/daily.sed.in index 28c8333..7207bfb 100755 --- a/bin/daily.sed.in +++ b/bin/daily.sed.in @@ -53,3 +53,6 @@ else echo "couldn't aquire changelogs lock file in due time" fi date + +$topdir/bin/create_mirror $topdir +date diff --git a/conf/apache.conf.sed.in b/conf/apache.conf.sed.in index bb6c21f..a40858b 100644 --- a/conf/apache.conf.sed.in +++ b/conf/apache.conf.sed.in @@ -69,7 +69,7 @@ ServerAdmin webmaster@debian.org DocumentRoot %TOPDIR%/www/ ServerName %SITE% - ServerAlias newpackages.debian.org + ServerAlias packages-piatti.debian.org packages-powell.debian.org ErrorLog /var/log/apache2/%SITE%-error.log CustomLog /var/log/apache2/%SITE%-access.log combined -- 2.39.2