[Pkg-voip-commits] r2189 - in yxa/trunk/debian: . examples patches

Mikael Magnusson mikma-guest at costa.debian.org
Sat Aug 5 23:12:19 UTC 2006


Author: mikma-guest
Date: 2006-08-05 23:12:18 +0000 (Sat, 05 Aug 2006)
New Revision: 2189

Added:
   yxa/trunk/debian/examples/
   yxa/trunk/debian/examples/appserver.config
   yxa/trunk/debian/examples/incomingproxy.config
   yxa/trunk/debian/examples/outgoingproxy.config
   yxa/trunk/debian/examples/pstnproxy.config
   yxa/trunk/debian/examples/secrets.config
   yxa/trunk/debian/examples/sipuserdb.config
   yxa/trunk/debian/examples/yxa.config
   yxa/trunk/debian/patches/net_util.dpatch
   yxa/trunk/debian/patches/yxa_yaws.dpatch
   yxa/trunk/debian/patches/yxa_yaws_makefile.dpatch
   yxa/trunk/debian/postinst
   yxa/trunk/debian/postrm
   yxa/trunk/debian/preinst
   yxa/trunk/debian/prerm
   yxa/trunk/debian/yxa.default
   yxa/trunk/debian/yxa.examples
   yxa/trunk/debian/yxa.init
   yxa/trunk/debian/yxa.install
   yxa/trunk/debian/yxa.logrotate
   yxa/trunk/debian/yxa_yaws
Modified:
   yxa/trunk/debian/README.Debian
   yxa/trunk/debian/changelog
   yxa/trunk/debian/control
   yxa/trunk/debian/dirs
   yxa/trunk/debian/patches/00list
   yxa/trunk/debian/patches/yaws-fqdn.dpatch
   yxa/trunk/debian/rules
Log:
Pre-depend on adduser, used in preinst.
Update description.
Add yxa user in preinst.
Modify permissions and bootstrap incomingproxy database in postinst.
Delete yxa user during purge in postrm.
Depend on yaws, used as embedded web server.
Removed patch: init_mnesia
Added patches:
  * net_util: Wait for Mnesia database nodes during application start.
  * yxa_yaws_makefile, yxa_yaws: Embedded yaws web server interface.
Install logrotate, examples, init script


Modified: yxa/trunk/debian/README.Debian
===================================================================
--- yxa/trunk/debian/README.Debian	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/README.Debian	2006-08-05 23:12:18 UTC (rev 2189)
@@ -1,7 +1,7 @@
 yxa for Debian
 --------------
 
-The YXA sip server need to be bootstrapped once and started
-manually, see /usr/share/doc/yxa/README.gz for more information.
+The YXA sip servers need to be manually configured, and enabled. 
+See /usr/share/doc/yxa/README.gz for information on how to configure.
 
- -- Mikael Magnusson <mikma at users.sourceforge.net>, Thu, 27 Jul 2006 21:01:25 +0200
+ -- Mikael Magnusson <mikma at users.sourceforge.net>, Fri,  4 Aug 2006 12:04:12 +0200

Modified: yxa/trunk/debian/changelog
===================================================================
--- yxa/trunk/debian/changelog	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/changelog	2006-08-05 23:12:18 UTC (rev 2189)
@@ -2,5 +2,5 @@
 
   * Initial release (Closes: #377617)
 
- -- Mikael Magnusson <mikma at users.sourceforge.net>  Thu, 27 Jul 2006 21:05:25 +0200
+ --
 

Modified: yxa/trunk/debian/control
===================================================================
--- yxa/trunk/debian/control	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/control	2006-08-05 23:12:18 UTC (rev 2189)
@@ -5,18 +5,43 @@
 Uploaders: Kilian Krause <kilian at debian.org>, Jose Carlos Garcia Sogo <jsogo at debian.org>, Mark Purcell <msp at debian.org>, Mikael Magnusson <mikma at users.sourceforge.net>
 Build-Depends: debhelper (>= 5), dpatch, autotools-dev, erlang-base
  (>= 1:11.b.0) | erlang-base-hipe (>= 1:11.b.0), erlang-dev (>=
- 1:11.b.0), erlang-nox (>= 1:11.b.0)
+ 1:11.b.0), erlang-nox (>= 1:11.b.0), yaws (>= 1.56)
 Standards-Version: 3.7.2
 
 Package: yxa
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}, erlang-base (>= 1:11.b.0)
- | erlang-base-hipe (>= 1:11.b.0), erlang-nox (>= 1:11.b.0)
-Description: SIP servers written in Erlang
- YXA is a set of SIP servers written in Erlang.
+ | erlang-base-hipe (>= 1:11.b.0), erlang-nox (>= 1:11.b.0), yaws (>= 1.56)
+Pre-Depends: adduser
+Description: SIP software written in Erlang
+ Yxa is SIP software written in Erlang  (Erlang is a programming language
+ written by Ericsson).
  .
- Applications included are:
+ Yxa is both a transaction stateful SIP stack, and a set of SIP server
+ applications.
  .
+ Main features
+ .
+    * RFC3261 compliant SIP-server, capable of everything a generic
+      domain needs :
+          o Registrar that keeps track of your users
+          o Handles incoming SIP requests to your domain
+          o Handles routing of requests from your users to remote domains
+          o TCP, UDP and TLS (including SIPS) support
+          o Automatically maps e-mail addresses of your users to their
+            SIP addresses, if you have the e-mail addresses in LDAP
+          o Handles multiple domains using a single server instance 
+    * ENUM support for PSTN-bypass whenever possible
+    * IPv6 support
+    * Forking, both parallel and sequential
+    * CPL (RFC3880) support for advanced user-control of events (currently
+      incoming calls only)
+    * Modular user database, currently with LDAP, Mnesia, MySQL and
+      text-file backends
+    * PSTN destination access control (per user or for anonymous users)
+ .
+ Included applications:
+ .
   * incomingproxy:
     Handles registrations and proxies requests. Implements partial ENUM
     and LDAP searches. Handles most everything you need to set up SIP for your
@@ -30,3 +55,6 @@
  .
   * appserver:
     Provides basic forking and CPL script interpretation.
+ .
+  * yxa_yaws:
+    Embedded web server interface.

Modified: yxa/trunk/debian/dirs
===================================================================
--- yxa/trunk/debian/dirs	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/dirs	2006-08-05 23:12:18 UTC (rev 2189)
@@ -1,2 +1,8 @@
-usr/bin
-usr/sbin
+etc/yxa
+var/run/yxa
+var/lib/yxa
+var/lib/yxa/db
+var/lib/yxa/db/incomingproxy
+var/lib/yxa/db/appserver
+var/lib/yxa/db/outgoingproxy
+var/lib/yxa/db/pstnproxy

Added: yxa/trunk/debian/examples/appserver.config
===================================================================
--- yxa/trunk/debian/examples/appserver.config	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/examples/appserver.config	2006-08-05 23:12:18 UTC (rev 2189)
@@ -0,0 +1,18 @@
+%%%
+%%% appserver.config
+%%%
+%%% appserver configuration example
+%%%
+
+[{appserver, [{sipauth_realm, "example.com"},
+	      {sipauth_password, "secret"},
+	      {logger_logbasename, "/var/log/appserver"},
+	      {internal_to_e164, [{"^00(.+)$", "+\\1"},
+				  {"^0(.+)$", "+46\\1"},
+				  {"^(.+)$", "+468\\1"}
+				 ]},
+	      {databaseservers, ['incomingproxy at sip-incoming.example.com']},
+	      {myhostnames, ["appserver.example.com", "10.10.1.1"]},
+	      {record_route, true},
+	      {listenport, 5070}
+             ]}].

