kamailio/kamailio.spec

Tue, 28 Aug 2012 18:36:35 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 28 Aug 2012 18:36:35 +0200
changeset 579
6b18bb69901e
parent 408
751f89d647ed
child 625
6a62f7ecb64c
permissions
-rw-r--r--

Correct the paths of patched scripts, refine password generation,
mitigate fdatasync(2) detection problems, correct dependencies, remove
outdated autoconf components, correct conf file paths and attributes,
complete and correct log file rotation handing, and note warnings
useful for diagnosing builds.

michael@389 1 ##
michael@389 2 ## kamailio.spec -- OpenPKG RPM Package Specification
michael@408 3 ## Copyright (c) 2012 Michael Schloh von Bennewitz <michael@schloh.com>
michael@389 4 ##
michael@389 5 ## Permission to use, copy, modify, and distribute this software for
michael@389 6 ## any purpose with or without fee is hereby granted, provided that
michael@389 7 ## the above copyright notice and this permission notice appear in all
michael@389 8 ## copies.
michael@389 9 ##
michael@389 10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@389 11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@389 12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@389 13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@389 14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@389 15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@389 16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@389 17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@389 18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@389 19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@389 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@389 21 ## SUCH DAMAGE.
michael@389 22 ##
michael@389 23
michael@389 24 # package information
michael@389 25 Name: kamailio
michael@389 26 Summary: Open Source SIP Server
michael@389 27 URL: http://www.kamailio.org/
michael@389 28 Vendor: IPTelorg GmbH, Fraunhofer FOKUS, SIP Router Project
michael@389 29 Packager: Michael Schloh von Bennewitz
michael@389 30 Distribution: Europalab Networks Production
michael@389 31 Class: PLUS
michael@389 32 Group: VoIP
michael@389 33 License: GPL
michael@548 34 Version: 3.3.1
michael@548 35 Release: 20120800
michael@389 36
michael@389 37 # package options
michael@389 38 %option with_cons yes
michael@389 39 %option with_fsl yes
michael@389 40 %option with_ssl yes
michael@389 41 %option with_sctp no
michael@389 42 %option with_croute no
michael@389 43 %option with_ldap no
michael@389 44 %option with_memcached no
michael@389 45 %option with_radius no
michael@389 46 %option with_snmp no
michael@389 47 %option with_bdb no
michael@389 48 %option with_mysql no
michael@389 49 %option with_osp no
michael@389 50 %option with_pgsql no
michael@408 51 %option with_sqlite no
michael@389 52 %option with_odbc no
michael@389 53 %option with_geoip no
michael@389 54 %option with_lua no
michael@389 55 %option with_python no
michael@389 56
michael@389 57 # list of sources
michael@389 58 Source0: http://www.kamailio.org/pub/kamailio/%{version}/src/kamailio-%{version}_src.tar.gz
michael@389 59 Source2: rc.kamailio
michael@389 60 Source3: fsl.kamailio
michael@389 61
michael@389 62 # build information
michael@548 63 BuildPreReq: OpenPKG, openpkg >= 20100101
michael@548 64 PreReq: OpenPKG, openpkg >= 20100101
michael@389 65 BuildPreReq: libxml, expat, curl, readline
michael@389 66 PreReq: libxml, expat, curl, readline
michael@389 67 BuildPreReq: make, gcc, flex, bison, sed, pkgconfig
michael@389 68 PreReq: bash
michael@389 69 %if "%{with_cons}" == "yes"
michael@389 70 PreReq: perl-dbi, perl-term
michael@389 71 %endif
michael@389 72 %if "%{with_fsl}" == "yes"
michael@389 73 BuildPreReq: fsl
michael@389 74 PreReq: fsl
michael@389 75 %endif
michael@389 76 %if "%{with_ssl}" == "yes"
michael@389 77 BuildPreReq: openssl
michael@389 78 PreReq: openssl
michael@389 79 %endif
michael@389 80 %if "%{with_croute}" == "yes"
michael@389 81 BuildPreReq: confuse
michael@389 82 PreReq: confuse
michael@389 83 %endif
michael@389 84 %if "%{with_ldap}" == "yes"
michael@389 85 BuildPreReq: openldap
michael@389 86 PreReq: openldap
michael@389 87 %endif
michael@389 88 %if "%{with_memcached}" == "yes"
michael@389 89 BuildPreReq: memcached
michael@389 90 PreReq: memcached
michael@389 91 %endif
michael@389 92 %if "%{with_osp}" == "yes"
michael@389 93 BuildPreReq: osptoolkit
michael@389 94 PreReq: osptoolkit
michael@389 95 %endif
michael@389 96 %if "%{with_radius}" == "yes"
michael@389 97 BuildPreReq: radiusclient
michael@389 98 PreReq: radiusclient
michael@389 99 %endif
michael@389 100 %if "%{with_snmp}" == "yes"
michael@389 101 BuildPreReq: snmp
michael@389 102 PreReq: snmp
michael@389 103 %endif
michael@389 104 %if "%{with_bdb}" == "yes"
michael@389 105 BuildPreReq: db
michael@389 106 PreReq: db
michael@389 107 %endif
michael@389 108 %if "%{with_mysql}" == "yes"
michael@389 109 BuildPreReq: mysql
michael@389 110 PreReq: mysql
michael@389 111 %endif
michael@389 112 %if "%{with_pgsql}" == "yes"
michael@389 113 BuildPreReq: postgresql
michael@389 114 PreReq: postgresql
michael@389 115 %endif
michael@389 116 %if "%{with_odbc}" == "yes"
michael@389 117 BuildPreReq: unixodbc
michael@389 118 PreReq: unixodbc
michael@389 119 %endif
michael@389 120 %if "%{with_geoip}" == "yes"
michael@389 121 BuildPreReq: geoip
michael@389 122 PreReq: geoip
michael@389 123 %endif
michael@389 124 %if "%{with_lua}" == "yes"
michael@389 125 BuildPreReq: lua
michael@389 126 PreReq: lua
michael@389 127 %endif
michael@389 128 %if "%{with_python}" == "yes"
michael@389 129 BuildPreReq: python
michael@389 130 PreReq: python
michael@389 131 %endif
michael@389 132
michael@389 133 %description
michael@389 134 Kamailio is (beside Opensips) a successor to OpenSER, which in
michael@389 135 turn was spawned from FhG FOKUS's SIP Express Router (SER). It
michael@389 136 provides SIP (RFC3621) registrar, proxy and routing functionality.
michael@389 137 A C shell like scripting language provides for control over the
michael@389 138 server's behaviour. It's modular architecture allows for fine
michael@389 139 grained loading of required functionality.
michael@389 140
michael@389 141 Kamailio can be used as a: Kamailio fits in scenarios:
michael@389 142
michael@389 143 Registrar server SIP trunking
michael@389 144 Router, proxy SIP load balancing
michael@389 145 Redirect server SIP front end termination
michael@389 146 Presence agent Residential providers
michael@389 147 Back to back user agent white label solutions
michael@389 148 Instant messaging server Enterprise services
michael@389 149 SIP to SMS gateway LCR for multi gateways
michael@389 150 SIP to XMPP gateway
michael@389 151 Load balancer or dispatcher
michael@389 152 Front end for asterisk
michael@389 153 NAT traversal unit
michael@389 154 Application server
michael@389 155
michael@389 156 %track
michael@389 157 prog kamailio = {
michael@389 158 version = %{version}
michael@389 159 url = http://www.kamailio.org/pub/kamailio/
michael@389 160 regex = (\d+\.\d+\.\d+)/
michael@389 161 url = http://www.kamailio.org/pub/kamailio/__NEWVER__/src/
michael@389 162 regex = kamailio-(__VER__)_src\.tar\.gz
michael@389 163 }
michael@389 164
michael@389 165 %prep
michael@389 166 %setup -q
michael@389 167 %{l_shtool} subst \
michael@389 168 -e 's;\$(LOCALBASE)/[^/][^/]*/sctp.h;;g' \
michael@389 169 -e 's;\$(LOCALBASE)/ssl/include;`%{l_prefix}/bin/pkg-config --cflags-only-I openssl`;g' \
michael@389 170 -e 's;\$(LOCALBASE)/ssl/lib;`%{l_prefix}/bin/pkg-config --libs openssl`;g' \
michael@389 171 -e 's;LOCALBASE *[\?:]*=.*;LOCALBASE = %{l_prefix};g' \
michael@391 172 -e 's;\(data_dir\) *=.*;\1 = share/$(MAIN_NAME);g' \
michael@391 173 -e 's;\(doc_dir\) *=.*;\1 = share/$(MAIN_NAME)/doc;g' \
michael@391 174 -e 's;\(man_dir\) *=.*;\1 = man/;g' \
michael@389 175 Makefile.defs
michael@389 176 %{l_shtool} subst \
michael@389 177 -e 's;CFLAGS *= *$;CFLAGS = %{l_cflags -O};g' \
michael@389 178 -e 's;LDFLAGS *= *$;LDFLAGS = %{l_ldflags};g' \
michael@389 179 -e 's;C_INCLUDES *= *$;C_INCLUDES = %{l_cppflags};g' \
michael@389 180 Makefile.defs
michael@389 181 %{l_shtool} subst \
michael@389 182 -e 's;/usr/include/readline/readline.h;;g' \
michael@389 183 utils/sercmd/Makefile
michael@389 184 %{l_shtool} subst \
michael@389 185 -e 's;-I$(LOCALBASE)/Berkeley[^ ]* *;;g' \
michael@389 186 -e 's;-I$(LOCALBASE)/include[^ ]* *;;g' \
michael@389 187 -e 's;-I$(SYSBASE)/include[^ ]* *;;g' \
michael@389 188 -e 's;LIBS=.*;LIBS=`%{l_prefix}/bin/pkg-config --libs db`;g' \
michael@389 189 utils/db_berkeley/Makefile
michael@389 190 %{l_shtool} subst \
michael@391 191 -e 's;\(\$(data_prefix)/\$(data_dir)/.*\)/kamailio;\1;g' \
michael@389 192 utils/kamctl/Makefile
michael@389 193 %{l_shtool} subst \
michael@389 194 -e 's;\(radiusclient\)-ng;\1;g' \
michael@389 195 -e 's;/usr/local\(/etc/radiusclient/radiusclient.conf\);%{l_prefix}\1;' \
michael@389 196 Makefile.radius \
michael@389 197 lib/kcore/radius.h \
michael@389 198 modules_s/avp_radius/avp_radius.c \
michael@389 199 modules_s/uri_radius/checks.c \
michael@389 200 modules_s/uri_radius/urirad_mod.c \
michael@389 201 modules_s/acc_radius/acc_radius.c \
michael@389 202 modules_s/auth_radius/authrad_mod.c \
michael@389 203 modules_s/auth_radius/sterman.h
michael@389 204 %{l_shtool} subst \
michael@389 205 -e 's;\(DEFS *[\?:+]*=[^\\]*\);\1 -D__EXTENSIONS__;g' \
michael@389 206 modules/db_mysql/Makefile \
michael@389 207 modules/xmlrpc/Makefile
michael@389 208 %{l_shtool} subst \
michael@389 209 -e 's;\(-keyout.*\);\1 || true;' \
michael@389 210 modules/tls/sip-router_cert.sh
michael@408 211 %{l_shtool} subst \
michael@408 212 -e 's;^#! */bin/bash;#! %{l_prefix}/bin/bash;' \
michael@408 213 -e 's; /\(etc/kamailio\); %{l_prefix}/\1;' \
michael@408 214 -e 's;-f /usr/local/etc/kamailio/kamctlrc;false;' \
michael@408 215 -e 's; /usr/local/etc/kamailio/kamctlrc;unleash-betty-boop;' \
michael@408 216 -e 's;-f ~/.kamctlrc;false;g' \
michael@408 217 -e 's;-f ./kamctlrc;false;g' \
michael@408 218 -e 's;\(ETCDIR="\)/usr/local/\(etc/kamailio"\);\1%{l_prefix}/\2;' \
michael@408 219 -e 's;PATH=\$PATH:/usr/local/sbin;PATH=%{l_prefix}/sbin:$PATH;' \
michael@408 220 -e 's;\(MYLIBDIR="\)/usr/local/\(lib/kamailio/kamctl"\);\1%{l_prefix}/\2;' \
michael@408 221 utils/kamctl/kam*ctl
michael@408 222 %{l_shtool} subst \
michael@408 223 -e 's;/var/run/\(kamailio.pid\);%{l_prefix}/var/kamailio/\1;g' \
michael@408 224 utils/kamctl/kamctl.base \
michael@408 225 utils/kamctl/kamctlrc
michael@408 226 %{l_shtool} subst \
michael@408 227 -e 's;\(#include.*\)memcache\.h;\1libmemcached/memcached.h;' \
michael@408 228 modules_k/memcached/memcached.h
michael@548 229 %{l_shtool} subst \
michael@548 230 -e 's;u_int\([0-9]*\)_t;uint\1_t;g' \
michael@548 231 modules_s/bdb/bdb_api.c \
michael@548 232 modules/db_berkeley/km_bdb_lib.h \
michael@548 233 modules/db_berkeley/km_db_berkeley.c \
michael@548 234 modules/db_berkeley/bdb_lib.h \
michael@548 235 modules/sipcapture/sipcapture.h \
michael@548 236 modules/iptrtpproxy/iptrtpproxy.c \
michael@389 237
michael@389 238 %build
michael@389 239 # select modules
michael@408 240 modslist='acc alias_db auth auth_identity avp avpops avp_db benchmark blst call_control cfgutils cfg_db cfg_rpc counters cpl-c ctl db_text db_flatstore db_ops debugger dialog dialplan dispatcher diversion domain domainpolicy drouting eval exec enum fifo gflags group htable imc kex lcr malloc_test mangler matrix maxfwd mi_datagram mi_fifo mi_rpc mediaproxy mqueue msilo mtree nathelper nat_traversal options path pdb pdt peering perl perlvdb permissions pike pipelimit prefix_route presence presence_b2b presence_conference presence_dialoginfo presence_mwi presence_reginfo presence_xml pua pua_bla pua_dialoginfo pua_mi pua_reginfo pua_usrloc pua_xmpp pv qos ratelimit regex registrar rr rls rtimer rtpproxy sanity sdpops seas sipcapture siptrace siputils sl sms speeddial sqlops sst statistics textops textopsx timer tm tmx topoh uac uac_redirect uri uri_db userblacklist usrloc utils xcap xcap_client xcap_server xhttp xlog xmlops xmlrpc xmpp'
michael@389 241 %if "%{with_ssl}" == "yes"
michael@389 242 modslist="$modslist tls"
michael@389 243 %endif
michael@389 244 %if "%{with_croute}" == "yes"
michael@389 245 modslist="$modslist carrierroute"
michael@389 246 %endif
michael@389 247 %if "%{with_ldap}" == "yes"
michael@389 248 modslist="$modslist ldap h350"
michael@389 249 %endif
michael@389 250 %if "%{with_memcached}" == "yes"
michael@389 251 modslist="$modslist memcached"
michael@389 252 %endif
michael@389 253 %if "%{with_osp}" == "yes"
michael@389 254 modslist="$modslist osp"
michael@389 255 %endif
michael@389 256 %if "%{with_radius}" == "yes"
michael@389 257 modslist="$modslist acc_radius auth_radius avp_radius group misc_radius uri_radius"
michael@389 258 %endif
michael@389 259 %if "%{with_snmp}" == "yes"
michael@389 260 modslist="$modslist snmpstats"
michael@389 261 %endif
michael@389 262 %if "%{with_bdb}" == "yes"
michael@389 263 modslist="$modslist db_berkeley"
michael@389 264 %endif
michael@389 265 %if "%{with_mysql}" == "yes"
michael@389 266 modslist="$modslist db_mysql"
michael@389 267 %endif
michael@389 268 %if "%{with_pgsql}" == "yes"
michael@389 269 modslist="$modslist db_postgres"
michael@389 270 %endif
michael@408 271 %if "%{with_sqlite}" == "yes"
michael@408 272 modslist="$modslist db_sqlite"
michael@408 273 %endif
michael@389 274 %if "%{with_odbc}" == "yes"
michael@389 275 modslist="$modslist db_unixodbc"
michael@389 276 %endif
michael@389 277 %if "%{with_lua}" == "yes"
michael@389 278 modslist="$modslist app_lua"
michael@389 279 %endif
michael@389 280 %if "%{with_python}" == "yes"
michael@389 281 modslist="$modslist app_python"
michael@389 282 %endif
michael@389 283 %if "%{with_geoip}" == "yes"
michael@389 284 modslist="$modslist geoip"
michael@389 285 %endif
michael@389 286
michael@389 287 # build configuration
michael@389 288 %{l_make} %{l_mflags} \
michael@389 289 CC="%{l_cc}" \
michael@389 290 FLAVOUR=kamailio \
michael@408 291 DESTDIR=$RPM_BUILD_ROOT \
michael@408 292 INSTALL="%{l_shtool} install -c" \
michael@408 293 TAR="tar" \
michael@389 294 %if "%{with_sctp}" == "yes"
michael@389 295 SCTP=1 \
michael@389 296 %endif
michael@389 297 %if "%{with_ssl}" == "yes"
michael@389 298 TLS_HOOKS=1 \
michael@389 299 %endif
michael@389 300 prefix=%{l_prefix} \
michael@389 301 cfg
michael@389 302
michael@389 303 # build program
michael@389 304 %{l_make} %{l_mflags -O} \
michael@389 305 CC="%{l_cc}" \
michael@389 306 %if "%{with_sctp}" == "yes"
michael@389 307 SCTP=1 \
michael@389 308 %endif
michael@389 309 %if "%{with_ssl}" == "yes"
michael@389 310 TLS_HOOKS=1 \
michael@389 311 %endif
michael@389 312 prefix=%{l_prefix} \
michael@389 313 kamailio
michael@389 314
michael@389 315 # build utilities
michael@389 316 %{l_make} %{l_mflags -O} \
michael@389 317 CC="%{l_cc}" \
michael@389 318 %if "%{with_sctp}" == "yes"
michael@389 319 SCTP=1 \
michael@389 320 %endif
michael@389 321 %if "%{with_ssl}" == "yes"
michael@389 322 TLS_HOOKS=1 \
michael@389 323 %endif
michael@389 324 prefix=%{l_prefix} \
michael@389 325 modules="$modslist" \
michael@389 326 utils utils/kamctl
michael@389 327
michael@389 328 # build modules
michael@389 329 %{l_make} %{l_mflags -O} \
michael@389 330 CC="%{l_cc}" \
michael@389 331 LD_RPATH=-Wl,-rpath, \
michael@389 332 SER_RPATH_LST=%{l_prefix}/lib/kamailio \
michael@389 333 %if "%{with_sctp}" == "yes"
michael@389 334 SCTP=1 \
michael@389 335 %endif
michael@389 336 %if "%{with_ssl}" == "yes"
michael@389 337 TLS_HOOKS=1 \
michael@389 338 %endif
michael@389 339 include_modules="$modslist" \
michael@389 340 skip_modules="" \
michael@389 341 prefix=%{l_prefix} \
michael@389 342 every-module
michael@389 343
michael@389 344 %install
michael@389 345 # select modules
michael@408 346 modslist='acc alias_db auth auth_identity avp avpops avp_db benchmark blst call_control cfgutils cfg_db cfg_rpc counters cpl-c ctl db_text db_flatstore db_ops debugger dialog dialplan dispatcher diversion domain domainpolicy drouting eval exec enum fifo gflags group htable imc kex lcr malloc_test mangler matrix maxfwd mi_datagram mi_fifo mi_rpc mediaproxy mqueue msilo mtree nathelper nat_traversal options path pdb pdt peering perl perlvdb permissions pike pipelimit prefix_route presence presence_b2b presence_conference presence_dialoginfo presence_mwi presence_reginfo presence_xml pua pua_bla pua_dialoginfo pua_mi pua_reginfo pua_usrloc pua_xmpp pv qos ratelimit regex registrar rr rls rtimer rtpproxy sanity sdpops seas sipcapture siptrace siputils sl sms speeddial sqlops sst statistics textops textopsx timer tm tmx topoh uac uac_redirect uri uri_db userblacklist usrloc utils xcap xcap_client xcap_server xhttp xlog xmlops xmlrpc xmpp'
michael@389 347 %if "%{with_ssl}" == "yes"
michael@389 348 modslist="$modslist tls"
michael@389 349 %endif
michael@389 350 %if "%{with_croute}" == "yes"
michael@389 351 modslist="$modslist carrierroute"
michael@389 352 %endif
michael@389 353 %if "%{with_ldap}" == "yes"
michael@389 354 modslist="$modslist ldap h350"
michael@389 355 %endif
michael@389 356 %if "%{with_memcached}" == "yes"
michael@389 357 modslist="$modslist memcached"
michael@389 358 %endif
michael@389 359 %if "%{with_osp}" == "yes"
michael@389 360 modslist="$modslist osp"
michael@389 361 %endif
michael@389 362 %if "%{with_radius}" == "yes"
michael@389 363 modslist="$modslist acc_radius auth_radius avp_radius group misc_radius uri_radius"
michael@389 364 %endif
michael@389 365 %if "%{with_snmp}" == "yes"
michael@389 366 modslist="$modslist snmpstats"
michael@389 367 %endif
michael@389 368 %if "%{with_bdb}" == "yes"
michael@389 369 modslist="$modslist db_berkeley"
michael@389 370 %endif
michael@389 371 %if "%{with_mysql}" == "yes"
michael@389 372 modslist="$modslist db_mysql"
michael@389 373 %endif
michael@389 374 %if "%{with_pgsql}" == "yes"
michael@389 375 modslist="$modslist db_postgres"
michael@389 376 %endif
michael@389 377 %if "%{with_odbc}" == "yes"
michael@389 378 modslist="$modslist db_unixodbc"
michael@389 379 %endif
michael@389 380 %if "%{with_lua}" == "yes"
michael@389 381 modslist="$modslist app_lua"
michael@389 382 %endif
michael@389 383 %if "%{with_python}" == "yes"
michael@389 384 modslist="$modslist app_python"
michael@389 385 %endif
michael@389 386 %if "%{with_geoip}" == "yes"
michael@389 387 modslist="$modslist geoip"
michael@389 388 %endif
michael@389 389
michael@389 390 # install program, utils, and modules
michael@389 391 %{l_make} %{l_mflags} \
michael@389 392 include_modules="$modslist" \
michael@389 393 skip_modules="" \
michael@389 394 install
michael@389 395
michael@408 396 # pare unused documentation
michael@408 397 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/kamailio/docmodules*
michael@408 398
michael@389 399 # strip down installation
michael@389 400 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
michael@389 401
michael@389 402 # create installation hierarchy
michael@389 403 %{l_shtool} mkdir -f -p -m 700 \
michael@389 404 $RPM_BUILD_ROOT%{l_prefix}/var/kamailio
michael@389 405
michael@389 406 # install OSSP fsl configuration
michael@389 407 %{l_shtool} mkdir -f -p -m 755 \
michael@389 408 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
michael@389 409 %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@389 410 %{SOURCE fsl.kamailio} \
michael@389 411 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
michael@389 412
michael@389 413 # install runcommand script
michael@389 414 %{l_shtool} mkdir -f -p -m 755 \
michael@389 415 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
michael@389 416 %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@389 417 %{SOURCE rc.kamailio} \
michael@389 418 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
michael@389 419
michael@389 420 # determine installation files
michael@389 421 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
michael@389 422 %{l_files_std} \
michael@389 423 '%not %dir %{l_prefix}/etc/fsl' \
michael@389 424 '%config %{l_prefix}/etc/fsl/*' \
michael@389 425 '%config %{l_prefix}/etc/kamailio/*' \
michael@389 426 '%doc %{l_prefix}/share/kamailio/doc/*' \
michael@389 427 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/kamailio'
michael@389 428
michael@389 429 %files -f files
michael@389 430
michael@389 431 %clean
michael@389 432
michael@389 433 %post
michael@389 434 # on install, setup database (kamctl db create /pfx/var/kamailio/db)
michael@389 435 if [ ! -d $RPM_INSTALL_PREFIX/var/kamailio/db ]; then
michael@389 436 %{l_shtool} mkdir -f -p -m 700 -o %{l_rusr} -g %{l_rgrp} \
michael@389 437 $RPM_INSTALL_PREFIX/var/kamailio/db
michael@389 438 rm -f $RPM_INSTALL_PREFIX/share/kamailio/dbtext/*.orig
michael@389 439 %{l_shtool} install -c -m 600 -o %{l_rusr} -g %{l_rgrp} \
michael@389 440 $RPM_INSTALL_PREFIX/share/kamailio/dbtext/* \
michael@389 441 $RPM_INSTALL_PREFIX/var/kamailio/db/
michael@389 442 fi
michael@389 443
michael@389 444 # after upgrade, restart service
michael@389 445 [ $1 -eq 2 ] || exit 0
michael@389 446 eval `%{l_rc} kamailio status 2>/dev/null`
michael@389 447 [ ".$kamailio_active" = .yes ] && %{l_rc} kamailio restart
michael@389 448 exit 0
michael@389 449
michael@389 450 %preun
michael@389 451 # before erase, stop service and remove log files
michael@389 452 [ $1 -eq 0 ] || exit 0
michael@389 453 %{l_rc} kamailio stop 2>/dev/null
michael@389 454 rm -rf $RPM_INSTALL_PREFIX/var/kamailio/db 2>/dev/null || true
michael@389 455 rm -f $RPM_INSTALL_PREFIX/var/kamailio/* 2>/dev/null || true
michael@389 456 exit 0
michael@389 457

mercurial