Ver código fonte

pkg/kamailio/centos: updates to CentOS 6 build

- Improved startup scripts
- Updated .spec
- README listing and explaining which Kamailio modules are not built for
  CentOS
Peter Dunkley 12 anos atrás
pai
commit
6cdae87e29

+ 29 - 0
pkg/kamailio/centos/6/README

@@ -0,0 +1,29 @@
+The following modules are not included in CentOS 6 builds because they have
+dependencies that cannot be met by the standard CentOS YUM repos, require
+complex compilation steps, or are obsolete.
+
+If you need any of these modules you will need to find (and possibly build) and
+install the dependencies and then do a manual build of Kamailio.
+
+* acc_radius		requires radiusclient-ng 0.5.0 or higher
+* app_java		requires various Java packages (which may be
+			available) and has a complex build process
+* app_mono		requires mono-devel
+* auth_radius		requires radiusclient-ng 0.5.0 or higher
+* carrierroute		requires libconfuse
+* db_cassandra		requires thrift 0.6.1 or 0.7.0
+* db_oracle		requires instantclient-sdk-10.2.0.3
+* dnssec		requires libval
+* geoip			requires libgeoip
+* iptrtpproxy		requires custom Kernel module builds. If you want to
+			use an in-kernel RTP proxy try the rtpproxy-ng module
+			along with mediaproxy-ng from SipWise
+* jabber		this module is obsolete
+* json			requires libjson
+* jsonrpc-c		requires libjson
+* memcached		requires a different version of libmemcached from that
+			available with CentOS
+* misc_radius		requires radiusclient-ng 0.5.6 or higher
+* ndb_redis		requires hiredis
+* osp			requires the OSP Toolkit
+* peering		requires radiusclient-ng 0.5.0 or higher

+ 71 - 18
pkg/kamailio/centos/6/kamailio.init

@@ -20,49 +20,102 @@
 # Source function library.
 . /etc/rc.d/init.d/functions
 
-kam=/usr/sbin/kamailio
-prog=kamailio
+KAM=/usr/sbin/kamailio
+KAMCFG=/etc/kamailio/kamailio.cfg
+PROG=kamailio
+PID_FILE=/var/run/kamailio.pid
+LOCK_FILE=/var/lock/subsys/kamailio
 RETVAL=0
+DEFAULTS=/etc/sysconfig/kamailio
+RUN_KAMAILIO=no
+
+
+# Do not start kamailio if fork=no is set in the config file
+# otherwise the boot process will just stop
+check_fork ()
+{
+    if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" $KAMCFG; then
+        echo "Not starting $DESC: fork=no specified in config file; run /etc/init.d/kamailio debug instead"
+        exit 1
+    fi
+}
+
+check_kamailio_config ()
+{
+        # Check if kamailio configuration is valid before starting the server
+        out=$($KAM -c 2>&1 > /dev/null)
+        retcode=$?
+        if [ "$retcode" != '0' ]; then
+            echo "Not starting $DESC: invalid configuration file!"
+            echo -e "\n$out\n"
+            exit 1
+        fi
+}
 