Added: yxa/trunk/debian/examples/incomingproxy.config
===================================================================
--- yxa/trunk/debian/examples/incomingproxy.config	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/examples/incomingproxy.config	2006-08-05 23:12:18 UTC (rev 2189)
@@ -0,0 +1,26 @@
+%%%
+%%% incomingproxy.config
+%%%
+%%% incomingproxy configuration example
+%%%
+
+[{incomingproxy, [{sipauth_realm, "example.com"},
+                  {sipauth_password, "secret"},
+                  {defaultroute, "other-sipserver.example.com"},
+                  {logger_logbasename, "/var/log/incomingproxy"},
+                  {internal_to_e164, [{"^00(.+)$", "+\\1"},
+                                      {"^0(.+)$", "+46\\1"},
+                                      {"^(.+)$", "+468\\1"}
+                                     ]},
+		  {e164_to_pstn, [{"^\\+468([1-9][0-9]+)$", "00\\1 at pstnproxy.example.com"},
+				  {"^\\+46([1-9][0-9]+)$", "000\\1 at pstnproxy.example.com"},
+				  {"^\\+44([1-9][0-9]+)$", "000\\1 at pstnproxy-uk.example.com"},
+				  {"^\\+([0-9]+)$", "0000\\1 at pstnproxy.example.com"}
+                                 ]},
+		  {number_to_pstn, [{"^118$", "118 at pstnproxy.example.com"}]},
+		  {enum_domainlist, ["e164.arpa"]},
+                  {homedomain, ["example.com", "example.net", "example.org"]},
+		  {myhostnames, ["sipserver.example.com", "sip.example.net", "sip.example.org"]},
+		  {appserver, "appserver.example.com:5070"},
+                  {ldap_server, "ldap.example.com"}
+                 ]}].

Added: yxa/trunk/debian/examples/outgoingproxy.config
===================================================================
--- yxa/trunk/debian/examples/outgoingproxy.config	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/examples/outgoingproxy.config	2006-08-05 23:12:18 UTC (rev 2189)
@@ -0,0 +1,13 @@
+%%%
+%%% outgoingproxy.config
+%%%
+%%% outgoingproxy configuration example
+%%%
+
+[{outgoingproxy, [{sipauth_realm, "example.com"},
+                  {sipauth_password, "secret"},
+                  {databaseservers, ['incomingproxy at sip-incoming.example.com']},
+		  {myhostnames, ["outgoingproxy1.example.com", "out.example.com"]},
+                  {homedomain, ["example.com", "example.net", "example.org"]},
+		  {tcp_connection_idle_timeout, 1000000}
+                 ]}].

Added: yxa/trunk/debian/examples/pstnproxy.config
===================================================================
--- yxa/trunk/debian/examples/pstnproxy.config	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/examples/pstnproxy.config	2006-08-05 23:12:18 UTC (rev 2189)
@@ -0,0 +1,26 @@
+%%%
+%%% pstnproxy.config
+%%%
+%%% pstnproxy configuration example
+%%%
+
+[{pstnproxy, [{sipauth_realm, "example.com"},
+              {sipauth_password, "secret"},
+              {sipauth_unauth_classlist, [internal]},
+	      {logger_logbasename, "/var/log/pstnproxy"},
+              {pstngatewaynames, ["pstn-gw.example.com", "10.10.1.1"]},
+              {myhostnames, ["sip-pstn.example.com", "sip2pstn.example.com", "10.10.1.2"]},
+              {classdefs, [{"^[1-9]", national},
+                           {"^0[1-9]", national},
+                           {"^00", international},
+                           {"", unknown}
+                          ]},
+              {databaseservers, ['incomingproxy at sip-incoming.example.com']},
+              {internal_to_e164, [{"^00(.+)$", "+\\1"},
+                                  {"^0(.+)$", "+46\\1"},
+                                  {"^(.+)$", "+468\\1"}
+                                 ]},
+	      {e164_to_pstn, [{"^\\(+44[1-9][0-9]+)$", "\\1 at uk-toll-bypass.tsp.example.net"}]},
+	      {number_to_pstn, [{"^118$"}, "sip:118 at pstn-gw.example.com"]},
+	      {enum_domainlist, ["e164.arpa"]},
+             ]}].

Added: yxa/trunk/debian/examples/secrets.config
===================================================================
--- yxa/trunk/debian/examples/secrets.config	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/examples/secrets.config	2006-08-05 23:12:18 UTC (rev 2189)
@@ -0,0 +1,8 @@
+%%%
+%%% secrets.config
+%%%
+
+[
+ {common, [{sipauth_password,		"secret"}
+	  ]}
+].

Added: yxa/trunk/debian/examples/sipuserdb.config
===================================================================
--- yxa/trunk/debian/examples/sipuserdb.config	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/examples/sipuserdb.config	2006-08-05 23:12:18 UTC (rev 2189)
@@ -0,0 +1,29 @@
+%%%
+%%% sipuserdb.config
+%%%
+%%% User database (sipuserdb_file) example
+%%%
+
+[
+ {user, [
+	 {name, "ft.sip1"},
+	 {password, "secret"},
+	 {classes, [internal,national,mobile]}
+	]},
+ {user, [
+	 {name, "foo at example.org"},
+	 {password, "secret2"},
+	 {classes, [internal]},
+	 {addresses, ["sip:info at example.org", "sip:all at example.org"]}
+	]},
+
+ {address, [
+	    {user, "ft.sip1"},
+	    {address, "sip:ft at example.org"}
+	   ]},
+ {address, [
+	    {user, "ft.sip1"},
+	    {address, "sip:all at example.org"}
+	   ]}
+
+].

Added: yxa/trunk/debian/examples/yxa.config
===================================================================
--- yxa/trunk/debian/examples/yxa.config	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/examples/yxa.config	2006-08-05 23:12:18 UTC (rev 2189)
@@ -0,0 +1,43 @@
+%%%
+%%% yxa.config
+%%%
+%%% Combined configuration file for more than one application
+%%%
+
+[
+ %% Include files
+ %% --------------------------------------------------------------------
+ {include,	"secrets.config"},
+
+ %% Common configuration
+ %% --------------------------------------------------------------------
+ {common,	[{sipauth_realm,		"example.com"},
+
+		 {logger_logdir,		"/var/log/yxa"},
+
+		 {databaseservers,		['incomingproxy at server.example.com']},
+
+		 {ssl_server_certfile,		"/var/yxa/ssl/cert.comb"},
+		 {ssl_client_certfile,		"/var/yxa/ssl/cert.comb"},
+		 {ssl_server_ssloptions,	[{verify, 1},
+						 {cacertfile, "/var/yxa/ssl/ca-chain.crt"}
+						]},
+		 {ssl_client_ssloptions,	[{verify, 1},
+						 {cacertfile, "/var/yxa/ssl/ca-chain.crt"}
+						]}
+		]},
+
+ %% Application specific configuration
+ %% --------------------------------------------------------------------
+ {incomingproxy,	[{appserver,		"appserver.server.example.com"},
+			 
+			 {myhostnames,		["incomingproxy.server.example.com", "server.example.com"]},
+			 {homedomain,		["example.com", "example.net", "example.org"],
+			 
+			 {enum_domainlist,	["e164.arpa"]}
+			]},
+ 
+ {appserver,		[{listenport,		5070},
+			 {tls_listenport, 	5071}
+	 		]}
+].

Modified: yxa/trunk/debian/patches/00list
===================================================================
--- yxa/trunk/debian/patches/00list	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/patches/00list	2006-08-05 23:12:18 UTC (rev 2189)
@@ -4,4 +4,7 @@
 yaws-fqdn
 inet_dns
 distclean
-init-mnesia
+#init-mnesia
+net_util
+yxa_yaws_makefile
+yxa_yaws

Added: yxa/trunk/debian/patches/net_util.dpatch
===================================================================
--- yxa/trunk/debian/patches/net_util.dpatch	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/patches/net_util.dpatch	2006-08-05 23:12:18 UTC (rev 2189)
@@ -0,0 +1,134 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## net_util.dpatch by  <mikma at users.sourceforge.net>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+ at DPATCH@
+diff -urNad yxa-0.91~/src/Makefile.in yxa-0.91/src/Makefile.in
+--- yxa-0.91~/src/Makefile.in	2006-08-03 19:36:03.000000000 +0200
++++ yxa-0.91/src/Makefile.in	2006-08-03 19:36:04.000000000 +0200
+@@ -49,6 +49,7 @@
+ 	local.erl \
+ 	logger.erl \
+ 	lookup.erl \
++	net_util.erl \
+ 	outgoingproxy.erl \
+ 	pstnproxy.erl \
+ 	registrar.erl \
+diff -urNad yxa-0.91~/src/net_util.erl yxa-0.91/src/net_util.erl
+--- yxa-0.91~/src/net_util.erl	1970-01-01 01:00:00.000000000 +0100
++++ yxa-0.91/src/net_util.erl	2006-08-03 19:37:22.000000000 +0200
+@@ -0,0 +1,101 @@
++%%%-------------------------------------------------------------------
++%%% File    : net_util.erl
++%%% Author  : Mikael Magnusson <mikma at users.sourceforge.net>
++%%% Descrip.: Connect to Erlang nodes
++%%%
++%%% Created : 31 July 2006
++%%%           by Mikael Magnusson <mikma at users.sourceforge.net>
++%%%-------------------------------------------------------------------
++
++-module(net_util).
++
++-behaviour(gen_server).
++
++%% gen_server
++-export([
++	 init/1,
++	 code_change/3,
++	 handle_call/3,
++	 handle_cast/2,
++	 handle_info/2,
++	 terminate/2
++	]).
++
++%% api
++-export([
++	 connect/1, connect/2
++	]).
++
++-record(state, {pending_nodes}).
++
++%%--------------------------------------------------------------------
++%% Function: connect(Nodes, Timeout)
++%%           Nodes = list() of atom(), node names
++%% Descrip.: Tries to connect to each node using ping for Timeout 
++%%           milliseconds.
++%% Returns : ok | {error, timeout}
++%%--------------------------------------------------------------------
++connect(Nodes, Timeout) ->
++    {ok, Pid} = gen_server:start(?MODULE, [], []),
++    gen_server:call(Pid, {connect, Nodes, Timeout}, Timeout + 1000).
++
++connect(Nodes) ->
++    connect(Nodes, 5000).
++
++%%
++%% Implementation of gen_server callbacks
++%%
++init([]) ->
++    {ok, #state{}}.
++
++code_change(_OldVsn, State, _Extra) ->
++    {ok, State}.
++
++do_ping([], PendingNodes) ->
++    {ok, PendingNodes};
++do_ping([Node|Nodes], PendingNodes) ->
++    case net_adm:ping(Node) of
++	pong ->
++	    {ok, []};
++	pang ->
++	    NewPendingNodes = PendingNodes ++ [Node],
++	    do_ping(Nodes, NewPendingNodes)
++    end.
++
++handle_call({connect, Nodes, Timeout}, From, State) ->
++    {ok, PendingNodes} = do_ping(Nodes, []),
++    NewState = State#state{pending_nodes=PendingNodes},
++    case PendingNodes of
++	[] ->
++	    {reply, ok, NewState};
++	_Any ->
++	    {ok, _PingTimer} = timer:send_interval(500, {send_ping, From}),
++	    {ok, _Timer} = timer:send_after(Timeout, {timeout, From}),
++	    {noreply, NewState}
++    end;
++handle_call(_Request, _From, State) ->
++    {reply, ok, State}.
++
++handle_cast(stop, State) ->
++    {stop, normal, State};
++handle_cast(_Request, State) ->
++    {noreply, State}.
++
++handle_info({send_ping, From}, State) ->
++    {ok, PendingNodes} = do_ping(State#state.pending_nodes, []),
++    NewState = State#state{pending_nodes=PendingNodes},
++    case PendingNodes of
++	[] ->
++	    gen_server:reply(From, ok),
++	    {stop, normal, NewState};
++	_Any ->
++	    {noreply, NewState}
++    end;
++handle_info({timeout, From}, State) ->
++    gen_server:reply(From, {error, timeout}),
++    {stop, normal, State};
++handle_info(_Info, State) ->
++    {noreply, State}.
++
++terminate(_Reason, _State) ->
++    terminated.
+diff -urNad yxa-0.91~/src/sipserver.erl yxa-0.91/src/sipserver.erl
+--- yxa-0.91~/src/sipserver.erl	2006-08-03 19:35:49.000000000 +0200
++++ yxa-0.91/src/sipserver.erl	2006-08-03 19:36:04.000000000 +0200
+@@ -146,6 +146,7 @@
+ 	    case yxa_config:get_env(databaseservers) of
+ 		{ok, DbNodes} ->
+ 		    logger:log(debug, "Mnesia extra db nodes : ~p (needed for tables ~p)", [DbNodes, RemoteTables]),
++		    ok = net_util:connect(DbNodes),
+ 		    case mnesia:change_config(extra_db_nodes, DbNodes) of
+ 			{error, Reason} ->
+ 			    logger:log(error, "Startup problem: Could not add configured databaseservers: ~p",


Property changes on: yxa/trunk/debian/patches/net_util.dpatch
___________________________________________________________________
Name: svn:executable
   + *

Modified: yxa/trunk/debian/patches/yaws-fqdn.dpatch
===================================================================
--- yxa/trunk/debian/patches/yaws-fqdn.dpatch	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/patches/yaws-fqdn.dpatch	2006-08-05 23:12:18 UTC (rev 2189)
@@ -6,19 +6,51 @@
 
 @DPATCH@
 diff -urNad yxa-0.91~/yaws/src/yxa_yaws_util.erl yxa-0.91/yaws/src/yxa_yaws_util.erl
---- yxa-0.91~/yaws/src/yxa_yaws_util.erl	2006-07-10 17:51:52.000000000 +0200
-+++ yxa-0.91/yaws/src/yxa_yaws_util.erl	2006-07-10 18:01:39.000000000 +0200
-@@ -381,7 +381,12 @@
+--- yxa-0.91~/yaws/src/yxa_yaws_util.erl	2006-08-01 10:41:07.000000000 +0200
++++ yxa-0.91/yaws/src/yxa_yaws_util.erl	2006-08-01 11:13:08.000000000 +0200
+@@ -43,6 +43,7 @@
+ %% Include files
+ %%--------------------------------------------------------------------
+ -include("phone.hrl").
++-include_lib("kernel/include/inet.hrl").
+ 
+ 
+ %%====================================================================
+@@ -373,15 +374,35 @@
+     {ok, MyHostname} = my_hostname(),
+     "incomingproxy@" ++ MyHostname.
+ 
++%%--------------------------------------------------------------------
++%% Function: get_fqdn(H)
++%%           H = string(), host name
++%% Descrip.: Get the FQDN (Fully Qualified Domain Name)
++%% Returns : {ok, FQDN} | {error, Reason}, FQDN = string()
++%%--------------------------------------------------------------------
++get_fqdn(Hostname) ->
++    case inet:gethostbyname(Hostname) of
++	{error, What} ->
++	    logger:log(debug, "Resolver: Error ~p when resolving local hostname", [What]),
++	    {error, What};
++	{ok, HostEnt} when is_record(HostEnt, hostent) ->
++	    {ok, HostEnt#hostent.h_name}
++    end.
++
+ %% part of get_incomingproxy_nodename/0, inet:gethostname/0 without the
+ %% domain-name removing part.
+ %% Returns : {ok, Hostname}, Hostname = string()
+ my_hostname() ->
+     case inet_udp:open(0, []) of
          {ok, Socket} ->
-             {ok, Res} = inet:gethostname(Socket),
+-            {ok, Res} = inet:gethostname(Socket),
++            {ok, Hostname} = inet:gethostname(Socket),
              inet_udp:close(Socket),
 -            {ok, Res};
-+            case inet:gethostbyname(Res) of
-+                {ok, {hostent, MyHostname, _, _, _, _}} ->
-+                    {ok, MyHostname};
-+                _ ->
-+                    {ok, Res}
-+            end;
++	    case get_fqdn(Hostname) of
++		{error, What} ->
++		    {ok, Hostname};
++		{ok, FQDN} ->
++		    {ok, FQDN}
++	    end;
          _ ->
              {ok, "nohost.nodomain"}
      end.

Added: yxa/trunk/debian/patches/yxa_yaws.dpatch
===================================================================
--- yxa/trunk/debian/patches/yxa_yaws.dpatch	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/patches/yxa_yaws.dpatch	2006-08-05 23:12:18 UTC (rev 2189)
@@ -0,0 +1,309 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## yxa_yaws.dpatch by  <mikma at users.sourceforge.net>
+##
+## All lines beginning with '## DP:' are a description of the patch.
+## DP: No description.
+
+ at DPATCH@
+diff -urNad /dev/null yxa-0.91/yaws/src/yxa_yaws.app-in
+--- /dev/null	1970-01-01 01:00:00.000000000 +0100
++++ yxa-0.91/yaws/src/yxa_yaws.app-in	2006-08-06 00:16:59.000000000 +0200
+@@ -0,0 +1,13 @@
++{application, yxa_yaws,
++ [{description, "YXA Yaws server"},
++  {vsn,"0.0"},
++  {modules, [
++	     yxa_yaws_app,
++	     yxa_yaws_ctl
++	    ]},
++  {registered, [
++	       ]},
++%%  {mod, {yxa_yaws_app, []}},
++  {env, []},
++  {applications,
++        [kernel, stdlib, yaws]}]}.
+diff -urNad /dev/null yxa-0.91/yaws/src/yxa_yaws.rel
+--- /dev/null	1970-01-01 01:00:00.000000000 +0100
++++ yxa-0.91/yaws/src/yxa_yaws.rel	2006-08-06 00:16:59.000000000 +0200
+@@ -0,0 +1,6 @@
++%% Erlang OTP R11B-0 library versions
++{release, {"YXA embedded Yaws web server","0.0"}, {erts, "5.2"},
++ [{kernel,"2.11"},
++  {stdlib,"1.14"},
++  {yaws, "1.64"},
++  {yxa_yaws, "0.0"}]}.
+diff -urNad /dev/null yxa-0.91/yaws/src/yxa_yaws_app.erl
+--- /dev/null	1970-01-01 01:00:00.000000000 +0100
++++ yxa-0.91/yaws/src/yxa_yaws_app.erl	2006-08-06 00:16:59.000000000 +0200
+@@ -0,0 +1,135 @@
++%%%-------------------------------------------------------------------
++%%% File    : yxa_yaws.erl
++%%% Author  : Mikael Magnusson <mikma at users.sourceforge.net>
++%%% Descrip.: YXA embedded Yaws web server application.
++%%% Created : 1 Aug 2006
++%%%           by Mikael Magnusson <mikma at users.sourceforge.net>
++%%%-------------------------------------------------------------------
++-module(yxa_yaws_app).
++
++-behaviour(application).
++
++%% application callbacks
++-export([start/2, stop/1]).
++
++%% api:s
++-export([start/0, reload/0, stop/0, restart/0, status/0]).
++
++-include_lib("yaws/include/yaws.hrl").
++
++%% application callbacks
++start(normal, []) ->
++    ok = start_yaws(),
++    yxa_yaws_sup:start_link().
++
++stop(_State) ->
++    ok.
++
++%%--------------------------------------------------------------------
++%% Function: start
++%% Descrip.: Start and configure the yaws web server application
++%% Returns : ok
++%%--------------------------------------------------------------------
++start() ->
++    start_yaws().
++
++start_yaws() ->
++    ok = application:set_env(yaws, embedded, true),
++%%    yaws:start(),
++    set_yaws_config().
++
++
++%%--------------------------------------------------------------------
++%% Function: reload
++%% Descrip.: Reload configuration of the yaws web server application
++%% Returns : ok
++%%--------------------------------------------------------------------
++reload() ->
++    set_yaws_config().
++
++
++set_yaws_config() ->
++    {ok, DefaultIncdir} = inc_dir(?MODULE),
++    Includedir = get_env_default(includedir, DefaultIncdir),
++    Docroot = get_env_default(docroot, ?DOCROOT),
++    Tmpdir = get_env_default(tmpdir, ?CACHEDIR),
++    Logdir = get_env_default(logdir, ?LOGDIR),
++    GC = yaws_config:make_default_gconf(false, "yxa"),
++    SC = #sconf{port = 8888,
++		servername = "localhost",
++		listen = {127,0,0,1},
++		docroot = Docroot},
++    MyGC = GC#gconf{logdir=Logdir,
++		    include_dir=GC#gconf.include_dir ++ [Includedir],
++		    tmpdir=Tmpdir},
++    ok = yaws_api:setconf(MyGC, [[SC]]).
++
++get_env_default(Param, Default) ->
++    case application:get_env(yxa_yaws, Param) of
++	{ok, Value} ->
++	    Value;
++	undefined ->
++	    Default
++    end.
++
++inc_dir(Module) ->
++    Filename = code:which(Module),
++    Dir = filename:dirname(Filename),
++    IncDir = filename:join(Dir, "include"),
++    case filelib:is_dir(IncDir) of
++	true ->
++	    {ok, IncDir};
++	false ->
++	    {ok, filename:join(filename:dirname(Dir), "include")}
++    end.
++
++
++%%--------------------------------------------------------------------
++%% Function: stop
++%% Descrip.: Stop yaws web server application and terminate system
++%% Returns : void
++%%--------------------------------------------------------------------
++stop() ->
++    %%stop_yaws(),
++    %% Need to stop yxa_yaws_app manually
++    %%application:stop(yxa_yaws_app),
++    init:stop().
++
++%% stop_yaws() ->
++%%    application:stop(yaws).
++
++
++%%--------------------------------------------------------------------
++%% Function: restart()
++%% Descrip.: restart application.
++%% Returns : does not return
++%%--------------------------------------------------------------------
++restart() ->
++    %%    logger:log(normal, "yxa_yaws: restarting"),
++    init:restart().
++
++
++%%--------------------------------------------------------------------
++%% Function: status
++%% Descrip.: Check if yaws is running
++%% Returns : ok | {error, {not_started, yaws}}
++%%--------------------------------------------------------------------
++status() ->
++    check_running(yaws).
++
++
++%%--------------------------------------------------------------------
++%% Function: check_running(AppName)
++%%           AppName = atom(), Application name
++%% Descrip.: Check if an application is running
++%% Returns : ok | {error, {not_started, AppName}}
++%%--------------------------------------------------------------------
++check_running(AppName) ->
++    check_running(AppName, application:which_applications()).
++
++check_running(AppName, [{AppName, _Desc, _Vsn}|_R]) ->
++    ok;
++check_running(AppName, []) ->
++    {error, {not_started, AppName}};
++check_running(_AppName, [_AppName2|R]) ->
++    check_running(_AppName, R).
+diff -urNad /dev/null yxa-0.91/yaws/src/yxa_yaws_ctl.erl
+--- /dev/null	1970-01-01 01:00:00.000000000 +0100
++++ yxa-0.91/yaws/src/yxa_yaws_ctl.erl	2006-08-06 00:16:59.000000000 +0200
+@@ -0,0 +1,100 @@
++%%%-------------------------------------------------------------------
++%%% File    : yxa_yaws.erl
++%%% Author  : Mikael Magnusson <mikma at users.sourceforge.net>
++%%% Descrip.: YXA embedded Yaws web server control
++%%% Created : 1 Aug 2006
++%%%           by Mikael Magnusson <mikma at users.sourceforge.net>
++%%%           based on yxa_ctl.erl
++%%%-------------------------------------------------------------------
++
++-module(yxa_yaws_ctl).
++
++%% api:s
++-export([start/0]).
++
++%%--------------------------------------------------------------------
++%% Macros
++%%--------------------------------------------------------------------
++-define(EXIT_OK, 0).
++-define(EXIT_ERROR, 1).
++-define(EXIT_NODEDOWN, 2).
++-define(EXIT_USAGE, 3).
++
++process(Node, ["start"]) ->
++        case rpc:call(Node, yxa_yaws_app, start, []) of
++	ok ->
++	    io:format("Node ~p started~n", [Node]),
++	    ok;
++	Res ->
++	    Res
++    end;
++
++process(Node, ["reload"]) ->
++    case rpc:call(Node, yxa_yaws_app, reload, []) of
++	ok ->
++	    io:format("Node ~p reloaded~n", [Node]),
++	    ok;
++	Res ->
++	    Res
++    end;
++
++process(Node, ["stop"]) ->
++        case rpc:call(Node, yxa_yaws_app, stop, []) of
++	ok ->
++	    io:format("Node ~p stopped~n", [Node]),
++	    ok;
++	Res ->
++	    Res
++    end;
++
++process(Node, ["restart"]) ->
++    case rpc:call(Node, yxa_yaws_app, restart, []) of
++	ok ->
++	    io:format("Node ~p restarted~n", [Node]),
++	    ok;
++	Res ->
++	    Res
++    end;
++
++process(Node, ["status"]) ->
++        case rpc:call(Node, yxa_yaws_app, status, []) of
++	ok ->
++	    io:format("Node ~p running~n", [Node]),
++	    ok;
++	Res ->
++	    Res
++    end;
++
++process(_Node, [Cmd]) ->
++    io:format("Invalid command ~p~n", [Cmd]),
++    error.
++
++
++start() ->
++    case init:get_plain_arguments() of
++	[NodeStr | Args] ->
++	    Node = list_to_atom(NodeStr),
++	    try process(Node, Args) of
++		ok ->
++		    erlang:halt(?EXIT_OK);
++		error ->
++		    erlang:halt(?EXIT_ERROR);
++		{badrpc, nodedown} ->
++		    io:format("Error: Node ~p not responding~n", [Node]),
++		    erlang:halt(?EXIT_NODEDOWN);
++		Unknown ->
++		    io:format("Yxa_yaws_app RPC returned unknown result : ~p~n", [Unknown]),
++		    erlang:halt(?EXIT_ERROR)
++	    catch
++		error: Y ->
++		    ST = erlang:get_stacktrace(),
++		    io:format("Yxa_yaws_ctl failed : error ~p ~p~n", [Y, ST]),
++		    erlang:halt(?EXIT_ERROR);
++		X: Y ->
++		    io:format("Yxa_yaws_ctl failed : ~p ~p~n", [X, Y]),
++		    erlang:halt(?EXIT_ERROR)
++	    end;
++	_ ->
++	    io:format("Invalid arguments~n"),
++	    erlang:halt(?EXIT_USAGE)
++    end.
+diff -urNad /dev/null yxa-0.91/yaws/src/yxa_yaws_sup.erl
+--- /dev/null	1970-01-01 01:00:00.000000000 +0100
++++ yxa-0.91/yaws/src/yxa_yaws_sup.erl	2006-08-05 22:18:08.000000000 +0200
+@@ -0,0 +1,28 @@
++%%%-------------------------------------------------------------------
++%%% File    : yxa_yaws_sup.erl
++%%% Author  : Mikael Magnusson <mikma at users.sourceforge.net>
++%%% Descrip.: YXA embedded Yaws web server supervisor
++%%% Created : 5 Aug 2006
++%%%           by Mikael Magnusson <mikma at users.sourceforge.net>
++%%%-------------------------------------------------------------------
++-module(yxa_yaws_sup).
++
++-behaviour(supervisor).
++
++%% supervisor callbacks
++-export([init/1]).
++
++%% api:s
++-export([start_link/0]).
++
++-define(SERVER, ?MODULE).
++
++%%--------------------------------------------------------------------
++%% Function: start_link
++%% Description: Starts the supervisor
++%%--------------------------------------------------------------------
++start_link() ->
++    supervisor:start_link({local, ?SERVER}, ?MODULE, []).
++
++init([]) ->
++    {ok, {{one_for_one, 20, 60}, []}}.


Property changes on: yxa/trunk/debian/patches/yxa_yaws.dpatch
___________________________________________________________________
Name: svn:executable
   + *

Added: yxa/trunk/debian/patches/yxa_yaws_makefile.dpatch
===================================================================
--- yxa/trunk/debian/patches/yxa_yaws_makefile.dpatch	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/patches/yxa_yaws_makefile.dpatch	2006-08-05 23:12:18 UTC (rev 2189)
@@ -0,0 +1,77 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## yxa_yaws.dpatch by  <mikma at users.sourceforge.net>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+ at DPATCH@
+diff -urNad yxa-0.91~/yaws/src/Makefile.in yxa-0.91/yaws/src/Makefile.in
+--- yxa-0.91~/yaws/src/Makefile.in	2006-08-04 00:48:29.000000000 +0200
++++ yxa-0.91/yaws/src/Makefile.in	2006-08-04 00:51:06.000000000 +0200
+@@ -18,6 +18,13 @@
+ builddir = @builddir@
+ local_file = @local_file@
+ 
++datadir = @datadir@
++localstatedir = @localstatedir@
++
++docrootdir = $(datadir)/yxa/docroot
++tmpdir = $(localstatedir)/run/yxa
++logdir = $(localstatedir)/log/yxa
++
+ ERLC = @ERLC@
+ ERL = @ERL@
+ 
+@@ -27,8 +34,13 @@
+ 
+ mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs
+ 
++systools_make_script = \
++	$(ERLC) -I$(srcdir) $(srcdir)/$*.rel
+ 
+ erl_FILES = \
++	yxa_yaws_app.erl \
++	yxa_yaws_ctl.erl \
++	yxa_yaws_sup.erl \
+ 	yxa_yaws_util.erl
+ 
+ imported_hrl_FILES = \
+@@ -41,17 +52,23 @@
+ 
+ yxa_hrl_FILES = $(imported_hrl_FILES) $(hrl_FILES)
+ 
++app_FILES = yxa_yaws.app
++
+ CC = gcc
+ CFLAGS = -Wall
+ 
++EFLAGS = -W +debug_info -DDOCROOT=\"$(docrootdir)\" -DCACHEDIR=\"$(tmpdir)\" -DLOGDIR=\"$(logdir)\"
++
+ beam_FILES = $(erl_FILES:.erl=.beam)
+ 
+-all: $(beam_FILES)
++boot_FILES = yxa_yaws.boot
+ 
+-install: $(beam_FILES) $(hrl_FILES)
++all: $(beam_FILES) $(app_FILES) $(boot_FILES)
++
++install: $(beam_FILES) $(hrl_FILES) $(boot_FILES)
+ 	$(mkinstalldirs) $(DESTDIR)$(beamdir)
+ 	$(mkinstalldirs) $(DESTDIR)$(includedir)
+-	for p in $(beam_FILES); do \
++	for p in $(beam_FILES) $(app_FILES) $(boot_FILES); do \
+ 	  $(install_DATA) $$p $(DESTDIR)$(beamdir)/$$f ; \
+ 	done
+ 	for p in $(hrl_FILES); do \
+@@ -73,4 +90,10 @@
+ .SUFFIXES: .c .o .hrl .beam .erl .boot .rel .rel-in .app .app-in
+ 
+ .erl.beam:
+-	$(ERLC) -I$(srcdir) -I$(top_srcdir)/src/include/ -W +debug_info $<
++	$(ERLC) -I$(srcdir) -I$(top_srcdir)/src/include/ $(EFLAGS) $<
++
++.app-in.app:
++	cp $(srcdir)/$*.app-in $*.app
++
++yxa_yaws.boot: yxa_yaws.app $(srcdir)/yxa_yaws.rel
++	$(systools_make_script)


Property changes on: yxa/trunk/debian/patches/yxa_yaws_makefile.dpatch
___________________________________________________________________
Name: svn:executable
   + *

Added: yxa/trunk/debian/postinst
===================================================================
--- yxa/trunk/debian/postinst	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/postinst	2006-08-05 23:12:18 UTC (rev 2189)
@@ -0,0 +1,54 @@
+#!/bin/sh
+# postinst script for #PACKAGE#
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+#
+
+case "$1" in
+    configure)
+
+	# /var/lib/yxa contains sensitive information
+	# (erlang cookie, databases)
+	chown yxa:yxa /var/lib/yxa
+	chmod 700 /var/lib/yxa
+
+	# Only user yxa and root are allowed to modify /var/run/yxa
+	chown yxa:yxa /var/run/yxa
+	chmod 755 /var/run/yxa
+
+        install -o yxa -g adm -m 750 -d /var/log/yxa
+
+	if test ! -f /var/lib/yxa/db/incomingproxy/schema.DAT; then
+	    su yxa -c "cd /var/lib/yxa && /usr/sbin/yxa-bootstrap"
+	fi
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0

Added: yxa/trunk/debian/postrm
===================================================================
--- yxa/trunk/debian/postrm	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/postrm	2006-08-05 23:12:18 UTC (rev 2189)
@@ -0,0 +1,41 @@
+#!/bin/sh
+# postrm script for #PACKAGE#
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postrm> `remove'
+#        * <postrm> `purge'
+#        * <old-postrm> `upgrade' <new-version>
+#        * <new-postrm> `failed-upgrade' <old-version>
+#        * <new-postrm> `abort-install'
+#        * <new-postrm> `abort-install' <old-version>
+#        * <new-postrm> `abort-upgrade' <old-version>
+#        * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+        ;;
+
+    purge)
+	deluser yxa 2>/dev/null || true
+	delgroup yxa 2>/dev/null || true
+	;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0

Added: yxa/trunk/debian/preinst
===================================================================
--- yxa/trunk/debian/preinst	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/preinst	2006-08-05 23:12:18 UTC (rev 2189)
@@ -0,0 +1,38 @@
+#!/bin/sh
+# preinst script for #PACKAGE#
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <new-preinst> `install'
+#        * <new-preinst> `install' <old-version>
+#        * <new-preinst> `upgrade' <old-version>
+#        * <old-preinst> `abort-upgrade' <new-version>
+#
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    install|upgrade)
+	# Add YXA group and user if not existing
+	getent passwd yxa 2>&1 >/dev/null || adduser --quiet --system --shell /bin/sh --home /var/lib/yxa --group --disabled-login --gecos "YXA SIP servers,,," yxa
+    ;;
+
+    abort-upgrade)
+    ;;
+
+    *)
+        echo "preinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0

