#!/bin/bash
#
# Target dist: Debian Jessie
DIST=jessie

rm -rf ${DIST}
cp -r debian ${DIST}

# No mi_xmlrpc module
sed -i -e '/libxmlrpc-c3-dev/d' -e '/^Package: kamailio-xmlrpc-modules/,/^$/d' \
	${DIST}/control
sed -i -e 's/ mi_xmlrpc[ ,$]*/ /' ${DIST}/rules
sed -i -e '/^EXTRA_EXCLUDED_MODULES=/s/$/ mi_xmlrpc/' ${DIST}/rules

# use old libfreeradius
sed -i 's/libradcli-dev/libfreeradius-client-dev/' ${DIST}/control
sed -i -e 's/RADCLI/FREERADIUS/' ${DIST}/rules

# old mysql
sed -i -e 's/default-mysql-client/mysql-client/' \
  -e 's/default-libmysqlclient-dev/libmysqlclient-dev/' ${DIST}/control

# no libssl-dev
sed -i -e '/libssl-dev/d' ${DIST}/control

# clean backports scripts
rm -rf ${DIST}/backports
exit 0