Skip to content

Instantly share code, notes, and snippets.

@davidcornu
Created September 13, 2011 03:29
Show Gist options
  • Save davidcornu/1213059 to your computer and use it in GitHub Desktop.
Save davidcornu/1213059 to your computer and use it in GitHub Desktop.
Media Server Easy Install
#!/usr/bin/env bash
# Usage: wget https://raw.github.com/artfox/ArtfoxMedia/master/install/install.sh -O - | sh
set -e;
echo '
_______ _______ ______ _____ _______
| | | |______ | \ | |_____|
| | | |______ |_____/ __|__ | |
_______ _______ ______ _ _ _______ ______
|______ |______ |_____/ \ / |______ |_____/
______| |______ | \_ \/ |______ | \_
Media Server installer by David Cornu
To get you up and running, this installer will:
- Download and install Apache Tomcat
- Download a copy of the source code
- Configure the necessary files
- Compile the source code
- Deploy the servlet to Tomcat
- Setup some handy shell scripts
Press ENTER to continue.';
read;
echo "--------------------------------------------";
echo "Checking for required commands";
echo "--------------------------------------------";
echo -ne "Git"
if which git &> /dev/null; then
echo ".........Found!";
else
echo ".........Missing!"; exit 1;
fi
echo -ne "Java"
if which java &> /dev/null; then
echo "........Found!";
else
echo "........Missing!"; exit 1;
fi
echo -ne "Maven"
if which mvn &> /dev/null; then
echo ".......Found!";
else
echo ".......Missing!"; exit 1;
fi
echo -ne "Tar"
if which tar &> /dev/null; then
echo ".........Found!";
else
echo ".........Missing!"; exit 1;
fi
echo -ne "Wget"
if which wget &> /dev/null; then
echo "........Found!";
else
echo "........Missing!"; exit 1;
fi
echo "--------------------------------------------";
echo "Setting up Media Server environment";
echo "--------------------------------------------";
echo "--------------------------------------------";
echo "Creating media_server directory";
echo "--------------------------------------------";
mkdir media_server;
cd media_server;
echo "--------------------------------------------";
echo "Creating tmp directory";
echo "--------------------------------------------";
mkdir tmp;
cd tmp;
echo "--------------------------------------------";
echo "Fetching Apache Tomcat 7.0.21";
echo "--------------------------------------------";
wget http://mirror.csclub.uwaterloo.ca/apache/tomcat/tomcat-7/v7.0.21/bin/apache-tomcat-7.0.21.tar.gz;
echo "--------------------------------------------";
echo "Extracting Apache Tomcat";
echo "--------------------------------------------";
tar -xzf apache-tomcat-7.0.21.tar.gz;
mv apache-tomcat-7.0.21 ../tomcat;
echo "--------------------------------------------";
echo "Cleaning up archive";
echo "--------------------------------------------";
cd ..;
rm -R tmp/;
echo "--------------------------------------------";
echo "Fetching Media Server source";
echo "--------------------------------------------";
git clone git@github.com:artfox/ArtfoxMedia.git source;
echo "--------------------------------------------";
echo "Moving files into place";
echo "--------------------------------------------";
rm -R tomcat/webapps/ROOT;
cp source/medias.war tomcat/webapps;
echo "--------------------------------------------";
echo "Configuring source files";
echo "--------------------------------------------";
cat source/web/META-INF/context.xml.example | {
while read line; do
if [[ $line == *url* ]]; then
echo "url='jdbc:hsqldb:file:`pwd`/database/db;shutdown=true'"
else
echo $line
fi
done
echo $line
} >> source/web/META-INF/context.xml;
cp source/web/WEB-INF/artfox-servlet.xml.example source/web/WEB-INF/artfox-servlet.xml;
echo "--------------------------------------------";
echo "Compiling source files";
echo "--------------------------------------------";
cd source;
mvn clean;
mvn package;
echo "--------------------------------------------";
echo "Moving files into place";
echo "--------------------------------------------";
cp target/ROOT.war ../tomcat/webapps/;
cp install/start.sh ../;
cp install/stop.sh ../;
cp install/update.sh ../;
echo '
Installation complete! You have yourself a working Media Server.
The following shell scripts are available for your convenience:
- ./start.sh starts tomcat for you
- ./stop.sh stops tomcat for you
- ./update.sh updates your media server
For information about proxy configuration visit:
https://github.com/artfox/ArtfoxMedia/blob/master/README.md
Cheers,
- David
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment