server/frontend/static/chbase.sh

24 lines
710 B
Bash

#!/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