FS-7928 FS-7618 systemd and package build improvements

debian/bootstrap.sh:
 * only build one of freeswitch-sysvinit or freeswitch-systemd
 * squeeze is removed from supported releases
 * added stretch to supported releases
 * avoid_mods_wheezy extended to modules which fail to build on wheezy
 * use systemd by default for future distros
 * new command-line option -v to enforce sysvinit
 * added dependency on dh-systemd for systemd-powered distros
 * freeswitch-init is now a virtual package
 * freeswitch-sysvinit and freeswitch-systemd are set to conflict with each other

debian/freeswitch.postinst:
 * no need to call systemctl explicitly. dh-systemd does it in a standard way

debian/rules:
 * integrated dh-systemd in override_dh_installinit

debian/freeswitch-systemd.freeswitch.default renamed to
freeswitch-sysvinit.freeswitch.default:
 * /etc/default/freeswitch is not installed by freeswitch-systemd, but still
   respected if there is a need to modify the startup options

debian/freeswitch-systemd.freeswitch.service:
 * proper expansion of DAEMON_OPTS
This commit is contained in:
Stanislav Sinyagin 2015-10-13 00:36:08 +02:00
parent a0b009e353
commit 77f52bb6a8
6 changed files with 91 additions and 64 deletions

137
debian/bootstrap.sh vendored
View File

@ -2,12 +2,33 @@
##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
##### Author: Travis Cross <tc@traviscross.com> ##### Author: Travis Cross <tc@traviscross.com>
codename="sid"
modulelist_opt=""
modules_add=""
use_sysvinit=""
while getopts "c:m:p:v" o; do
case "$o" in
c) codename="$OPTARG" ;;
m) modulelist_opt="$OPTARG" ;;
p) modules_add="$modules_add $OPTARG";;
v) use_sysvinit="true";;
esac
done
shift $(($OPTIND-1))
if [ x${use_sysvinit} = x ]; then
case "$codename" in
wheezy|trusty|utopic) use_sysvinit="true";;
*) use_sysvinit="false";;
esac
fi
mod_dir="../src/mod" mod_dir="../src/mod"
conf_dir="../conf" conf_dir="../conf"
lang_dir="../conf/vanilla/lang" lang_dir="../conf/vanilla/lang"
fs_description="FreeSWITCH is a scalable open source cross-platform telephony platform designed to route and interconnect popular communication protocols using audio, video, text or any other form of media." fs_description="FreeSWITCH is a scalable open source cross-platform telephony platform designed to route and interconnect popular communication protocols using audio, video, text or any other form of media."
mod_build_depends="." mod_depends="." mod_recommends="." mod_suggests="." mod_build_depends="." mod_depends="." mod_recommends="." mod_suggests="."
supported_debian_distros="squeeze wheezy jessie sid" supported_debian_distros="wheezy jessie stretch sid"
supported_ubuntu_distros="trusty utopic" supported_ubuntu_distros="trusty utopic"
supported_distros="$supported_debian_distros $supported_ubuntu_distros" supported_distros="$supported_debian_distros $supported_ubuntu_distros"
avoid_mods=( avoid_mods=(
@ -46,11 +67,14 @@ avoid_mods_jessie=(
avoid_mods_wheezy=( avoid_mods_wheezy=(
event_handlers/mod_amqp event_handlers/mod_amqp
languages/mod_java languages/mod_java
)
avoid_mods_squeeze=(
event_handlers/mod_amqp
formats/mod_vlc
languages/mod_managed languages/mod_managed
applications/mod_av
applications/mod_cv
applications/mod_hiredis
formats/mod_shout
applications/mod_sonar
applications/mod_soundtouch
formats/mod_vlc
) )
avoid_mods_trusty=( avoid_mods_trusty=(
) )
@ -75,13 +99,16 @@ freeswitch-dbg
libfreeswitch1-dbg libfreeswitch1-dbg
libfreeswitch-dev libfreeswitch-dev
freeswitch-doc freeswitch-doc
freeswitch-init
freeswitch-sysvinit
freeswitch-systemd
freeswitch-lang freeswitch-lang
freeswitch-timezones freeswitch-timezones
) )
if [ ${use_sysvinit} = "true" ]; then
manual_pkgs=( "${manual_pkgs[@]}" "freeswitch-sysvinit" )
else
manual_pkgs=( "${manual_pkgs[@]}" "freeswitch-systemd" )
fi
err () { err () {
echo "$0 error: $1" >&2 echo "$0 error: $1" >&2
exit 1 exit 1
@ -285,16 +312,20 @@ list_freeswitch_all_dbg_replaces () {
print_source_control () { print_source_control () {
local libtool_dep="libtool, libtool-bin" local libtool_dep="libtool, libtool-bin"
case "$codename" in case "$codename" in
squeeze|wheezy|trusty) libtool_dep="libtool" ;; wheezy|trusty) libtool_dep="libtool" ;;
esac esac
cat <<EOF local debhelper_dep="debhelper (>= 8.0.0)"
if [ ${use_sysvinit} = "false" ]; then
debhelper_dep=${debhelper_dep}", dh-systemd"
fi
cat <<EOF
Source: freeswitch Source: freeswitch
Section: comm Section: comm
Priority: optional Priority: optional
Maintainer: Travis Cross <tc@traviscross.com> Maintainer: Travis Cross <tc@traviscross.com>
Build-Depends: Build-Depends:
# for debian # for debian
debhelper (>= 8.0.0), ${debhelper_dep},
# bootstrapping # bootstrapping
automake (>= 1.9), autoconf, ${libtool_dep}, automake (>= 1.9), autoconf, ${libtool_dep},
# core build # core build
@ -822,33 +853,6 @@ Description: documentation for FreeSWITCH
This package contains Doxygen-produce documentation for FreeSWITCH. This package contains Doxygen-produce documentation for FreeSWITCH.
It may be an empty package at the moment. It may be an empty package at the moment.
Package: freeswitch-init
Architecture: all
Depends: \${misc:Depends},
freeswitch-sysvinit (= \${binary:Version}),
freeswitch-systemd (= \${binary:Version})
Description: FreeSWITCH startup configuration
$(debian_wrap "${fs_description}")
.
This is a metapackage which depends on the default system startup
packages for FreeSWITCH.
Package: freeswitch-sysvinit
Architecture: all
Depends: \${misc:Depends}, lsb-base (>= 3.0-6)
Description: FreeSWITCH SysV init script
$(debian_wrap "${fs_description}")
.
This package contains the SysV init script for FreeSWITCH.
Package: freeswitch-systemd
Architecture: all
Depends: \${misc:Depends}
Description: FreeSWITCH systemd configuration
$(debian_wrap "${fs_description}")
.
This package contains the systemd configuration for FreeSWITCH.
## misc ## misc
## languages ## languages
@ -873,7 +877,37 @@ Description: Timezone files for FreeSWITCH
. .
$(debian_wrap "This package includes the timezone files for FreeSWITCH.") $(debian_wrap "This package includes the timezone files for FreeSWITCH.")
## startup
EOF EOF
if [ ${use_sysvinit} = "true" ]; then
cat <<EOF
Package: freeswitch-sysvinit
Architecture: all
Depends: \${misc:Depends}, lsb-base (>= 3.0-6), sysvinit
Conflicts: freeswitch-init
Provides: freeswitch-init
Description: FreeSWITCH SysV init script
$(debian_wrap "${fs_description}")
.
This package contains the SysV init script for FreeSWITCH.
EOF
else
cat <<EOF
Package: freeswitch-systemd
Architecture: all
Depends: \${misc:Depends}, systemd
Conflicts: freeswitch-init
Provides: freeswitch-init
Description: FreeSWITCH systemd configuration
$(debian_wrap "${fs_description}")
.
This package contains the systemd configuration for FreeSWITCH.
EOF
fi
} }
print_mod_control () { print_mod_control () {
@ -1262,17 +1296,6 @@ conf_merge () {
fi fi
} }
codename="sid"
modulelist_opt=""
modules_add=""
while getopts "c:m:p:" o; do
case "$o" in
c) codename="$OPTARG" ;;
m) modulelist_opt="$OPTARG" ;;
p) modules_add="$modules_add $OPTARG";;
esac
done
shift $(($OPTIND-1))
echo "Bootstrapping debian/ for ${codename}" >&2 echo "Bootstrapping debian/ for ${codename}" >&2
echo >&2 echo >&2
@ -1325,14 +1348,16 @@ for x in postinst postrm preinst prerm; do
done done
cp -a freeswitch-doc.docs freeswitch-all.docs cp -a freeswitch-doc.docs freeswitch-all.docs
cp -a freeswitch-systemd.freeswitch.service freeswitch-all.freeswitch.service if [ ${use_sysvinit} = "true" ]; then
cp -a freeswitch-systemd.freeswitch.tmpfile freeswitch-all.freeswitch.tmpfile cp -a freeswitch-sysvinit.freeswitch.init freeswitch-all.freeswitch.init
cp -a freeswitch-systemd.freeswitch.default freeswitch-all.freeswitch.default cp -a freeswitch-sysvinit.freeswitch.default freeswitch-all.freeswitch.default
echo -n freeswitch-sysvinit >freeswitch-init.provided_by
else
cp -a freeswitch-systemd.freeswitch.service freeswitch-all.freeswitch.service
cp -a freeswitch-systemd.freeswitch.tmpfile freeswitch-all.freeswitch.tmpfile
echo -n freeswitch-systemd >freeswitch-init.provided_by
fi
cp -a freeswitch-systemd.freeswitch.default freeswitch-sysvinit.freeswitch.default
# TODO: FS-7928 need to add a condition and skip this for jessie and onward
cp -a freeswitch-sysvinit.freeswitch.init freeswitch-all.freeswitch.init
echo "Generating additional lintian overrides..." >&2 echo "Generating additional lintian overrides..." >&2
grep -e '^Package:' control | while xread l; do grep -e '^Package:' control | while xread l; do

View File

@ -611,7 +611,6 @@ Description: VLC streaming
Build-Depends: libvlc-dev (>= 2.0.0) Build-Depends: libvlc-dev (>= 2.0.0)
Depends: vlc-nox Depends: vlc-nox
Suggests: vlc-dbg Suggests: vlc-dbg
Distro-Conflicts: squeeze
Module: formats/mod_webm Module: formats/mod_webm
Description: Adds mod_webm Description: Adds mod_webm

View File

@ -10,7 +10,7 @@ Type=forking
PIDFile=/run/freeswitch/freeswitch.pid PIDFile=/run/freeswitch/freeswitch.pid
Environment="DAEMON_OPTS=-nonat" Environment="DAEMON_OPTS=-nonat"
EnvironmentFile=-/etc/default/freeswitch EnvironmentFile=-/etc/default/freeswitch
ExecStart=/usr/bin/freeswitch -u freeswitch -g freeswitch -ncwait ${DAEMON_OPTS} ExecStart=/usr/bin/freeswitch -u freeswitch -g freeswitch -ncwait $DAEMON_OPTS
TimeoutSec=45s TimeoutSec=45s
Restart=always Restart=always
; exec ; exec

View File

@ -37,9 +37,6 @@ case "$1" in
mkdir -p /etc/freeswitch/tls/ mkdir -p /etc/freeswitch/tls/
chown freeswitch:freeswitch /etc/freeswitch/tls chown freeswitch:freeswitch /etc/freeswitch/tls
fi fi
if [ -x /bin/systemctl -a x`systemctl is-enabled freeswitch` != "xenabled" ]; then
systemctl enable freeswitch
fi
;; ;;
abort-upgrade|abort-remove|abort-deconfigure) abort-upgrade|abort-remove|abort-deconfigure)
;; ;;

12
debian/rules vendored
View File

@ -101,9 +101,15 @@ override_dh_auto_install:
rm -f debian/tmp/usr/share/freeswitch/grammar/model/communicator/COPYING rm -f debian/tmp/usr/share/freeswitch/grammar/model/communicator/COPYING
override_dh_installinit: override_dh_installinit:
dh_installinit -pfreeswitch-sysvinit --name=freeswitch if [ `cat debian/freeswitch-init.provided_by` = freeswitch-systemd ]; then \
dh_installinit -pfreeswitch-systemd --name=freeswitch dh_systemd_enable -pfreeswitch-systemd --name=freeswitch; \
dh_installinit -pfreeswitch-all --name=freeswitch dh_systemd_start -pfreeswitch-systemd --name=freeswitch; \
dh_systemd_enable -pfreeswitch-all --name=freeswitch; \
dh_systemd_start -pfreeswitch-all --name=freeswitch; \
else \
dh_installinit -pfreeswitch-sysvinit --name=freeswitch; \
dh_installinit -pfreeswitch-all --name=freeswitch; \
fi
override_dh_makeshlibs: override_dh_makeshlibs:
dh_makeshlibs dh_makeshlibs