-[ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
 
 start() {
-	echo -n $"Starting $prog: "
-	# there is something at end of this output which is needed to
-	# report proper [ OK ] status in CentOS scripts
-	daemon $kam $OPTIONS 2>/dev/null | tail -1
+	check_kamailio_config
+        if [ "$1" != "debug" ]; then
+            check_fork
+        fi
+	echo -n $"Starting $PROG: "
+	daemon $KAM $OPTIONS >/dev/null 2>/dev/null
 	RETVAL=$?
 	echo
-	[ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
+	[ $RETVAL = 0 ] && touch $LOCK_FILE && success
+	return $RETVAL
 }
 
 stop() {
-	echo -n $"Stopping $prog: "
-	killproc $kam
+	echo -n $"Stopping $PROG: "
+	killproc $KAM
 	RETVAL=$?
 	echo
-	[ $RETVAL = 0 ] && rm -f /var/lock/subsys/$prog /var/run/$prog.pid
+	[ $RETVAL = 0 ] && rm -f $LOCK_FILE $PID_FILE
 }
 
-MEMORY=$((`echo $MEMORY | sed -e 's/[^0-9]//g'`))
+# Load startup options if available
+if [ -f $DEFAULTS ]; then
+   . $DEFAULTS || true
+fi
+
+if [ "$RUN_KAMAILIO" != "yes" ]; then
+    echo "Kamailio not yet configured. Edit /etc/default/kamailio first."
+    exit 0
+fi
+
+
+SHM_MEMORY=$((`echo $SHM_MEMORY | sed -e 's/[^0-9]//g'`))
 PKG_MEMORY=$((`echo $PKG_MEMORY | sed -e 's/[^0-9]//g'`))
 [ -z "$USER" ]  && USER=kamailio
 [ -z "$GROUP" ] && GROUP=kamailio
-[ $MEMORY -le 0 ] && MEMORY=32
+[ $SHM_MEMORY -le 0 ] && SHM_MEMORY=32
 [ $PKG_MEMORY -le 0 ] && PKG_MEMORY=4
 
-OPTIONS="-P /var/run/$prog.pid -m $MEMORY -M $PKG_MEMORY -u $USER -g $GROUP"
+if test "$DUMP_CORE" = "yes" ; then
+    # set proper ulimit
+    ulimit -c unlimited
+
+    # directory for the core dump files
+    # COREDIR=/home/corefiles
+    # [ -d $COREDIR ] || mkdir $COREDIR
+    # chmod 777 $COREDIR
+    # echo "$COREDIR/core.%e.sig%s.%p" > /proc/sys/kernel/core_pattern
+fi
+
+OPTIONS="-P $PID_FILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP $EXTRA_OPTIONS"
+
 
 # See how we were called.
 case "$1" in
-	start)
+	start|debug)
 		start
 		;;
 	stop)
 		stop
 		;;
 	status)
-		status $kam
+		status $KAM
 		RETVAL=$?
 		;;
 	restart)
@@ -70,13 +123,13 @@ case "$1" in
 		start
 		;;
 	condrestart)
-		if [ -f /var/run/$prog.pid ] ; then
+		if [ -f $PID_FILE ] ; then
 			stop
 			start
 		fi
 		;;
 	*)
-		echo $"Usage: $prog {start|stop|reload|restart|condrestart|status|help}"
+		echo $"Usage: $PROG {start|stop|restart|condrestart|status|debug|help}"
 		exit 1
 esac
 

+ 45 - 175
pkg/kamailio/centos/6/kamailio.spec

@@ -446,6 +446,7 @@ fi
 %doc %{_docdir}/kamailio/modules/README.db2_ops
 %doc %{_docdir}/kamailio/modules/README.debugger
 %doc %{_docdir}/kamailio/modules/README.dialog
+%doc %{_docdir}/kamailio/modules/README.dialog_ng
 %doc %{_docdir}/kamailio/modules/README.dispatcher
 %doc %{_docdir}/kamailio/modules/README.diversion
 %doc %{_docdir}/kamailio/modules/README.dmq
@@ -562,10 +563,10 @@ fi
 %dir %{_libdir}/kamailio/modules
 %{_libdir}/kamailio/modules/acc.so
 %{_libdir}/kamailio/modules/alias_db.so
+%{_libdir}/kamailio/modules/async.so
 %{_libdir}/kamailio/modules/auth.so
 %{_libdir}/kamailio/modules/auth_db.so
 %{_libdir}/kamailio/modules/auth_diameter.so
-%{_libdir}/kamailio/modules/async.so
 %{_libdir}/kamailio/modules/avp.so
 %{_libdir}/kamailio/modules/avpops.so
 %{_libdir}/kamailio/modules/benchmark.so
