conditional install ffplayout-engine

This commit is contained in:
jb-alvarado 2020-07-06 20:55:49 +02:00
parent 949f0c589b
commit d1fbbf4c50

View File

@ -91,12 +91,32 @@ while true; do
esac esac
done done
echo ""
echo "-----------------------------------------------------------------------------------------------------"
echo "install ffplayout-engine:"
echo "-----------------------------------------------------------------------------------------------------"
echo ""
while true; do
read -p "Do you wish to install ffplayout-engine? (Y/n) :$ " yn
case $yn in
[Yy]* ) installEngine="y"; break;;
[Nn]* ) installEngine="n"; break;;
* ) (
echo "------------------------------------"
echo "Please answer yes or no!"
echo ""
);;
esac
done
echo "" echo ""
echo "-----------------------------------------------------------------------------------------------------" echo "-----------------------------------------------------------------------------------------------------"
echo "install main packages" echo "install main packages"
echo "-----------------------------------------------------------------------------------------------------" echo "-----------------------------------------------------------------------------------------------------"
if [[ "$(grep -Ei 'debian|buntu|mint' /etc/*release)" ]]; then if [[ "$(grep -Ei 'debian|buntu|mint' /etc/*release)" ]]; then
apt update
apt install -y sudo curl wget net-tools git python3-dev build-essential virtualenv python3-virtualenv mediainfo autoconf automake libtool pkg-config yasm cmake mercurial gperf apt install -y sudo curl wget net-tools git python3-dev build-essential virtualenv python3-virtualenv mediainfo autoconf automake libtool pkg-config yasm cmake mercurial gperf
curl -sL https://deb.nodesource.com/setup_12.x | bash - curl -sL https://deb.nodesource.com/setup_12.x | bash -
@ -270,6 +290,7 @@ EOF
systemctl start srs.service systemctl start srs.service
fi fi
if [[ "$installEngine" == "y" ]]; then
echo "" echo ""
echo "-----------------------------------------------------------------------------------------------------" echo "-----------------------------------------------------------------------------------------------------"
echo "install ffplayout engine" echo "install ffplayout engine"
@ -305,6 +326,7 @@ sed -i "s|\"\/mediaStorage|\"$mediaPath|g" /etc/ffplayout/ffplayout.yml
systemctl enable ffplayout-engine.service systemctl enable ffplayout-engine.service
deactivate deactivate
fi
echo "" echo ""
echo "-----------------------------------------------------------------------------------------------------" echo "-----------------------------------------------------------------------------------------------------"
@ -347,12 +369,16 @@ sed -i "s/ffplayout\\.local/$domain\'\n \'https\\:\/\/$domain/g" /var/www/ffp
systemctl enable ffplayout-api.service systemctl enable ffplayout-api.service
if [[ "$(grep -Ei 'debian|buntu|mint' /etc/*release)" ]]; then if [[ $installNginx == 'y' ]]; then
cp docs/ffplayout.conf "$nginxConfig/"
ln -s $nginxConfig/ffplayout.conf /etc/nginx/sites-enabled/
elif [[ "$(grep -Ei 'centos|fedora' /etc/*release)" ]]; then
cp docs/ffplayout.conf "$nginxConfig/" cp docs/ffplayout.conf "$nginxConfig/"
origin=$(echo "$domain" | sed 's/\./\\\\./g')
sed -i "s/ffplayout.local/$domain/g" $nginxConfig/ffplayout.conf
sed -i "s/ffplayout\\\.local/$origin/g" $nginxConfig/ffplayout.conf
fi
if [[ "$(grep -Ei 'centos|fedora' /etc/*release)" ]]; then
echo "" echo ""
echo "-----------------------------------------------------------------------------------------------------" echo "-----------------------------------------------------------------------------------------------------"
echo "creating selinux rules" echo "creating selinux rules"
@ -442,11 +468,6 @@ EOF
semodule -i create.pp semodule -i create.pp
fi fi
origin=$(echo "$domain" | sed 's/\./\\\\./g')
sed -i "s/ffplayout.local/$domain/g" $nginxConfig/ffplayout.conf
sed -i "s/ffplayout\\\.local/$origin/g" $nginxConfig/ffplayout.conf
echo "$serviceUser ALL = NOPASSWD: /bin/systemctl start ffplayout-engine.service, /bin/systemctl stop ffplayout-engine.service, /bin/systemctl reload ffplayout-engine.service, /bin/systemctl restart ffplayout-engine.service, /bin/systemctl status ffplayout-engine.service, /bin/systemctl is-active ffplayout-engine.service, /bin/journalctl -n 1000 -u ffplayout-engine.service" >> /etc/sudoers echo "$serviceUser ALL = NOPASSWD: /bin/systemctl start ffplayout-engine.service, /bin/systemctl stop ffplayout-engine.service, /bin/systemctl reload ffplayout-engine.service, /bin/systemctl restart ffplayout-engine.service, /bin/systemctl status ffplayout-engine.service, /bin/systemctl is-active ffplayout-engine.service, /bin/journalctl -n 1000 -u ffplayout-engine.service" >> /etc/sudoers
cd /var/www/ffplayout/ffplayout/frontend cd /var/www/ffplayout/ffplayout/frontend
@ -460,7 +481,10 @@ EOF
npm run build npm run build
if [[ $installNginx == 'y' ]]; then
systemctl restart nginx systemctl restart nginx
fi
systemctl start ffplayout-api.service systemctl start ffplayout-api.service
echo "" echo ""