blob: 24b7f407ae947e18a836809f4affe24dd7d723c4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
#!/usr/local/bin/bash
export PATH=$PATH:/usr/local/bin
# Download a file, but only if it's available and not zero size
getfile() {
rm -f $2.new
curl -s -f -o $2.new $1
if [ -s $2.new ]; then
mv -f $2.new $2
fi
}
BASE=$1
if [ "$BASE" = "" ]; then
echo "Usage: $0 <Base Directory> [-nodocs] [-noftp]"
exit
fi
STATIC=${BASE}/../static
EXT=${BASE}/../ext
DL=${BASE}/../dl
# Parse other args
MIRRORPARAM=
FTP=1
while shift; do
case "$1" in
"-nodocs")
MIRRORPARAM="${MIRRORPARAM} -r docs/(\d.*|current)/"
;;
"-noftp")
MIRRORPARAM="${MIRRORPARAM} -r ftp/"
FTP=0
;;
"")
;;
*)
echo "Invalid parameter '$1'"
exit 1
esac
done
# Update everything. First do a revert, so any local changes get
# blown away, then update from repo.
cd ${BASE}
/usr/local/bin/svn revert -R .
/usr/local/bin/svn update --non-interactive
# Pull stuff we need with curl
cd ${DL}
getfile http://planet.postgresql.org/rss20.xml planetpostgresql.rss
cd ${BASE}
# If doing ftp update, rsync the ftp archive
if [ "$FTP" == "1" ]; then
/usr/local/bin/rsync -avz --delete --exclude "binary/OLD" svr1.postgresql.org::pgsql-ftp /usr/local/www/wwwmaster.postgresql.org/ftp
fi
# Copy in the static stuff
cp -Rp ${BASE}/files ${STATIC}/
cp -Rp ${BASE}/layout ${STATIC}/
# Build the static pages
rm -f /tmp/mirror.log
/usr/local/bin/php -q ${BASE}/tools/mirror.php -v -l /tmp/mirror.log -o ${STATIC} ${MIRRORPARAM}
# Rewrite the mirror list
/usr/local/bin/php ${BASE}/tools/mirrorlist.php ${STATIC}/mirrors.xml
# Rewrite the application list
/usr/local/bin/php ${BASE}/tools/applicationlist.php ${STATIC}/applications-v2.xml
# Rewrite the version list
cd ${BASE}/tools
/usr/local/bin/php ${BASE}/tools/versionlist.php ${STATIC}/versions.xml
cd ${BASE}
# Copy static htaccess files
cp -Rp ${BASE}/tools/htaccess/root ${STATIC}/.htaccess
cp -Rp ${BASE}/tools/htaccess/files_documentation ${STATIC}/files/documentation/.htaccess
cp -Rp ${BASE}/tools/htaccess/docs ${STATIC}/docs/.htaccess
# Copy robots and sitemap files
cp -Rp ${BASE}/tools/htaccess/robots.txt ${STATIC}/robots.txt
cp -Rp ${BASE}/tools/htaccess/sitemap.xml ${STATIC}/sitemap.xml
# Create google account file for webmaster@postgresql.org
test -f ${STATIC}/googlece5fa9d11e0cd8c5.html || touch ${STATIC}//googlece5fa9d11e0cd8c5.html
# Build htaccess file for ftp tree
/usr/local/bin/php ${BASE}/tools/ftplinks.php ${DL}/ftp.htaccess
cmp ${DL}/ftp.htaccess ${STATIC}/ftp/.htaccess || cp -Rp ${DL}/ftp.htaccess ${STATIC}/ftp/.htaccess
rm -f ${DL}/ftp.htaccess
# Touch the timestamp file
/bin/date -u "+%Y-%m-%d %H:%M:%S UTC" > ${STATIC}/web_sync_timestamp
cp ${STATIC}/web_sync_timestamp ${BASE}/web_sync_timestamp
|