@@ -579,11 +580,12 @@ fi
 %{_libdir}/kamailio/modules/counters.so
 %{_libdir}/kamailio/modules/ctl.so
 %{_libdir}/kamailio/modules/db_cluster.so
-%{_libdir}/kamailio/modules/db_text.so
 %{_libdir}/kamailio/modules/db_flatstore.so
+%{_libdir}/kamailio/modules/db_text.so
 %{_libdir}/kamailio/modules/db2_ops.so
 %{_libdir}/kamailio/modules/debugger.so
 %{_libdir}/kamailio/modules/dialog.so
+%{_libdir}/kamailio/modules/dialog_ng.so
 %{_libdir}/kamailio/modules/dispatcher.so
 %{_libdir}/kamailio/modules/diversion.so
 %{_libdir}/kamailio/modules/dmq.so
@@ -631,13 +633,13 @@ fi
 %{_libdir}/kamailio/modules/rtpproxy-ng.so
 %{_libdir}/kamailio/modules/sanity.so
 %{_libdir}/kamailio/modules/sca.so
+%{_libdir}/kamailio/modules/sdpops.so
 %{_libdir}/kamailio/modules/seas.so
 %{_libdir}/kamailio/modules/sipcapture.so
 %{_libdir}/kamailio/modules/sipt.so
 %{_libdir}/kamailio/modules/siptrace.so
 %{_libdir}/kamailio/modules/siputils.so
 %{_libdir}/kamailio/modules/sl.so
-%{_libdir}/kamailio/modules/sdpops.so
 %{_libdir}/kamailio/modules/sms.so
 %{_libdir}/kamailio/modules/speeddial.so
 %{_libdir}/kamailio/modules/sqlops.so
@@ -751,8 +753,6 @@ fi
 %{_libdir}/kamailio/libkamailio_ims.so
 %{_libdir}/kamailio/libkamailio_ims.so.0
 %{_libdir}/kamailio/libkamailio_ims.so.0.1
-%doc %{_docdir}/kamailio/modules/README.dialog_ng
-%{_libdir}/kamailio/modules/dialog_ng.so
 %doc %{_docdir}/kamailio/modules/README.ims_auth
 %{_libdir}/kamailio/modules/ims_auth.so
 %doc %{_docdir}/kamailio/modules/README.ims_icscf
@@ -983,181 +983,51 @@ fi
 
 
 %changelog
-* Thu Sep 26 2013 Peter Dunkley <[email protected]>
-  - Updated rel to dev9
-  - Added gzcompress module to .spec
-* Thu Sep 12 2013 Peter Dunkley <[email protected]>
-  - stun no longer depends on OpenSSL so it has been moved to the standard
-    module set
-* Wed Sep 11 2013 Peter Dunkley <[email protected]>
+* Fri Sep 27 2013 Peter Dunkley <[email protected]>
+  - Consolidating changelog for 4.1.0 into a single entry...
+  - Added new modules to main package:
+    - cnxcc
+    - gzcompress
+    - rtpproxy-ng
+    - sipt
+    - stun
+  - Added new packages for new modules:
+    - auth_ephemeral
+    - sctp
+  - Moved existing modules to different packages:
+    - tls to own package
+    - dialog_ng to main package
+    - auth_identity to main package (previously not built for CentOS)
   - Removed Fedora stuff as I am only maintaining this for CentOS now
-  - Updated rel to dev8
-* Thu Aug 22 2013 Peter Dunkley <[email protected]>
-  - Added rtpproxy-ng module to build
-* Wed Aug 14 2013 Peter Dunkley <[email protected]>
-  - Updated rel to dev7
-* Mon May 27 2013 Peter Dunkley <[email protected]>
-  - Created package for auth_ephemeral module
-* Sun May 26 2013 Peter Dunkley <[email protected]>
-  - Created package for sctp module
-  - Updated rel to dev6
-* Sat May 18 2013 Peter Dunkley <[email protected]>
   - Refactored .spec
