summaryrefslogtreecommitdiff
path: root/docs/builder/rtems-docs-download
diff options
context:
space:
mode:
Diffstat (limited to 'docs/builder/rtems-docs-download')
-rwxr-xr-xdocs/builder/rtems-docs-download92
1 files changed, 92 insertions, 0 deletions
diff --git a/docs/builder/rtems-docs-download b/docs/builder/rtems-docs-download
new file mode 100755
index 0000000..e2b78a2
--- /dev/null
+++ b/docs/builder/rtems-docs-download
@@ -0,0 +1,92 @@
+#! /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/branches
+
+#
+# Upload URL.
+#
+docsurl=/data/ftp/pub/rtems/people/chrisj/docs.rtems.org/latest
+
+#
+# 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.
+ #
+ ${cp} ${docsurl}/rtems-docs-latest-tags rtems-docs-latest-tags
+ if [ -f ${current_tags} ]; then
+ exec 3<& 0
+ exec 0< rtems-docs-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 /data/www/docs.rtems.org/branches current
+ ${cp} ${docsurl}/rtems-docs-latest.tar.xz rtems-docs-latest.tar.xz
+ set +e
+ ../rtems-docs-unpack-branches
+ set -e
+ fi
+ ${rm} -f rtems-docs-latest-tags
+ cd ..
+
+exit 0