Script to simplify root base change

This commit is contained in:
nemunaire 2016-10-13 20:13:29 +02:00
parent 5805bf0e19
commit cd49355b7f
1 changed files with 23 additions and 0 deletions

23
frontend/static/chbase.sh Normal file
View File

@ -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