OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall
Root: /v/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-src Date: 09-Aug-2008 12:15:49
Branch: HEAD Handle: 2008080911154800
Added files:
openpkg-src/opensips fsl.opensips opensips.cfg opensips.patch
opensips.schema-dbtext.txt opensips.spec
rc.opensips
Log:
new package: opensips 1.4.0 (Open SIP Express Router)
Summary:
Revision Changes Path
1.1 +16 -0 openpkg-src/opensips/fsl.opensips
1.1 +198 -0 openpkg-src/opensips/opensips.cfg
1.1 +95 -0 openpkg-src/opensips/opensips.patch
1.1 +8 -0 openpkg-src/opensips/opensips.schema-dbtext.txt
1.1 +249 -0 openpkg-src/opensips/opensips.spec
1.1 +75 -0 openpkg-src/opensips/rc.opensips
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-src/opensips/fsl.opensips
============================================================================
$ cvs diff -u -r0 -r1.1 fsl.opensips
--- /dev/null 2008-08-09 12:15:42 +0200
+++ fsl.opensips 2008-08-09 12:15:48 +0200
@@ -0,0 +1,16 @@
+##
+## fsl.opensips -- OSSP fsl configuration
+##
+
+ident .*(opensips)/.+ q{
+ prefix(
+ prefix="%b %d %H:%M:%S %N <%L> $1[%P]: "
+ )
+ -> {
+ debug: file(
+ path="@l_prefix@/var/opensips/opensips.log",
+ perm=0664
+ )
+ }
+};
+
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/opensips/opensips.cfg
============================================================================
$ cvs diff -u -r0 -r1.1 opensips.cfg
--- /dev/null 2008-08-09 12:15:42 +0200
+++ opensips.cfg 2008-08-09 12:15:48 +0200
@@ -0,0 +1,198 @@
+##
+## opensips.cfg -- OpenSIPS server configuration
+##
+
+#
+# GLOBAL CONFIGURATION PARAMETERS
+#
+
+# process configuration
+debug=1
+log_stderror=no
+fork=yes
+check_via=no
+dns=no
+rev_dns=no
+children=4
+user="@l_rusr@"
+group="@l_rgrp@"
+fifo="@l_prefix@/var/opensips/opensips.fifo"
+workdir="@l_prefix@/var/opensips"
+
+# network configuration
+alias="sip.example.com"
+listen="127.0.0.1"
+port=5060
+
+#
+# EXTENSION MODULE LOADING
+#
+
+#loadmodule "@l_prefix@/lib/opensips/modules/dbtext.so"
+
+loadmodule "@l_prefix@/lib/opensips/modules/sl.so"
+loadmodule "@l_prefix@/lib/opensips/modules/tm.so"
+loadmodule "@l_prefix@/lib/opensips/modules/rr.so"
+loadmodule "@l_prefix@/lib/opensips/modules/maxfwd.so"
+loadmodule "@l_prefix@/lib/opensips/modules/usrloc.so"
+loadmodule "@l_prefix@/lib/opensips/modules/registrar.so"
+loadmodule "@l_prefix@/lib/opensips/modules/textops.so"
+
+#loadmodule "@l_prefix@/lib/opensips/modules/auth.so"
+#loadmodule "@l_prefix@/lib/opensips/modules/auth_db.so"
+
+#loadmodule "@l_prefix@/lib/opensips/modules/nathelper.so"
+
+#
+# EXTENSION MODULE CONFIGURATION
+#
+
+# module rr:
+modparam("rr", "enable_full_lr", 1)
+
+# module usrloc:
+modparam("usrloc", "db_mode", 0)
+#modparam("usrloc", "db_mode", 2)
+#modparam("usrloc|auth_db", "db_url", "dbtext://@l_prefix@/var/opensips/db")
+
+# module auth:
+#modparam("auth_db", "calculate_ha1", 1)
+#modparam("auth_db", "password_column", "password")
+#modparam("auth_db", "user_column", "username")
+#modparam("auth_db", "domain_column", "domain")
+
+# module nathelper:
+#modparam("registrar", "nat_flag", 6)
+#modparam("nathelper", "natping_interval", 30)
+#modparam("nathelper", "ping_nated_only", 1)
+#modparam("nathelper", "rtpproxy_sock",
"unix:@l_prefix@/var/opensips/opensips_rtpproxy.sock")
+#modparam("nathelper", "rtpproxy_disable", 0)
+#modparam("nathelper", "rtpproxy_disable_tout", 20)
+#modparam("nathelper", "sipping_from", "sip:[EMAIL PROTECTED]")
+
+#
+# MAIN ROUTING LOGIC
+#
+
+route{
+ # initial sanity checks -- messages with
+ # max_forwards==0, or excessively long requests
+ if (!mf_process_maxfwd_header("10")) {
+ sl_send_reply("483", "Too Many Hops");
+ exit;
+ };
+ if (msg:len >= max_len) {
+ sl_send_reply("513", "Message too big");
+ exit;
+ };
+
+ #if (method == "INVITE" && uri != myself) {
+ # sl_send_reply("403", "No relaying");
+ # exit;
+ #};
+
+ # NAT: special handling for NAT'ed clients; first, NAT test is
+ # executed: it looks for via!=received and RFC1918 addresses in
+ # Contact (may fail if line-folding is used); also, the received
+ # test should, if completed, should check all vias for presence of
+ # received.
+ #if (nat_uac_test("3")) {
+ # # allow RR-ed requests, as these may indicate that NAT-enabled
+ # # aproxy takes care of it; unless it is REGISTER
+ # if (method == "REGISTER" || ! search("^Record-Route:")) {
+ # log("LOG: Someone trying to register from private IP,
rewriting\n");
+ # fix_nated_contact(); # rewrite contact with source IP of
signalling
+ # if (method == "INVITE") {
+ # fix_nated_sdp("1"); # add direction=active to SDP
+ # };
+ # force_rport(); # add rport parameter to topmost Via
+ # setflag(6); # mark as NAT'ed
+ # };
+ #};
+
+ # we record-route all messages -- to make sure that
+ # subsequent messages will go through our proxy; that's
+ # particularly good if upstream and downstream entities
+ # use different transport protocol
+ if (method != "REGISTER") {
+ record_route();
+ };
+
+ # subsequent messages withing a dialog should take the
+ # path determined by record-routing
+ if (loose_route()) {
+ # mark routing logic in request
+ append_hf("P-hint: rr-enforced\r\n");
+ route(1);
+ };
+
+ if (uri != myself) {
+ # mark routing logic in request
+ append_hf("P-hint: outbound\r\n");
+ route(1);
+ };
+
+ # if the request is for other domain use USRLOC
+ # (in case, it does not work, use the following command
+ # with proper names and addresses in it)
+ if (uri == myself) {
+ if (method == "REGISTER") {
+ # uncomment this if you want to use digest authentication
+ #if (!www_authorize("sip.example.com", "subscriber")) {
+ # www_challenge("sip.example.com", "0");
+ # exit;
+ #};
+ save("location");
+ exit;
+ };
+
+ lookup("aliases");
+ if (uri != myself) {
+ append_hf("P-hint: outbound alias\r\n");
+ route(1);
+ };
+
+ # native SIP destinations are handled using our USRLOC DB
+ if (!lookup("location")) {
+ sl_send_reply("404", "Not Found");
+ exit;
+ };
+ append_hf("P-hint: usrloc applied\r\n");
+ };
+
+ route(1);
+}
+
+route[1] {
+ # disable RFC1918 peers
+ if (uri =~ "[@:](192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.)" &&
!search("^Route:")) {
+ sl_send_reply("479", "We don't forward to RFC 1918 IPv4 addresses");
+ exit;
+ };
+
+ # NAT: if client or server know to be behind a NAT, enable relay
+ #if (isflagset(6)) {
+ # force_rtp_proxy();
+ #};
+
+ # NAT: processing of replies; apply to all transactions
+ #t_on_reply("1");
+
+ # send it out now; use stateful forwarding as it works reliably even
for UDP2TCP
+ if (!t_relay()) {
+ sl_reply_error();
+ };
+}
+
+#onreply_route[1] {
+ # NAT: is it a NAT'ed transaction ?
+ # otherwise, is it a transaction behind a NAT and we did not
+ # know at time of request processing ? (RFC1918 contacts)
+ #if (isflagset(6) && status =~ "(183)|2[0-9][0-9]") {
+ # fix_nated_contact();
+ # force_rtp_proxy();
+ #} else if (nat_uac_test("1")) {
+ # fix_nated_contact();
+ #};
+#}
+
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/opensips/opensips.patch
============================================================================
$ cvs diff -u -r0 -r1.1 opensips.patch
--- /dev/null 2008-08-09 12:15:42 +0200
+++ opensips.patch 2008-08-09 12:15:48 +0200
@@ -0,0 +1,95 @@
+Index: Makefile.defs
+--- Makefile.defs.orig 2008-08-03 16:02:20 +0200
++++ Makefile.defs 2008-08-09 11:59:33 +0200
+@@ -1068,6 +1068,8 @@
+
+ endif #mode=release
+
++LDFLAGS += -L$(prefix)/lib
++LIBS += -lfsl
+
+ #*FLAGS used for compiling the modules
+ ifeq ($(CC_NAME), gcc)
+@@ -1304,8 +1306,8 @@
+
+ #add libssl if needed
+ ifneq ($(TLS),)
+-DEFS+= -I$(LOCALBASE)/ssl/include -I$(LOCALBASE)/include
-I$(SYSBASE)/include/openssl
+-LIBS+= -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib -lssl -lcrypto
++DEFS+= -I$(prefix)/include
++LIBS+= -L$(prefix)/lib -lssl -lcrypto
+ endif
+
+ #add libsctp if needed
+Index: modules/permissions/parse_config.c
+--- modules/permissions/parse_config.c.orig 2008-08-03 15:54:01 +0200
++++ modules/permissions/parse_config.c 2008-08-09 11:58:55 +0200
+@@ -114,8 +114,11 @@
+ except = strstr(str, " EXCEPT ");
+ if (except) {
+ /* exception found */
+- strncpy(str2, str, except-str);
+- str2[except-str] = '\0';
++ int l = except - str;
++ if (l > sizeof(str2) - 1)
++ l = sizeof(str2) - 1;
++ strncpy(str2, str, l);
++ str2[l] = '\0';
+ /* except+8 points to the exception */
+ if (parse_expression_list(except+8, e_exceptions)) {
+ /* error */
+@@ -124,7 +127,8 @@
+ }
+ } else {
+ /* no exception */
+- strcpy(str2, str);
++ strncpy(str2, str, sizeof(str2)-1);
++ str2[sizeof(str2)-1] = '\0';
+ *e_exceptions = NULL;
+ }
+
+Index: rtpproxy-1.1/main.c
+--- rtpproxy-1.1/main.c.orig 2008-06-17 05:19:48 +0200
++++ rtpproxy-1.1/main.c 2008-08-09 11:58:55 +0200
+@@ -86,7 +86,11 @@
+ bindhost = NULL;
+
+ if ((n = resolve(ia, pf, bindhost, servname, AI_PASSIVE)) != 0)
++#if defined(__sun__)
++ errx(1, "setbindhost");
++#else
+ errx(1, "setbindhost: %s", gai_strerror(n));
++#endif
+ }
+
+ static void
+@@ -352,7 +356,7 @@
+ if (cf->umode == 0) {
+ unlink(cmd_sock);
+ memset(&ifsun, '\0', sizeof ifsun);
+-#if !defined(__linux__) && !defined(__solaris__)
++#if !defined(__linux__) && !defined(__sun__)
+ ifsun.sun_len = strlen(cmd_sock);
+ #endif
+ ifsun.sun_family = AF_LOCAL;
+@@ -685,7 +689,7 @@
+
+ controlfd = init_controlfd(&cf);
+
+-#if !defined(__solaris__)
++#if !defined(__sun__)
+ if (cf.nodaemon == 0) {
+ if (daemon(0, 0) == -1)
+ err(1, "can't switch into daemon mode");
+Index: rtpproxy-1.1/rtpp_util.h
+--- rtpproxy-1.1/rtpp_util.h.orig 2008-04-02 00:32:03 +0200
++++ rtpproxy-1.1/rtpp_util.h 2008-08-09 11:58:55 +0200
+@@ -92,7 +92,7 @@
+ #define DEFFILEMODE
(S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
+ #endif
+
+-#if defined(__solaris__)
++#if defined(__sun__)
+ #define err(exitcode, format, args...) \
+ errx(exitcode, format ": %s", ## args, strerror(errno))
+ #define errx(exitcode, format, args...) \
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/opensips/opensips.schema-dbtext.txt
============================================================================
$ cvs diff -u -r0 -r1.1 opensips.schema-dbtext.txt
--- /dev/null 2008-08-09 12:15:42 +0200
+++ opensips.schema-dbtext.txt 2008-08-09 12:15:48 +0200
@@ -0,0 +1,8 @@
+subscriber: username(str) domn(str) password(str) first_name(str)
last_name(str) phone(str) email_address(str) datetime_created(int)
datetime_modified(int) confirmation(str) flag(str) sendnotification(str)
greeting(str) ha1(str) ha1b(str) perms(str) allow_find(str) timezone(str,null)
rpid(str,null) uuid(str,null)
+subscriber: admin:default:admin:Initial:Admin:123:[EMAIL
PROTECTED]:::::::::::::
+location: username(str) domain(str,null) contact(str,null) expires(int,null)
q(double,null) callid(str,null) cseq(int,null) last_modified(str)
replicate(int,null) state(int,null) flags(int) user_agent(str) received(str)
+aliases: username(str) domain(str,null) contact(str,null) expires(int,null)
q(double,null) callid(str,null) cseq(int,null) last_modified(str)
replicate(int,null) state(int,null) flags(int) user_agent(str) received(str)
+version: table_name(str) table_version(int)
+version: subscriber:3
+version: location:6
+version: aliases:6
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/opensips/opensips.spec
============================================================================
$ cvs diff -u -r0 -r1.1 opensips.spec
--- /dev/null 2008-08-09 12:15:42 +0200
+++ opensips.spec 2008-08-09 12:15:49 +0200
@@ -0,0 +1,249 @@
+##
+## opensips.spec -- OpenPKG RPM Package Specification
+## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
+##
+## Permission to use, copy, modify, and distribute this software for
+## any purpose with or without fee is hereby granted, provided that
+## the above copyright notice and this permission notice appear in all
+## copies.
+##
+## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+## SUCH DAMAGE.
+##
+
+# package options
+%define V_opensips 1.4.0
+%define V_rtpproxy 1.1
+
+# package information
+Name: opensips
+Summary: Open SIP Express Router
+URL: http://www.opensips.org/
+Vendor: FhG FOKUS et al.
+Packager: OpenPKG Foundation e.V.
+Distribution: OpenPKG Community
+Class: PLUS
+Group: VoIP
+License: GPL
+Version: %{V_opensips}
+Release: 20080809
+
+# package options
+%option with_fsl yes
+%option with_ssl no
+
+# list of sources
+Source0:
http://www.opensips.org/pub/opensips/%{version}/src/opensips-%{V_opensips}-tls_src.tar.gz
+Source1: http://b2bua.org/chrome/site/rtpproxy-%{V_rtpproxy}.tar.gz
+Source2: rc.opensips
+Source3: fsl.opensips
+Source4: opensips.cfg
+Source5: opensips.schema-dbtext.txt
+Patch0: opensips.patch
+
+# build information
+Prefix: %{l_prefix}
+BuildRoot: %{l_buildroot}
+BuildPreReq: OpenPKG, openpkg >= 20060823, make, gcc, flex, bison, sed
+PreReq: OpenPKG, openpkg >= 20060823
+%if "%{with_fsl}" == "yes"
+BuildPreReq: fsl
+PreReq: fsl
+%endif
+%if "%{with_ssl}" == "yes"
+BuildPreReq: openssl
+PreReq: openssl
+%endif
+AutoReq: no
+AutoReqProv: no
+
+%description
+ OpenSIPS is a project spawned from FhG FOKUS SIP Express Router
+ (SER). It provides SIP (RFC3621) registrar, proxy and routing
+ functionality. A C shell like scripting language provides full
+ control over the server's behaviour. It's modular architecture
+ allows only required functionality to be loaded.
+
+%track
+ prog opensips = {
+ version = %{V_opensips}
+ url = http://www.opensips.org/pub/opensips/
+ regex = (\d+\.\d+\.\d+)/
+ url = http://www.opensips.org/pub/opensips/__NEWVER__/src/
+ regex = opensips-(__VER__)-tls_src\.tar\.gz
+ }
+ prog opensips:rtpproxy = {
+ version = %{V_rtpproxy}
+ url = http://www.rtpproxy.org/
+ regex = rtpproxy-(__VER__)\.tar\.gz
+ }
+
+%prep
+ %setup -q -n opensips-%{version}-tls
+ %setup -q -n opensips-%{version}-tls -T -D -a 1
+ %patch -p0
+
+%build
+ # build dependencies
+ %{l_make} %{l_mflags} \
+ CC="%{l_cc}" \
+%if "%{with_ssl}" == "yes"
+ TLS=1 \
+%endif
+ prefix=%{l_prefix} \
+ dep >/dev/null 2>&1 || true
+
+ # build program
+ %{l_make} %{l_mflags} \
+ CC="%{l_cc}" \
+%if "%{with_ssl}" == "yes"
+ TLS=1 \
+%endif
+ prefix=%{l_prefix}
+
+ # build modules
+ %{l_make} %{l_mflags} \
+ CC="%{l_cc}" \
+%if "%{with_ssl}" == "yes"
+ TLS=1 \
+%endif
+ prefix=%{l_prefix} \
+ modules \
+ skip_modules="mysql jabber"
+
+ # build rtpproxy extension
+ ( cd rtpproxy-%{V_rtpproxy}
+ export CC="%{l_cc}"
+ export CFLAGS="%{l_cflags -O}"
+ export LIBS=""
+ case "%{l_platform -t}" in
+ *-sunos* ) LIBS="$LIBS -lsocket -lnsl -lrt" ;;
+ esac
+ ./configure
+ %{l_make} %{l_mflags}
+ ) || exit $?
+
+%install
+ rm -rf $RPM_BUILD_ROOT
+
+ # install program
+ %{l_make} %{l_mflags} \
+ INSTALL="%{l_shtool} install%{l_nil} -c" \
+ basedir=$RPM_BUILD_ROOT \
+ prefix=%{l_prefix} \
+ cfg-prefix=$RPM_BUILD_ROOT \
+ cfg-target=%{l_prefix}/etc/opensips/ \
+ doc-dir=share/opensips/doc/ \
+ man-dir=man/ \
+ install
+
+ # install modules
+ %{l_make} %{l_mflags} \
+ INSTALL="%{l_shtool} install%{l_nil} -c" \
+ basedir=$RPM_BUILD_ROOT \
+ prefix=%{l_prefix} \
+ cfg-prefix=$RPM_BUILD_ROOT \
+ cfg-target=%{l_prefix}/etc/opensips/ \
+ doc-dir=share/opensips/doc/ \
+ man-dir=man/ \
+ install-modules \
+ skip_modules="mysql jabber"
+
+ # install rtpproxy extension
+ %{l_shtool} install -c -s -m 755 \
+ rtpproxy-%{V_rtpproxy}/rtpproxy
$RPM_BUILD_ROOT%{l_prefix}/sbin/opensips_rtpproxy
+
+ # strip down installation
+ strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
+ rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/opensips_mysql.sh
+
+ # post-adjust installation
+ %{l_shtool} subst \
+ -e
's;/etc/opensips/opensipsctlrc;%{l_prefix}/etc/opensips/opensipsctlrc;g' \
+ $RPM_BUILD_ROOT%{l_prefix}/sbin/opensipsctl
+ %{l_shtool} install -c -m 644 \
+ -e 's;^# \(PID_FILE\)=.*;\1=%{l_prefix}/var/opensips/opensips.pid;' \
+ -e 's;^#
\(OSIPS_FIFO\)=.*;\1=%{l_prefix}/var/opensips/opensips.fifo;' \
+ scripts/opensipsctlrc \
+ $RPM_BUILD_ROOT%{l_prefix}/etc/opensips/opensipsctlrc
+
+ # install default configuration
+ %{l_shtool} mkdir -f -p -m 755 \
+ $RPM_BUILD_ROOT%{l_prefix}/etc/opensips
+ %{l_shtool} install -c -m 755 %{l_value -s -a} \
+ %{SOURCE opensips.cfg} \
+ $RPM_BUILD_ROOT%{l_prefix}/etc/opensips/
+
+ # install OSSP fsl configuration
+ %{l_shtool} mkdir -f -p -m 755 \
+ $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
+ %{l_shtool} install -c -m 644 %{l_value -s -a} \
+ %{SOURCE fsl.opensips} \
+ $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
+
+ # install run-command script
+ %{l_shtool} mkdir -f -p -m 755 \
+ $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
+ %{l_shtool} install -c -m 755 %{l_value -s -a} \
+ %{SOURCE rc.opensips} \
+ $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
+
+ # create database directory and install database schema definitions
+ %{l_shtool} mkdir -f -p -m 755 \
+ $RPM_BUILD_ROOT%{l_prefix}/var/opensips
+ %{l_shtool} install -c -m 644 \
+ %{SOURCE opensips.schema-dbtext.txt} \
+ $RPM_BUILD_ROOT%{l_prefix}/share/opensips/
+
+ # determine installation files
+ %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
+ %{l_files_std} \
+ '%config %{l_prefix}/etc/fsl/*' \
+ '%config %{l_prefix}/etc/opensips/*' \
+ '%doc %{l_prefix}/share/opensips/doc/*' \
+ '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/opensips'
+
+%files -f files
+
+%clean
+ rm -rf $RPM_BUILD_ROOT
+
+%post
+ # on install, setup database
+ if [ ! -d $RPM_INSTALL_PREFIX/var/opensips/db ]; then
+ mkdir $RPM_INSTALL_PREFIX/var/opensips/db
+ chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/opensips/db
+ chmod 755 $RPM_INSTALL_PREFIX/var/opensips/db
+
schema="$RPM_INSTALL_PREFIX/share/opensips/opensips.schema-dbtext.txt"
+ for table in `sed -e '/^#.*/d' -e '/^$/d' -e 's;\([^:]*\):.*;\1;'
<$schema | sort -u`; do
+ grep "^${table}:" $schema | sed -e "s;^${table}: *;;" \
+ >$RPM_INSTALL_PREFIX/var/opensips/db/$table
+ done
+ chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/opensips/db/*
2>/dev/null || true
+ chmod 644 $RPM_INSTALL_PREFIX/var/opensips/db/* 2>/dev/null || true
+ fi
+
+ # after upgrade, restart service
+ [ $1 -eq 2 ] || exit 0
+ eval `%{l_rc} opensips status 2>/dev/null`
+ [ ".$opensips_active" = .yes ] && %{l_rc} opensips restart
+ exit 0
+
+%preun
+ # before erase, stop service and remove log files
+ [ $1 -eq 0 ] || exit 0
+ %{l_rc} opensips stop 2>/dev/null
+ rm -rf $RPM_INSTALL_PREFIX/var/opensips/db 2>/dev/null || true
+ rm -f $RPM_INSTALL_PREFIX/var/opensips/* 2>/dev/null || true
+ exit 0
+
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/opensips/rc.opensips
============================================================================
$ cvs diff -u -r0 -r1.1 rc.opensips
--- /dev/null 2008-08-09 12:15:42 +0200
+++ rc.opensips 2008-08-09 12:15:49 +0200
@@ -0,0 +1,75 @@
[EMAIL PROTECTED]@/bin/openpkg rc
+##
+## rc.opensips -- Run-Commands
+##
+
+%config
+ opensips_enable="$openpkg_rc_def"
+ opensips_flags=""
+ opensips_rtpproxy="yes"
+ opensips_log_prolog="true"
+ opensips_log_epilog="true"
+ opensips_log_numfiles="10"
+ opensips_log_minsize="1M"
+ opensips_log_complevel="9"
+
+%common
+ opensips_cfgfile="@l_prefix@/etc/opensips/opensips.cfg"
+ opensips_pidfile="@l_prefix@/var/opensips/opensips.pid"
+ opensips_rtpproxy_pidfile="@l_prefix@/var/opensips/opensips_rtpproxy.pid"
+ opensips_rtpproxy_socket="@l_prefix@/var/opensips/opensips_rtpproxy.sock"
+ opensips_rtpproxy_listen=`grep '^listen=' $opensips_cfgfile | sed -e
's/^listen="\(.*\)".*/\1/'`
+ opensips_rtpproxy_signal () {
+ [ -f $opensips_rtpproxy_pidfile ] && kill -$1 `cat
$opensips_rtpproxy_pidfile`
+ }
+
+%status -u @l_susr@ -o
+ opensips_usable="no"
+ opensips_active="no"
+ if @l_prefix@/sbin/opensips -c >/dev/null 2>&1; then
+ opensips_usable="yes"
+ fi
+ if @l_prefix@/sbin/opensipsctl ps >/dev/null 2>&1; then
+ opensips_active="yes"
+ fi
+ echo "opensips_enable=\"$opensips_enable\""
+ echo "opensips_usable=\"$opensips_usable\""
+ echo "opensips_active=\"$opensips_active\""
+
+%start -u @l_susr@
+ rcService opensips enable yes || exit 0
+ rcService opensips active yes && exit 0
+ if rcVarIsYes opensips_rtpproxy; then
+ cmd="@l_prefix@/sbin/opensips_rtpproxy" \
+ cmd="$cmd -l $opensips_rtpproxy_listen"
+ cmd="$cmd -s unix:$opensips_rtpproxy_socket"
+ cmd="$cmd -p $opensips_rtpproxy_pidfile"
+ su @l_rusr@ -c "$cmd"
+ fi
+ @l_prefix@/sbin/opensips \
+ -P $opensips_pidfile \
+ ${opensips_flags}
+
+%stop -u @l_susr@
+ rcService opensips enable yes || exit 0
+ rcService opensips active no && exit 0
+ @l_prefix@/sbin/opensipsctl stop
+ if rcVarIsYes opensips_rtpproxy; then
+ opensips_rtpproxy_signal TERM
+ fi
+ sleep 2
+
+%restart -u @l_susr@
+ rcService opensips enable yes || exit 0
+ rcService opensips active no && exit 0
+ rc opensips stop start
+
+%daily -u @l_susr@
+ rcService opensips enable yes || exit 0
+ shtool rotate -f \
+ -n ${opensips_log_numfiles} -s ${opensips_log_minsize} -d \
+ -z ${opensips_log_complevel} -m 644 -o @l_rusr@ -g @l_rgrp@ \
+ -P "${opensips_log_prolog}" \
+ -E "${opensips_log_epilog}; rc opensips reload" \
+ @l_prefix@/var/opensips/opensips.log
+
@@ .
______________________________________________________________________
OpenPKG http://openpkg.org
CVS Repository Commit List [email protected]