~kirkland/ubuntu-manpage-repository/python

« back to all changes in this revision

Viewing changes to bin/make-sitemaps.sh

  • Committer: Dustin Kirkland
  • Date: 2013-02-16 19:15:55 UTC
  • Revision ID: dustin.kirkland@gmail.com-20130216191555-1b5ofus9jdgecyfr
deprecate shell sitemap maker

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh -e
2
 
 
3
 
###############################################################################
4
 
# This is the Ubuntu manpage repository generator and interface.
5
 
6
 
# Copyright (C) 2008 Canonical Ltd.
7
 
8
 
# This code was originally written by Dustin Kirkland <kirkland@ubuntu.com>,
9
 
# based on a framework by Kees Cook <kees@ubuntu.com>.
10
 
11
 
# This program is free software: you can redistribute it and/or modify
12
 
# it under the terms of the GNU General Public License as published by
13
 
# the Free Software Foundation, either version 3 of the License, or
14
 
# (at your option) any later version.
15
 
16
 
# This program is distributed in the hope that it will be useful,
17
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 
# GNU General Public License for more details.
20
 
21
 
# You should have received a copy of the GNU General Public License
22
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
 
24
 
# On Debian-based systems, the complete text of the GNU General Public
25
 
# License can be found in /usr/share/common-licenses/GPL-3
26
 
###############################################################################
27
 
 
28
 
 
29
 
# Generate sitemaps per sitemaps.org for google.com
30
 
 
31
 
. ./config 
32
 
 
33
 
printf "%s\n" "INFO: Making sitemaps"
34
 
 
35
 
cd "$PUBLIC_HTML_DIR"
36
 
find manpages/ -type f -name "*.html" | xargs -i printf "%s\n" "<url><loc>$SITE/{}</loc></url>" | split -l 50000 - manpages/sitemap_
37
 
 
38
 
sitemaps=`ls manpages/sitemap_??`
39
 
for i in $sitemaps; do
40
 
        printf "%s\n" "<?xml version='1.0' encoding='UTF-8'?>" > $i.xml
41
 
        printf "%s\n" "<urlset xmlns='http://www.sitemaps.org/schemas/sitemap/0.9'>" >> $i.xml
42
 
        cat "$i" >> $i.xml
43
 
        printf "%s\n" "</urlset>" >> "$i.xml"
44
 
        rm -f "$i"
45
 
done
46
 
cd -