Added: yxa/trunk/debian/prerm
===================================================================
--- yxa/trunk/debian/prerm	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/prerm	2006-08-05 23:12:18 UTC (rev 2189)
@@ -0,0 +1,38 @@
+#!/bin/sh
+# prerm script for #PACKAGE#
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <prerm> `remove'
+#        * <old-prerm> `upgrade' <new-version>
+#        * <new-prerm> `failed-upgrade' <old-version>
+#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+#        * <deconfigured's-prerm> `deconfigure' `in-favour'
+#          <package-being-installed> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    remove|upgrade|deconfigure)
+        ;;
+    failed-upgrade)
+        ;;
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+

Modified: yxa/trunk/debian/rules
===================================================================
--- yxa/trunk/debian/rules	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/rules	2006-08-05 23:12:18 UTC (rev 2189)
@@ -44,6 +44,7 @@
 		--sysconfdir=/etc/yxa \
 		--mandir=\$${prefix}/share/man \
 		--infodir=\$${prefix}/share/info \
+		--localstatedir=/var \
 		--with-mnesiadir=/var/lib/yxa/db \
 		CFLAGS="$(CFLAGS)" \
 		LDFLAGS="-Wl,-z,defs"
@@ -74,7 +75,7 @@
 	dh_clean -k 
 	dh_installdirs
 
