summaryrefslogtreecommitdiff
path: root/doxygen/builder/rtems-doxygen-download
blob: f72e2e12eba3bcb727a23aab5397b5a46d09ff8b (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
99
100
#! /bin/sh
#
# RTEMS Documentation Project
#
# Copyright 2017 Chris Johns <chrisj@rtems.org>
# All rights reserved
#
# Public domain
#

#
# Exit on error.
#
set -e

#
# Executables
#
cp=/bin/cp
diff=/usr/bin/diff
grep=/usr/bin/grep
mkdir=/bin/mkdir
rm=/bin/rm
sed=/usr/bin/sed

#
# We run where the script is located.
#
cd $(dirname $0)

#
# Top directory
#
top=$PWD

#
# The current directory.
#
wwwdocs=/data/www/docs.rtems.org/doxygen/branches

#
# Handover path.
#
handover=/data/ftp/pub/rtems/people/chrisj/docs.rtems.org/doxygen

#
# Latest files.
#
latest_tags=rtems-doxygen-latest-tags
latest_doxygen=rtems-doxygen-latest.tar.gz

#
# Current tags.
#
current_tags=${wwwdocs}/.tags

#
# If no update directory create it.
#
if [ ! -d latest ]; then
 ${rm} -rf latest
 ${mkdir} latest
fi

cd latest
 update=no
 #
 # Download the latest tags and compare the branches in the package with the
 # current tags.
 #
 if [ -f ${handover}/${latest_tags} ] && [ -f ${handover}/${latest_doxygen} ]; then
  ${cp} ${handover}/${latest_tags} ${latest_tags}
  if [ -f ${current_tags} ]; then
   exec 3<& 0
   exec 0< ${latest_tags}
   while read line
   do
    branch=$(echo ${line} | ${sed} -e 's/[[:space:]].*//g')
    latest_hash=$(echo ${line} | ${sed} -e 's/.*[[:space:]]//g')
    current_hash=$(cat ${current_tags} | ${grep} ${branch} | ${sed} -e 's/.*[[:space:]]//g')
    if [ "${latest_hash}" != "${current_hash}" ]; then
     update=yes
    fi
   done
  else
   update=yes
  fi
  if [ ${update} = yes ]; then
   ${rm} -rf current
   ${cp} -r ${wwwdocs} current
   ${cp} ${handover}/${latest_doxygen} ${latest_doxygen}
   set +e
    ../rtems-doxygen-unpack-branches
   set -e
  fi
  ${rm} -f ${latest_tags}
 fi
 cd ..

exit 0