-  - Put tls module back in its own .spec (OpenSSL no longer needed by core as
-    stun is in its own module)
-  - Updated rel to dev5
-* Wed Apr 24 2013 Peter Dunkley <[email protected]>
-  - Updated rel to dev3
-* Wed Apr 10 2013 Peter Dunkley <[email protected]>
-  - Added sipt module to .spec
-  - Updated rel to dev2
-* Fri Mar 29 2013 Peter Dunkley <[email protected]>
-  - Added stun module to .spec
-  - Updated rel to dev1
-* Wed Mar 27 2013 Peter Dunkley <[email protected]>
-  - Added cnxcc module to .spec
-* Thu Mar 7 2013 Peter Dunkley <[email protected]>
-  - Added build requirement for docbook2X for Fedora builds
-* Wed Mar 6 2013 Peter Dunkley <[email protected]>
-  - Restored perl related files
-* Tue Mar 5 2013 Peter Dunkley <[email protected]>
-  - Updated rel to dev0 and ver to 4.1.0
-  - Re-ordered file to make it internally consistent
   - Updated make commands to match updated module groups
-  - Added auth_identity back in
-  - Temporarily commented out perl related files as perl modules do not appear
-    to be working
-* Sun Jan 20 2013 Peter Dunkley <[email protected]>
-  - Updated rel to pre1
+  - Updated version to 4.1.0
+* Mon Mar 11 2013 Peter Dunkley <[email protected]>
+  - Consolidating changelog for 4.0.0 into a single entry...
+  - Added new modules to main package:
+    - corex
+    - sca
+  - Added new packages for new modules:
+    - cdp (cdp, cdp_avp)
+    - ims (dialog_ng, ims_auth, ims_icscf, ims_isc, ims_qos,
+      ims_registrar_pcscf, ims_registrar_scscf, ims_usrloc_pcscf,
+      ims_usrloc_scscf)
+    - outbound
+    - websocket
+    - xhttp_pi
+  - Moved existing modules to different packages:
+    - Various SER modules added to main package (avp, db2_ops, mangler, timer,
+      uid_auth_db, uid_avp_db, uid_domain, uid_gflags, uid_uri_db, print,
+      print_lib, xprint)
+    - db2_ldap SER module added to ldap package
+    - tls to main package (as OpenSSL was needed in core for STUN)
   - Moved modules from modules_k/ to modules/
   - Renamed perl modules
-* Fri Jan 11 2013 Peter Dunkley <[email protected]>
-  - Updated rel to pre0
-* Thu Jan 10 2013 Peter Dunkley <[email protected]>
-  - More IMS updates
-* Tue Jan 8 2013 Peter Dunkley <[email protected]>
-  - Changed dialog2 to dialog_ng
-  - Renamed all IMS modules (prepended ims_)
-* Sun Jan 6 2013 Peter Dunkley <[email protected]>
-  - Updated ver to 4.0.0 and rel to dev8
-* Mon Dec 31 2012 Peter Dunkley <[email protected]>
-  - Added dialog2 and IMS modules to the build
-* Fri Dec 21 2012 Peter Dunkley <[email protected]>
-  - Added db2_ldap, db2_ops, and timer to the build
-  - Added uid_auth_db, uid_avp_db, uid_domain, uid_gflags, uid_uri_db, print,
-    and print_lib to the build
-* Thu Dec 13 2012 Peter Dunkley <[email protected]>
-  - Added xhttp_pi framework examples to the installation
-  - Added xhttp_pi README to the installation
-* Wed Dec 12 2012 Peter Dunkley <[email protected]>
-  - Added mangler module to the build
-  - Tidied up make commands used to build and install
-* Sun Dec 9 2012 Peter Dunkley <[email protected]>
-  - Updated rel to dev7
-  - Added avp, sca, and xprint modules to the build
-  - Moved xlog from modules_k to modules
-* Fri Nov 9 2012 Peter Dunkley <[email protected]>
-  - Updated rel to dev5
-* Tue Oct 30 2012 Peter Dunkley <[email protected]>
-  - Added xhttp_pi module to RPM builds
-* Fri Oct 20 2012 Peter Dunkley <[email protected]>
-  - Set ownership of /etc/kamailio to kamailio.kamailio
   - Added installation of auth.7.gz for Fedora now that manpages are built for
     Fedora