-	$(MAKE) install DESTDIR=$(CURDIR)/debian/yxa
+	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
 
 
 # Build architecture-independent files here.
@@ -87,11 +88,13 @@
 	dh_testroot
 	dh_installchangelogs CHANGES
 	dh_installdocs
-#	dh_install
+	chmod a+x $(CURDIR)/debian/yxa_yaws
+	dh_install
 #	dh_installdebconf	
-#	dh_installlogrotate
-#	dh_installinit
+	dh_installlogrotate
+	dh_installinit
 	dh_installman
+	dh_installexamples
 	dh_link
 	dh_strip
 	dh_compress

Added: yxa/trunk/debian/yxa.default
===================================================================
--- yxa/trunk/debian/yxa.default	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/yxa.default	2006-08-05 23:12:18 UTC (rev 2189)
@@ -0,0 +1,11 @@
+# Defaults for yxa initscript
+# sourced by /etc/init.d/yxa
+# installed at /etc/default/yxa by the maintainer scripts
+
+#
+# This is a POSIX shell fragment
+#
+
+# Additional options that are passed to the Daemon.
+DAEMON_OPTS=""
+#SERVICES="incomingproxy outgoingproxy pstnproxy appserver yxa_yaws"

Added: yxa/trunk/debian/yxa.examples
===================================================================
--- yxa/trunk/debian/yxa.examples	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/yxa.examples	2006-08-05 23:12:18 UTC (rev 2189)
@@ -0,0 +1,7 @@
+debian/examples/incomingproxy.config
+debian/examples/outgoingproxy.config
+debian/examples/pstnproxy.config
+debian/examples/appserver.config
+debian/examples/yxa.config
+debian/examples/secrets.config
+debian/examples/sipuserdb.config

