From 7ec2b22d2a56a2eeb4e8fbc45c20ca5bd0123d25 Mon Sep 17 00:00:00 2001 From: Nathalie Furmento <nathalie.furmento@labri.fr> Date: Mon, 27 Jul 2020 13:14:47 +0200 Subject: [PATCH] create redirect instead of modifying source files --- contents/help/index.html | 2 +- contents/index.html | 2 +- scripts/createWebServer.sh | 47 ++++++++++++++++++++++++++++---------- 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/contents/help/index.html b/contents/help/index.html index 57927c34..55d0ff98 100644 --- a/contents/help/index.html +++ b/contents/help/index.html @@ -21,7 +21,7 @@ <h3>Need any help?</h3> <p>For any questions regarding StarPU, you can <ul> - <li>Read the latest <a href="/files/testing/master/doc/html">documentation</a>, + <li>Read the latest <a href="/files/testing/master/doc/html/">documentation</a>, and more specifically the <a href="/files/testing/master/doc/html/FrequentlyAskedQuestions.html">FAQ</a>,</li> <li>Read the <a href="/tutorials/">tutorials</a>,</li> <li>Browse diff --git a/contents/index.html b/contents/index.html index e0547de0..451fc667 100644 --- a/contents/index.html +++ b/contents/index.html @@ -68,7 +68,7 @@ StarPU. </p> <p> The latest documentation in <a href="/files/testing/master/doc/starpu.pdf">PDF</a> -and <a href="/files/testing/master/doc/html">HTML</a> is updated everyday, but covers +and <a href="/files/testing/master/doc/html/">HTML</a> is updated everyday, but covers the latest developments which may not be available in the latest release. </p> </div> diff --git a/scripts/createWebServer.sh b/scripts/createWebServer.sh index 613bebf2..d5f836ff 100755 --- a/scripts/createWebServer.sh +++ b/scripts/createWebServer.sh @@ -2,32 +2,55 @@ dir=$(dirname $0) -createRedirect() +createRedirectFile() { - while read line - do - src=$(echo $line | awk '{print $1}') - dst=$(echo $line | awk '{print $2}') - echo create redirect from $src to $dst - mkdir -p public/$src - (cat <<EOF + src=$1 + dst=$2 + (cat <<EOF <head> <title>Page has moved!</title> <meta http-equiv="Refresh" content="0; URL=$dst" /> </head> EOF - ) > public/$src/index.html + ) > public/$src +} + +createRedirectDir() +{ + src=$1 + dst=$2 + mkdir -p public/$src + createRedirectFile $src/index.html $dst +} + +createRedirect() +{ + while read line + do + src=$(echo $line | awk '{print $1}') + dst=$(echo $line | awk '{print $2}') + echo create redirect from $src to $dst + createRedirectDir $src $dst done< $dir/redirect.txt } updateFileLinks() { - for f in $(grep -rsl 'href="/files' public) + for x in $(grep -rs 'href="\/files/' public | tr ' ' '\012' | tr '\t' '\012' | grep href | sed -e 's/href="//' -e 's/".*//' -e 's/#.*//' | sort | uniq) do - echo update file links in $f - sed -i 's/href="\/files/href="http:\/\/starpu.gforge.inria.fr\/files/g' $f + echo "create redirect for $x" + case "$x" in + */) createRedirectDir $x "http://starpu.gforge.inria.fr$x" ;; + *) mkdir -p public/$(dirname $x) && createRedirectFile $x "http://starpu.gforge.inria.fr$x" ;; + esac done + + # for f in $(grep -rsl 'href="/files' public) + # do + # echo update file links in $f + # sed -i 's/href="\/files/href="http:\/\/starpu.gforge.inria.fr\/files/g' $f + # done } rm -rf public -- GitLab