-  - Added "make utils" to the build section (when it's not there utils get
-    built during the install - which isn't right)
   - SCTP and STUN now included in this build
-  - Removed kamailio-tls package - tls module now in main kamailio RPM as that
-    has openssl as a dependency for STUN
-* Sun Sep 17 2012 Peter Dunkley <[email protected]>
-  - Added corex module to RPM builds
-  - Updated rel to dev4
-* Sun Aug 19 2012 Peter Dunkley <[email protected]>
-  - Updated rel to dev3
-* Mon Aug 13 2012 Peter Dunkley <[email protected]>
-  - Added Outbound module
-* Fri Jul 13 2012 Peter Dunkley <[email protected]>
-  - Updated rel to dev2
-* Thu Jul 5 2012 Peter Dunkley <[email protected]>
-  - Added kamailio-cdp RPM for cdp and cdp_avp modules
-* Tue Jul 3 2012 Peter Dunkley <[email protected]>
-  - Updates to websocket module
-* Sat Jun 30 2012 Peter Dunkley <[email protected]>
-  - Updated rel to dev1
-  - Removed %_sharedir and replaced with standard macro %_datadir
-* Sat Jun 23 2012 Peter Dunkley <[email protected]>
-  - Added websocket module
-* Mon Jun 11 2012 Peter Dunkley <[email protected]>
-  - Updated ver to 3.4.0 and rel to dev0
-* Mon Jun 4 2012 Peter Dunkley <[email protected]>
-  - Added a number of %dir lines to make sure the RPMs are properly cleaned up
-    on uninstall
-* Sat Jun 2 2012 Peter Dunkley <[email protected]>
-  - Added %postun section to reload systemd on Fedora after uninstall
-  - Added build requirement for redhat-rpm-config so debuginfo RPMs get built
-* Fri Jun 1 2012 Peter Dunkley <[email protected]>
-  - Tweak to the pkg/kamailio/fedora directory structure
-  - Tested with Fedora 17
-* Thu May 31 2012 Peter Dunkley <[email protected]>
-  - Updated rel to pre3
-  - Combined Fedora/CentOS .spec in preparation for Fedora 17
-* Sun May 20 2012 Peter Dunkley <[email protected]>
-  - First version created for Kamailio 3.3.0. Based on spec-file for Fedora
-    created by myself (in turn based on an older spec-file for CentOS created
-    by Ovidiu Sas).
-  - Tested with CentOS 6.2 x86_64.
-  - Builds all Kamailio 3.3.0 modules (modules/modules_k) except:
-    - modules/app_mono: Requires mono which is not in the CentOS 6 repo
-    - modules/auth_identity: Conflicts with TLS unless statically linked (which
-      requires changes to Makefile and is impractical for generic RPM building)
-    - modules/db_cassandra: Requires Cassandra and Thrift which are not in the
-      CentOS 6 repo
-    - modules/geoip: Requires GeoIP which is not in the CentOS 6 repo
-    - modules/iptrtpproxy: Needs local copy of iptables source to build
-      (impractical for generic RPM building)
-    - modules/json: Requires json-c whish is not in the CentOS 6 repo
-    - modules/jsonrpc-c: Requires json-c whish is not in the CentOS 6 repo
-    - modules/ndb_redis: Requires hiredis which is not in the CentOS 6 repo
-    - modules/peering: Requires radiusclient-ng which is not in the CentOS 6
-      repo
-    - modules_k/acc_radius: Requires radiusclient-ng which is not in the CentOS
-      6 repo
-    - modules_k/auth_radius: Required radiusclient-ng which is not in the
-      CentOS 6 repo
-    - modules_k/carrierroute: Requires libconfuse which is not in the CentOS 6
-      repo
-    - modules_k/db_oracle: Requires Oracle which is not in the CentOS 6 repo
-      (and is closed-source)
-    - modules_k/memcached: Module compilation appears to require an older
-      version of libmemcached-devel than the one in the CentOS 6 repo
-    - modules_k/mi_xmlrpc: Requires libxmlrpc-c3 which is not in the CentOS 6
-      repo
-    - modules_k/misc_radius: Requires radiusclient-ng which is not in the
-      CentOS 6 repo
-    - modules_k/osp: Requires OSP Toolkit which is not in the CentOS 6 repo
-* Fri May 18 2012 Peter Dunkley <[email protected]>
-  - Added missing BuildRequires (gcc).
-  - Added .fc16 to rel.  This makes it easy to tell which distribution the RPMs
-    are built for.
-* Thu May 17 2012 Peter Dunkley <[email protected]>
-  - Updated rel to pre2.
-* Mon May 7 2012 Peter Dunkley <[email protected]>
-  - Changed to use systemd instead of SysV init.
-* Sun May 6 2012 Peter Dunkley <[email protected]>
-  - First version created for Kamailio 3.3.0. Based on spec-file for CentOS
-    created by Ovidiu Sas.
-  - Tested with Fedora 16 x86_64.
-  - Builds all Kamailio 3.3.0 modules (modules/modules_k) except:
-    - modules/auth_identity: Conflicts with TLS unless statically linked (which
-      requires changes to Makefile and is impractical for generic RPM building)
-    - modules/db_cassandra: Requires Thrift which is not in the F16 repo
-    - modules/iptrtpproxy: Needs local copy of iptables source to build
-      (impractical for generic RPM building)
-    - modules_k/db_oracle: Requires Oracle which is not in the F16 repo
-      (and is closed-source)
-    - modules_k/memcached: Module compilation appears to require an older
-      version of libmemcached-devel than the one in the F16 repo
-    - modules_k/mi_xmlrpc: The F16 repo contains an unsupported version of
-      libxmlrpc-c3, and there is an compilation error due to the module code
-      using an unknown type ('TString')
-    - modules_k/osp: Requires OSP Toolkit which is not in the F16 repo
+  - Refactored .spec
+  - Updated ver to 4.0.0
+* Mon Jun 18 2012 Peter Dunkley <[email protected]>
+  - Consolidating changelog for 3.3.0 into a single entry...
+  - See revision control for details this far back

+ 17 - 2
pkg/kamailio/centos/6/kamailio.sysconfig

@@ -2,14 +2,29 @@
 # Kamailio startup options
 #
 
+# Set to yes to enable kamailio, once configured properly.
+RUN_KAMAILIO=yes
+
 # User to run as
 USER=kamailio
 
 # Group to run as
 GROUP=kamailio
 
-# Amount of shared memory to allocate for Kamailio (in Mb)
-MEMORY=32
+# Amount of shared memory to allocate for the running Kamailio server (in Mb)
+SHM_MEMORY=64
 
 # Amount of per-process (package) memory to allocate for Kamailio (in Mb)
 PKG_MEMORY=4
+
+# Enable the server to leave a core file when it crashes.
+# Set this to 'yes' to enable kamailio to leave a core file when it crashes
+# or 'no' to disable this feature. This option is case sensitive and only
+# accepts 'yes' and 'no' and only in lowercase letters.
+# On some systems (e.g. Ubuntu 6.10, Debian 4.0) it is necessary to specify
+# a directory for the core files to get a dump. Look into the kamailio
+# init file for an example configuration.
+DUMP_CORE=no
+
+# Add extra command line parameters in the EXTRA_OPTIONS variable
+# EXTRA_OPTIONS="-a no"