From cd49355b7f5d4d1eea105ef29c013eb0dbd1a148 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Thu, 13 Oct 2016 20:13:29 +0200 Subject: [PATCH] Script to simplify root base change --- frontend/static/chbase.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 frontend/static/chbase.sh diff --git a/frontend/static/chbase.sh b/frontend/static/chbase.sh new file mode 100644 index 00000000..160641e5 --- /dev/null +++ b/frontend/static/chbase.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +if [ $# -lt 1 ] +then + echo "Indicate as first parameter the new base. Eg.: $0 /fic/2042" + echo "The path cannot be relative" + echo "If this is not the first time you execute this script, a second argument with the previous base can be given." + exit 1 +fi + +NEW=${1%/} +if [ $# -gt 1 ] +then + OLD=$2 +else + OLD="/" +fi + +sed -i -E "s@(src|href)=\"$OLD@\1=\"$NEW/@" e404.html e413.html e500.html index.html public.html welcome.html views/theme.html +sed -i -E "s@path\":\"$OLD@path\":\"$NEW/@g" my.json +sed -i -E "s@.(get)\(\"$OLD@.\1(\"$NEW/@" js/app.js js/public.js +sed -i -E "s@url: *\"$OLD@url: \"$NEW/@" js/app.js js/public.js +sed -i -E "s@^RewriteBase.*\$@RewriteBase $NEW@" .htaccess