Added: yxa/trunk/debian/yxa.init
===================================================================
--- yxa/trunk/debian/yxa.init	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/yxa.init	2006-08-05 23:12:18 UTC (rev 2189)
@@ -0,0 +1,156 @@
+#! /bin/sh
+#
+# skeleton	example file to build /etc/init.d/ scripts.
+#		This file should be used to construct scripts for /etc/init.d.
+#
+#		Written by Miquel van Smoorenburg <miquels at cistron.nl>.
+#		Modified for Debian 
+#		by Ian Murdock <imurdock at gnu.ai.mit.edu>.
+#		Modified for yxa
+#		by Mikael Magnusson <mikma at users.sourceforge.net>
+# Version:	@(#)skeleton  1.9  26-Feb-2001  miquels at cistron.nl
+#
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+NAME=yxa
+DESC="YXA servers"
+SERVICES="incomingproxy"
+USER=yxa
+HOSTNAME="-hostname `hostname -f`"
+
+set -e
+
+function usage {
+	N=/etc/init.d/$NAME
+	echo "Usage: $N {start|stop|restart|reload|force-reload|info} {incomingproxy|outgoingproxy|pstnproxy|appserver}" >&2
+}
+
+function check_service {
+    local service=$1
+case "$service" in
+  incomingproxy|outgoingproxy|pstnproxy|appserver|yxa_yaws)
+	;;
+  *)
+	echo "Invalid service name: $service"
+	usage
+	exit 1
+	;;
+esac
+
+DAEMON=/usr/lib/yxa/bin/$service
+test -x $DAEMON -a -f $DAEMON || return
+test -r /etc/yxa/$service.config || return
+}
+
+function do_action {
+local action=$1
+local service=$2
+local config="/etc/yxa/${service}.config"
+local daemon_opts="$DAEMON_OPTS $HOSTNAME -config $config"
+
+DAEMON=/usr/lib/yxa/bin/$service
+
+if test x$service = xincomingproxy; then
+	daemon_opts="$daemon_opts -mnesiadir /var/lib/yxa/db/incomingproxy"
+fi
+
+daemon()
+{
+	su $USER -c "cd /var/lib/yxa && $DAEMON $daemon_opts $@" >/dev/null
+}
+
+case "$action" in
+  start)
+	echo -n " $service"
+	if daemon status; then
+	    echo -n " (already running)"
+	else
+	    daemon start
+	fi
+	;;
+  stop)	
+	echo -n " $service"
+	if daemon status; then
+	    daemon stop
+	else
+	    echo -n " (not running)"
+	fi
+# -mnesiadir /var/lib/yxa/db/incomingproxy stop
+	;;
+  reload|force-reload)
+	daemon reload
+	echo -n " $service"
+	;;
+  restart)
+	daemon restart
+	echo -n " $service"
+	;;
+  info)
+	daemon info
+	echo -n " $service"
+	;;
+  *)
+	usage
+	exit 1
+	;;
+esac
+}
+
+# Include yxa defaults if available
+if [ -f /etc/default/yxa ] ; then
+	. /etc/default/yxa
+fi
+
+if test $# -lt 1; then
+	usage
+	exit 1
+fi
+
+ACTION=$1
+shift
+
+if test $# -gt 0; then
+	SERVICES=$@
+fi
+
+SERVICES_REV=
+if test $ACTION = stop; then
+	for service in $SERVICES; do
+		SERVICES_REV="$service $SERVICES_REV"
+	done
+	SERVICES="$SERVICES_REV"
+fi
+
+for service in $SERVICES; do
+	check_service $service
+done
+
+case "$ACTION" in
+  start)
+	echo -n "Starting $DESC:"
+	;;
+  stop)
+	echo -n "Stopping $DESC:"
+	;;
+  reload|force-reload)
+	echo -n "Reloading $DESC configuration files."
+	;;
+  restart)
+	echo -n "Restarting $DESC:"
+	;;
+  info)
+	echo -n "Info $DESC:"
+	;;
+  *)
+	usage
+	exit 1
+	;;
+esac
+
+for service in $SERVICES; do
+	do_action $ACTION $service
+done
+
+echo "."
+
+exit 0

