1
0
mirror of https://github.com/gilbN/theme.park.git synced 2024-10-03 22:17:08 +02:00

Qbittorrent: Add perl and remove translation text

from html and js files
This commit is contained in:
GilbN 2022-12-20 17:46:11 +01:00
parent f122c8c535
commit 6c07a6fdb3
3 changed files with 31 additions and 2 deletions

View File

@ -30,9 +30,11 @@ echo '--------------------------'
if [ -x "$(command -v apk)" ]; then
apk update && \
apk add --no-cache subversion
apk add --no-cache perl
elif [ -x "$(command -v apt-get)" ]; then
apt-get update && \
apt-get install -y subversion
apt-get install -y perl
fi
fi
@ -95,18 +97,31 @@ sed_file(){
printf 'Stylesheet set to %s on %s\n\n' "${TP_THEME}" "$1"
}
clean_html() {
perl -i -pe 's/QBT_TR?\(//' "$1"
perl -i -pe 's/\)QBT_TR\[CONTEXT=.*?\]//' "$1"
}
# Adding stylesheets
echo '---------------------------------------'
echo '| Adding the stylesheet to html files |'
echo '---------------------------------------'
if ! grep -q "${TP_DOMAIN}/css/base" /themepark/public/index.html; then
sed_file /themepark/public/index.html
clean_html /themepark/public/index.html
# Clean JS files
find /themepark -type f -iname "*.js" | while read fname
do
clean_html $fname
done
fi
if ! grep -q "${TP_DOMAIN}/css/base" /themepark/private/index.html; then
find /themepark/private -type f -iname *.html | while read fname
find /themepark/private -type f -iname "*.html" | while read fname
do
sed_file $fname
clean_html $fname
done
fi

View File

@ -2,4 +2,5 @@
if ! [[ -x "$(command -v svn)" ]]; then
echo "subversion" >> /mod-repo-packages-to-install.list
echo "perl" >> /mod-repo-packages-to-install.list
fi

View File

@ -82,18 +82,31 @@ sed_file(){
printf 'Stylesheet set to %s on %s\n\n' "${TP_THEME}" "$1"
}
clean_html() {
perl -i -pe 's/QBT_TR?\(//' "$1"
perl -i -pe 's/\)QBT_TR\[CONTEXT=.*?\]//' "$1"
}
# Adding stylesheets
echo '---------------------------------------'
echo '| Adding the stylesheet to html files |'
echo '---------------------------------------'
if ! grep -q "${TP_DOMAIN}/css/base" /themepark/public/index.html; then
sed_file /themepark/public/index.html
clean_html /themepark/public/index.html
# Clean JS files
find /themepark -type f -iname "*.js" | while read fname
do
clean_html $fname
done
fi
if ! grep -q "${TP_DOMAIN}/css/base" /themepark/private/index.html; then
find /themepark/private -type f -iname *.html | while read fname
find /themepark/private -type f -iname "*.html" | while read fname
do
sed_file $fname
clean_html $fname
done
fi