Skip to content

Instantly share code, notes, and snippets.

@zyzsdy
Created December 9, 2017 14:50
Show Gist options
  • Save zyzsdy/5fc3303435621811e24bae5a7d343916 to your computer and use it in GitHub Desktop.
Save zyzsdy/5fc3303435621811e24bae5a7d343916 to your computer and use it in GitHub Desktop.
快速编译带有rtmp的nginx
#!/bin/bash
echo "START Config SOLA LIVE"
echo " "
set -e
workroot=`pwd`
# Install Base Tools
echo "Download base tools and source."
sudo apt-get install -y dpkg-dev vim git
sudo apt-get -y source nginx
git clone https://github.com/arut/nginx-rtmp-module.git
# Check Download
echo "Start Setting..."
ls | grep 'nginx-rtmp-module'
# Get Nginx Version
nginx_root=`ls | grep -P 'nginx-[0-9.]+'`
cd $nginx_root
# Add nginx-rtmp-module to build param
test_line=`grep -n -P '^%:' debian/rules | awk -F ":" '{print $1}'`
add_line=$(($test_line - 2))
sudo sed -i "$add_line s/^\(.*\)/\1 \\\\/" debian/rules
sudo sed -i "$add_line a \\\t\\t\\t--add-module=$workroot\/nginx-rtmp-module" debian/rules
# Install build dep and build
echo "Start Build..."
sudo apt-get -y build-dep nginx
sudo dpkg-buildpackage -b
# Back to workroot and install nginx
echo "Install..."
cd $workroot
nginx_extras_deb=`ls | grep 'nginx-extras_'`
nginx_common_deb=`ls | grep 'nginx-common_'`
sudo dpkg --install $nginx_common_deb $nginx_extras_deb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment