]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7928 FS-7618 systemd and package build improvements
authorStanislav Sinyagin <ssinyagin@k-open.com>
Mon, 12 Oct 2015 22:36:08 +0000 (00:36 +0200)
committerStanislav Sinyagin <ssinyagin@k-open.com>
Tue, 13 Oct 2015 20:36:37 +0000 (22:36 +0200)
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

debian/bootstrap.sh
debian/control-modules
debian/freeswitch-systemd.freeswitch.service
debian/freeswitch-sysvinit.freeswitch.default [moved from debian/freeswitch-systemd.freeswitch.default with 100% similarity]
debian/freeswitch.postinst
debian/rules

index 74ed4cb1fe3f2c699d0c9f6aa010825c4c5b9a73..418b9b998c311d761fe01e0caf4250a1297f0979 100755 (executable)
@@ -2,12 +2,33 @@
 ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
 ##### 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"
 conf_dir="../conf"
 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."
 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_distros="$supported_debian_distros $supported_ubuntu_distros"
 avoid_mods=(
@@ -46,11 +67,14 @@ avoid_mods_jessie=(
 avoid_mods_wheezy=(
   event_handlers/mod_amqp
   languages/mod_java
-)
-avoid_mods_squeeze=(
-  event_handlers/mod_amqp
-  formats/mod_vlc
   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=(
 )
@@ -75,13 +99,16 @@ freeswitch-dbg
 libfreeswitch1-dbg
 libfreeswitch-dev
 freeswitch-doc
-freeswitch-init
-freeswitch-sysvinit
-freeswitch-systemd
 freeswitch-lang
 freeswitch-timezones
 )
 
+if [ ${use_sysvinit} = "true" ]; then
+    manual_pkgs=( "${manual_pkgs[@]}" "freeswitch-sysvinit" )
+else
+    manual_pkgs=( "${manual_pkgs[@]}" "freeswitch-systemd" )
+fi
+
 err () {
   echo "$0 error: $1" >&2
   exit 1
@@ -285,16 +312,20 @@ list_freeswitch_all_dbg_replaces () {
 print_source_control () {
   local libtool_dep="libtool, libtool-bin"
   case "$codename" in
-    squeeze|wheezy|trusty) libtool_dep="libtool" ;;
+    wheezy|trusty) libtool_dep="libtool" ;;
   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
 Section: comm
 Priority: optional
 Maintainer: Travis Cross <tc@traviscross.com>
 Build-Depends:
 # for debian
debhelper (>= 8.0.0),
${debhelper_dep},
 # bootstrapping
  automake (>= 1.9), autoconf, ${libtool_dep},
 # core build
@@ -822,33 +853,6 @@ Description: documentation for FreeSWITCH
  This package contains Doxygen-produce documentation for FreeSWITCH.
  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
 
 ## languages
@@ -873,7 +877,37 @@ Description: Timezone files for FreeSWITCH
  .
  $(debian_wrap "This package includes the timezone files for FreeSWITCH.")
 
+## startup
+
+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 () {
@@ -1262,17 +1296,6 @@ conf_merge () {
   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 >&2
@@ -1325,14 +1348,16 @@ for x in postinst postrm preinst prerm; do
 done
 cp -a freeswitch-doc.docs freeswitch-all.docs
 
-cp -a freeswitch-systemd.freeswitch.service freeswitch-all.freeswitch.service
-cp -a freeswitch-systemd.freeswitch.tmpfile freeswitch-all.freeswitch.tmpfile
-cp -a freeswitch-systemd.freeswitch.default freeswitch-all.freeswitch.default
-
-cp -a freeswitch-systemd.freeswitch.default freeswitch-sysvinit.freeswitch.default 
+if [ ${use_sysvinit} = "true" ]; then
+    cp -a freeswitch-sysvinit.freeswitch.init freeswitch-all.freeswitch.init
+    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
 
-# 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
 grep -e '^Package:' control | while xread l; do
index c009c96ee09a09b9082759107b9e6a935af8437f..66c040f5d284581b3d3f00ec97b1b59ff67cc846 100644 (file)
@@ -611,7 +611,6 @@ Description: VLC streaming
 Build-Depends: libvlc-dev (>= 2.0.0)
 Depends: vlc-nox
 Suggests: vlc-dbg
-Distro-Conflicts: squeeze
 
 Module: formats/mod_webm
 Description: Adds mod_webm
index 0a4380d8a44b7bdf942cbbff24e25af5c87f4d64..2a3a97089b555e0bf0631f38af9c3b5d06140fb8 100644 (file)
@@ -10,7 +10,7 @@ Type=forking
 PIDFile=/run/freeswitch/freeswitch.pid
 Environment="DAEMON_OPTS=-nonat"
 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
 Restart=always
 ; exec
index 01d8b93c0d540aa74529596ec5ce11c4568afb52..c08fd07e31165e26421bbf638f11f0fbcbe63cd1 100644 (file)
@@ -37,9 +37,6 @@ case "$1" in
       mkdir -p /etc/freeswitch/tls/
       chown freeswitch:freeswitch /etc/freeswitch/tls
     fi
-    if [ -x /bin/systemctl -a x`systemctl is-enabled freeswitch` != "xenabled" ]; then
-       systemctl enable freeswitch
-    fi
     ;;
   abort-upgrade|abort-remove|abort-deconfigure)
     ;;
index 337a913eb3cdf9bf3596a9f09dc9f1f946c97c07..7cfe4c1c2e16b42c1fe8325d805c82555b685288 100755 (executable)
@@ -101,9 +101,15 @@ override_dh_auto_install:
        rm -f debian/tmp/usr/share/freeswitch/grammar/model/communicator/COPYING
 
 override_dh_installinit:
-       dh_installinit -pfreeswitch-sysvinit --name=freeswitch
-       dh_installinit -pfreeswitch-systemd --name=freeswitch
-       dh_installinit -pfreeswitch-all --name=freeswitch
+       if [ `cat debian/freeswitch-init.provided_by` = freeswitch-systemd ]; then \
+         dh_systemd_enable -pfreeswitch-systemd --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:
        dh_makeshlibs