Added: yxa/trunk/debian/yxa.install
===================================================================
--- yxa/trunk/debian/yxa.install	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/yxa.install	2006-08-05 23:12:18 UTC (rev 2189)
@@ -0,0 +1,4 @@
+debian/tmp/usr/lib/yxa
+debian/tmp/usr/sbin/* /usr/lib/yxa/bin
+yaws/docroot/* /usr/share/yxa/www
+debian/yxa_yaws /usr/lib/yxa/bin

Added: yxa/trunk/debian/yxa.logrotate
===================================================================
--- yxa/trunk/debian/yxa.logrotate	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/yxa.logrotate	2006-08-05 23:12:18 UTC (rev 2189)
@@ -0,0 +1,17 @@
+/var/log/yxa/*.log /var/log/yxa/*.debug /var/log/yxa/*.error /var/log/yxa/*.access {
+        weekly
+        missingok
+        rotate 52
+        compress
+        delaycompress
+        notifempty
+        create 640 yxa adm
+        sharedscripts
+        postrotate
+             if [ -x /usr/sbin/invoke-rc.d ]; then \
+                invoke-rc.d yxa restart > /dev/null; \
+             else \
+                /etc/init.d/yxa restart > /dev/null; \
+             fi; \
+        endscript
+}

Added: yxa/trunk/debian/yxa_yaws
===================================================================
--- yxa/trunk/debian/yxa_yaws	2006-08-05 14:18:10 UTC (rev 2188)
+++ yxa/trunk/debian/yxa_yaws	2006-08-05 23:12:18 UTC (rev 2189)
@@ -0,0 +1,238 @@
+#!/bin/sh
+#
+# yxa_yaws
+#
+
+PROGRAMNAME="yxa_yaws"
+CONFIGDIR="/etc/yxa"
+SSLCERTDIR="/etc/yxa"
+beamdir="/usr/lib/yxa/ebin"
+erl="/usr/bin/erl"
+
+docroot="/usr/share/yxa/www"
+tmpdir="/var/run/yxa"
+includedir="/usr/lib/yxa/include"
+logdir="/var/log/yxa"
+
+usage()
+{
+    common_options="\
+	-config File	use 'File.config' as config file
+	-c_ssl File	use 'File' as Erlang distribution client certificate file
+	-s_ssl File	use 'File' as Erlang distribution server certificate file
+	-name Name	use 'Name' as Erlang node name
+	-hostname Name	use 'Name' as hostname part of node-name
+	-h		show usage
+"
+
+	    echo "Syntax: $0 [options] command"
+	    echo ""
+	    echo "  Options :"
+	    echo "	-d		debug-mode, don't detach - implies 'start' command"
+	    echo "$common_options"
+	    echo ""
+	    echo "  Commands :"
+	    echo "	start		start server"
+	    echo "	stop		stop running server"
+	    echo "	status		get brief status of running server"
+	    # these are not implemented yet
+	    echo "	info [all]	get info about running server, add 'all' to get more info"
+	    echo "	reload		reload configuration of running server, if possible"
+	    echo "	restart		restart running server"
+	    echo ""
+
+    exit 1
+}
+
+# Calculate Erlang arguments
+configpath="${CONFIGDIR}/${PROGRAMNAME}.config"
+
+if [ "x$SSLCERTDIR" = "x" ]; then
+    client_sslcertfile="$CONFIGDIR/yxa/cert.comb"
+    server_sslcertfile="$client_sslcertfile"
+else
+    client_sslcertfile="$SSLCERTDIR/cert.comb"
+    server_sslcertfile="$client_sslcertfile"
+fi
+
+command=""
+command_arguments=""
+detach="-detached"
+replica=""
+explicit_name=0
+hostname=$(hostname)
+
+name="$PROGRAMNAME"
+
+exit_now=0
+# parse command line options
+while [ $# -gt 0 -a $exit_now -eq 0 ]
+do
+      arg=$1
+      # complicated shift to not make picky sh's whine
+      if [ "x$1" != "x" ]; then shift; else exit_now=1; fi
+
+      case $arg in
+	  -h)
+	      usage
+	      ;;
+	  -config)
+	      if [ "x$1" = "x" ]; then
+		  echo "$0: '$arg' requires an argument"
+		  exit 1
+	      else
+		  configpath="$1"
+		  shift
+	      fi
+	      ;;
+	  -c_ssl)
+	      if [ "x$1" = "x" ]; then
+		  echo "$0: '$arg' requires an argument"
+		  exit 1
+	      else
+		  client_sslcertfile="$1"
+		  shift
+	      fi
+	      ;;
+	  -s_ssl)
+	      if [ "x$1" = "x" ]; then
+		  echo "$0: '$arg' requires an argument"
+		  exit 1
+	      else
+		  server_sslcertfile="$1"
+		  shift
+	      fi
+	      ;;
+	  -d)
+	      detach=""
+	      command="start"
+	      ;;
+	  -name)
+	      if [ "x$1" = "x" ]; then
+		  echo "$0: '$arg' requires an argument"
+		  exit 1
+	      else
+		  name="$1"
+		  explicit_name=1
+		  shift
+	      fi
+	      ;;
+	  -hostname)
+	      if [ "x$1" = "x" ]; then
+		  echo "$0: '$arg' requires an argument"
+		  exit 1
+	      else
+		  hostname="$1"
+		  shift
+	      fi
+	      ;;
+	  start|stop|status|info|reload|restart)
+	      if [ "$arg" = "info" ]; then
+		  # the 'info' command can take an optional argument
+		  if [ "x$1" = "xall" ]; then
+		      command_arguments="$1"
+		      # complicated shift to not make picky sh's whine
+		      if [ "x$1" != "x" ]; then shift; else exit_now=1; fi
+		  fi
+	      fi
+
+	      # check that this was the last arg
+	      if [ $# -ne 0 ]; then
+		  echo "$0: command ('$arg') should come after any options"
+		  exit 1
+	      fi
+	      if [ "x$command" != "x" -a "$command" != "$1" ]; then
+		  echo "$0: command already set ('$command' != supplied '$1')"
+		  exit 1
+	      fi
+
+	      command="$arg"
+	      # complicated shift to not make picky sh's whine
+	      if [ "x$1" != "x" ]; then shift; else exit_now=1; fi
+	      ;;
+	  *)
+	      usage
+      esac
+done
+
+if [ "x$command" = "x" ]; then
+    usage
+fi
+
+if [ "x`echo $hostname | grep '\.'`" = "x" ]; then
+    echo "WARNING: Your hostname ($hostname) is not fully qualified" 1>&2
+fi
+
+if [ -f ${client_sslcertfile} ] ; then
+    ssloptions="-proto_dist inet_ssl \
+	-ssl_dist_opt client_certfile $client_sslcertfile \
+	-ssl_dist_opt server_certfile $server_sslcertfile -ssl_dist_opt verify 2"
+    boot_start_ssl="-boot start_ssl"
+else
+    echo "WARNING: starting without SSL - " \
+	"missing certificate file ${sslcertfile}"
+    ssloptions=""
+    boot_start_ssl=""
+fi
+
+if [ -d "${PWD}/src/event_handler" -a -d "${PWD}/src/cpl" ]; then
+    # we must be running from the build directory, add all subdirectorys
+    # to src/ plus yaws/src/ to the code search path
+    beamdirs=$(
+	echo "-pa src/ -pa yaws/src/"
+	ls ${PWD}/src/ | while read entry; do
+	    if [ -d "src/$entry" ]; then
+		echo "-pa src/$entry"
+	    fi
+	done
+    )
+    
+    EXTRA_ERL_ARGUMENTS="${EXTRA_ERL_ARGUMENTS} `echo $beamdirs`"
+fi
+
+    if [ ! -r "${configpath}" ]; then
+	echo "$0: Configuration file '${configpath}' not found or not readable"
+	exit 1
+    fi
+
+    case $command in
+	start)
+	    if [ -f "$PWD/src/${PROGRAMNAME}.boot" ]; then
+		bootfile="$PWD/src/${PROGRAMNAME}"
+	    else
+		if [ -f "${beamdir}/${PROGRAMNAME}.boot" ]; then
+		    bootfile="${beamdir}/$PROGRAMNAME"
+		fi
+	    fi
+	    ${erl} -boot $bootfile -pz ${beamdir} \
+		$EXTRA_ERL_ARGUMENTS \
+		-name $name \
+		-s yxa_yaws_app \
+		-yaws embedded true \
+		-yxa_yaws docroot \"$docroot\" \
+		-yxa_yaws tmpdir \"$tmpdir\" \
+		-yxa_yaws includedir \"$includedir\" \
+		-yxa_yaws logdir \"$logdir\" \
+		$ssloptions \
+		$detach
+	    ;;
+	stop|status|info|reload|restart)
+	    node="${name}@${hostname}"
+	    if [ $explicit_name -eq 0 ]; then
+	        # include pid ($$) in node name used here since contact with the running
+	        # node could otherwise fail for consecutive commands executed rapidly
+		name="${name}_ctl_$$"
+	    fi
+
+	    ${erl} $boot_start_ssl -pz ${beamdir} \
+		$EXTRA_ERL_ARGUMENTS \
+		-name "$name" \
+		$ssloptions \
+		-noshell \
+		-s yxa_yaws_ctl -extra $node $command $command_arguments
+	    ;;
+	*)
+	    echo "$0: command '$command' not implemented yet"
+	    exit 1
+	    ;;
+    esac


Property changes on: yxa/trunk/debian/yxa_yaws
___________________________________________________________________
Name: svn:executable
   + *




More information about the Pkg-voip-commits mailing list