This commit is contained in:
xdtianyu 2015-01-27 13:57:10 +08:00
parent 53c24c488b
commit 1afd98180e
3 changed files with 77 additions and 0 deletions

54
py/build.sh Normal file
View File

@ -0,0 +1,54 @@
#!/bin/bash
USER=$(cat /etc/passwd |grep bash| grep home|head -n1 |cut -d ':' -f 1)
if [ -z '$USER' ];then
echo 'Error, must have a normal user!!'
exit 0
else
echo "Run as $USER now."
fi
if [ -d '/tmp/rtmpweb' ];then
rm -r /tmp/rtmpweb
fi
sudo -u $USER mkdir /tmp/rtmpweb
sudo -u $USER cp -a . /tmp/rtmpweb
cd /tmp/rtmpweb
echo -e "cleaning...\n"
sudo -u $USER ./clean.sh
sudo -u $USER python server.py -c server.cfg -g
sudo -u $USER pyinstaller server.py -F
if [ -f '.auto' ];then
sudo -u $USER cp .auto dist
else
echo "Error, .auto file not find"
fi
if [ ! -d 'dist' ];then
echo "Error, pyinstall failed!"
exit 0
fi
if [ -d 'records' ];then
sudo -u $USER cp -r records dist
fi
if [ -d 'static' ];then
sudo -u $USER cp -r static dist
else
echo "Error, no static."
fi
if [ -f 'server.cfg' ];then
sudo -u $USER cp server.cfg dist
fi
cd -
echo "DONE!"

23
py/clean.sh Normal file
View File

@ -0,0 +1,23 @@
#!/bin/bash
if [ $(find -name \*.pyc|wc -l) != 0 ];then
rm *.pyc
fi
if [ -f ".auto" ];then
rm .auto
fi
if [ -d "dist" ];then
rm -r dist
fi
if [ -d "build" ];then
rm -r build
fi
if [ -f "server.spec" ];then
rm server.spec
fi
echo "DONE!"