Last active
July 31, 2018 06:39
-
-
Save Ark74/51e1ecb3da664473a1f8b1cf9d911f85 to your computer and use it in GitHub Desktop.
Patching Libretime Apache reverse proxy (Xenial/Trusty)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# PatchLT - A simple script for Libretime and reverse proxy | |
# easing the SSL setup and proxy using Apache2 - @Jul/30/2018 | |
# Use along with PR https://github.com/LibreTime/libretime/pull/501 | |
echo "This post-install script must be run right after finishing installation." | |
if [ "$EUID" -ne 0 ] | |
then echo "Please run as root" | |
exit | |
fi | |
# Install silan-3.3 (Tested with Xenial and Trusty). | |
echo "Installing backported silan 3.3" | |
if [ $(lsb_release -sc) == "trusty" ] | |
then | |
release="https://github.com/Ark74/silan3.3/raw/Trusty/silan_0.3.3-1_amd64.deb" | |
elif [ $(lsb_release -sc) == "xenial" ] | |
then | |
release="https://github.com/Ark74/silan3.3/raw/master/silan_0.3.3-1_amd64.deb" | |
else | |
echo "No backport available!" | |
exit | |
fi | |
if [ $(dpkg-query -W -f='${Version}' "silan") == "0.3.3-1" ] | |
then | |
echo " Silan installed version Ok!" | |
else | |
wget $release -O /tmp/silan_3.3.deb | |
dpkg -i /tmp/silan_3.3.deb | |
apt install -fy | |
rm -rf /tmp/silan_3.3.deb | |
fi | |
# Enable reverse proxy (will ease SSL setup). | |
# Note that Icecast mount paths will be managed by Apache Proxy. | |
echo "Enabling reverse proxy icecast included." | |
if grep -F "## Proxy requires" /etc/apache2/sites-available/airtime.conf ; then | |
sed -i 's|#||' /etc/apache2/sites-available/airtime.conf | |
else | |
echo " Seems that you have run this script before, skipping." | |
fi | |
# Patch Icecast links for reverse proxying | |
echo "Patching Icecast links for reverse proxying." | |
if grep -F 'src="corner_topleft.jpg"' /etc/icecast2/web/status.xsl ; then | |
echo " Seems that you have run this script before, skipping." | |
else | |
echo " Patching public web" | |
cd /etc/icecast2/web/ | |
sed -i 's|src="/style.css|src="style.css|g' * | |
sed -i 's|src="/corner_topleft.jpg|src="corner_topleft.jpg|g' * | |
sed -i 's|src="/corner_topright.jpg|src="corner_topright.jpg|g' * | |
sed -i 's|src="/corner_bottomleft.jpg|src="corner_bottomleft.jpg|g' * | |
sed -i 's|src="/corner_bottomright.jpg|src="corner_bottomright.jpg|g' * | |
sed -i 's|src="/icecast.png|src="icecast.png|g' * | |
sed -i 's|src="/tunein.png|src="tunein.png|g' * | |
sed -i 's|src="/key.png|src="key.png|g' * | |
fi | |
if grep -F 'href="../style.css"' /etc/icecast2/admin/listclients.xsl ; then | |
echo " Seems that you have run this script before, skipping." | |
else | |
echo " Patching admin portal" | |
cd /etc/icecast2/admin/ | |
sed -i 's|src="/style.css|src="../style.css|g' * | |
sed -i 's|src="/status.xsl|src="../status.xsl|g' * | |
sed -i 's|src="/corner_topleft.jpg|src="../corner_topleft.jpg|g' * | |
sed -i 's|src="/corner_topright.jpg|src="../corner_topright.jpg|g' * | |
sed -i 's|src="/corner_bottomleft.jpg|src="../corner_bottomleft.jpg|g' * | |
sed -i 's|src="/corner_bottomright.jpg|src="../corner_bottomright.jpg|g' * | |
fi | |
echo "Restarting services..." | |
service apache2 restart | |
service icecast2 restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment