Commit 70feeaf2 authored by Nathalie Furmento's avatar Nathalie Furmento

scripts/createWebServer.sh: add more redirect

parent fcbd6806
Pipeline #160525 passed with stages
in 1 minute and 29 seconds
......@@ -39,20 +39,25 @@ createRedirect()
done< $dir/redirect.txt
}
updateFileLink()
{
dst=$(echo "https://files.inria.fr/starpu$1" | sed 's:files/::')
echo "create redirect from $1 to $dst"
case "$1" in
*pdf) for f in $(grep -rsl $1 public) ; do sed -i 's;href="'$1'";href="'$dst'";g' $f ; done ;;
*gz) for f in $(grep -rsl $1 public) ; do sed -i 's;href="'$1'";href="'$dst'";g' $f ; done ;;
*/) for f in $(grep -rsl $1 public) ; do sed -i 's;href="'$1'";href="'$dst'";g' $f ; done
createRedirectDir $1 "$dst" ;;
*) for f in $(grep -rsl $1 public) ; do sed -i 's;href="'$1'";href="'$dst'";g' $f ; done
mkdir -p public/$(dirname $1) && createRedirectFile $1 "$dst" ;;
esac
}
updateFileLinks()
{
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
dst=$(echo "https://files.inria.fr/starpu$x" | sed 's:files/::')
echo "create redirect from $x to $dst"
case "$x" in
*pdf) for f in $(grep -rsl $x public) ; do sed -i 's;href="'$x'";href="'$dst'";g' $f ; done ;;
*gz) for f in $(grep -rsl $x public) ; do sed -i 's;href="'$x'";href="'$dst'";g' $f ; done ;;
*/) for f in $(grep -rsl $x public) ; do sed -i 's;href="'$x'";href="'$dst'";g' $f ; done
createRedirectDir $x "$dst" ;;
*) for f in $(grep -rsl $x public) ; do sed -i 's;href="'$x'";href="'$dst'";g' $f ; done
mkdir -p public/$(dirname $x) && createRedirectFile $x "$dst" ;;
esac
updateFileLink $x
done
# for f in $(grep -rsl 'href="/files' public)
......@@ -67,3 +72,5 @@ mkdir public
createRedirect
rsync -az --chmod=ug=rwX,o=rX --exclude .htaccess contents/ public
updateFileLinks
updateFileLink /files/testing/master/
updateFileLink /files/testing/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment