Debianbuild2

From FreeSWITCH Wiki
Jump to: navigation, search
#!/bin/bash
BUILDDIR=~/src
BRANCH=v1.2.stable
DCH_DISTRO=UNRELEASED
sudo apt-get -y update
sudo apt-get -y install autoconf automake devscripts gawk g++ git-core libjpeg-dev libncurses5-dev libtool make python-dev gawk pkg-config libtiff4-dev libperl-dev libgdbm-dev libdb-d
ev gettext sudo equivs mlocate git dpkg-dev devscripts sudo wget sox flac
sudo apt-get -y -f install
sudo update-alternatives --set awk /usr/bin/gawk
mkdir $BUILDDIR
cd $BUILDDIR
#git clone -b $BRANCH git://git.freeswitch.org/freeswitch.git
DISTRO=`lsb_release -cs`
FS_VERSION="$(cat freeswitch/build/next-release.txt | sed -e 's/-/~/g')~n$(date +%Y%m%dT%H%M%SZ)-1~${DISTRO}+1"

(cd freeswitch && build/set-fs-version.sh "$FS_VERSION")
(cd freeswitch && dch -b -m -v "$FS_VERSION" --force-distribution -D "$DCH_DISTRO" "Custom build.")
if [ -f modules.conf ]; then cp modules.conf freeswitch/debian; fi
(cd freeswitch/debian && ./bootstrap.sh -c ${DISTRO})
sudo mk-build-deps -i freeswitch/debian/control
(cd freeswitch && dpkg-buildpackage -b -uc)

mkdir dbg
mv *dbg* dbg

cd $BUILDDIR
git clone https://github.com/traviscross/freeswitch-sounds.git
cd freeswitch-sounds
./debian/bootstrap.sh -p freeswitch-sounds-en-us-callie
./debian/rules get-orig-source
tar -xv --strip-components=1 -f *_*.orig.tar.xz && mv *_*.orig.tar.xz ../
dpkg-buildpackage -uc -us -Zxz -z9

cd $BUILDDIR
rm -rf freeswitch-sounds
git clone https://github.com/traviscross/freeswitch-sounds.git
cd freeswitch-sounds
./debian/bootstrap.sh -p freeswitch-music-default
./debian/rules get-orig-source
tar -xv --strip-components=1 -f *_*.orig.tar.xz && mv *_*.orig.tar.xz ../
dpkg-buildpackage -uc -us -Zxz -z9

sudo sed -i "$ a\deb file:${BUILDDIR} ./" /etc/apt/sources.list
cd $BUILDDIR
sudo dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz

sudo apt-get -y update
sudo apt-get -y --force-yes install freeswitch-meta-vanilla freeswitch-music
sudo mkdir /etc/freeswitch
sudo cp -r /usr/share/freeswitch/conf/vanilla/* /etc/freeswitch/
sudo adduser --disabled-password  --quiet --system --home /usr/share/freeswitch --gecos "FreeSwitch Voice Platform" --ingroup daemon freeswitch
sudo sh -c 'chown -R freeswitch:daemon /etc/freeswitch/'
sudo sh -c 'chown -R freeswitch:daemon /usr/share/freeswitch/'
#modules.conf disable spandsp to avoid permission error, should be run as root to avoid
#sed...
#fix music paths
cd /usr/share/freeswitch/sounds/music
sudo ln -s default/8000 8000
sudo ln -s default/16000 16000
sudo ln -s default/32000 32000
#done!!
cd $BUILDDIR
sudo /etc/init.d/freeswitch start