kamailio/kamailio.spec

Fri, 03 Aug 2012 17:18:55 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 03 Aug 2012 17:18:55 +0200
changeset 468
695288b7c41a
parent 391
9ea3ce683273
child 548
efb4f295e1cf
permissions
-rw-r--r--

Blind commit, looks like I discovered ugly conditional binary names.

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@408 34 Version: 3.2.2
michael@408 35 Release: 20120208
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@389 63 Prefix: %{l_prefix}
michael@389 64 BuildRoot: %{l_buildroot}
michael@389 65 BuildPreReq: OpenPKG, openpkg >= 20060823
michael@389 66 PreReq: OpenPKG, openpkg >= 20060823
michael@389 67 BuildPreReq: libxml, expat, curl, readline
michael@389 68 PreReq: libxml, expat, curl, readline
michael@389 69 BuildPreReq: make, gcc, flex, bison, sed, pkgconfig
michael@389 70 PreReq: bash
michael@389 71 %if "%{with_cons}" == "yes"
michael@389 72 PreReq: perl-dbi, perl-term
michael@389 73 %endif
michael@389 74 %if "%{with_fsl}" == "yes"
michael@389 75 BuildPreReq: fsl
michael@389 76 PreReq: fsl
michael@389 77 %endif
michael@389 78 %if "%{with_ssl}" == "yes"
michael@389 79 BuildPreReq: openssl
michael@389 80 PreReq: openssl
michael@389 81 %endif
michael@389 82 %if "%{with_croute}" == "yes"
michael@389 83 BuildPreReq: confuse
michael@389 84 PreReq: confuse
michael@389 85 %endif
michael@389 86 %if "%{with_ldap}" == "yes"
michael@389 87 BuildPreReq: openldap
michael@389 88 PreReq: openldap
michael@389 89 %endif
michael@389 90 %if "%{with_memcached}" == "yes"
michael@389 91 BuildPreReq: memcached
michael@389 92 PreReq: memcached
michael@389 93 %endif
michael@389 94 %if "%{with_osp}" == "yes"
michael@389 95 BuildPreReq: osptoolkit
michael@389 96 PreReq: osptoolkit
michael@389 97 %endif
michael@389 98 %if "%{with_radius}" == "yes"
michael@389 99 BuildPreReq: radiusclient
michael@389 100 PreReq: radiusclient
michael@389 101 %endif
michael@389 102 %if "%{with_snmp}" == "yes"
michael@389 103 BuildPreReq: snmp
michael@389 104 PreReq: snmp
michael@389 105 %endif
michael@389 106 %if "%{with_bdb}" == "yes"
michael@389 107 BuildPreReq: db
michael@389 108 PreReq: db
michael@389 109 %endif
michael@389 110 %if "%{with_mysql}" == "yes"
michael@389 111 BuildPreReq: mysql
michael@389 112 PreReq: mysql
michael@389 113 %endif
michael@389 114 %if "%{with_pgsql}" == "yes"
michael@389 115 BuildPreReq: postgresql
michael@389 116 PreReq: postgresql
michael@389 117 %endif
michael@389 118 %if "%{with_odbc}" == "yes"
michael@389 119 BuildPreReq: unixodbc
michael@389 120 PreReq: unixodbc
michael@389 121 %endif
michael@389 122 %if "%{with_geoip}" == "yes"
michael@389 123 BuildPreReq: geoip
michael@389 124 PreReq: geoip
michael@389 125 %endif
michael@389 126 %if "%{with_lua}" == "yes"
michael@389 127 BuildPreReq: lua
michael@389 128 PreReq: lua
michael@389 129 %endif
michael@389 130 %if "%{with_python}" == "yes"
michael@389 131 BuildPreReq: python
michael@389 132 PreReq: python
michael@389 133 %endif
michael@389 134 AutoReq: no
michael@389 135 AutoReqProv: no
michael@389 136
michael@389 137 %description
michael@389 138 Kamailio is (beside Opensips) a successor to OpenSER, which in
michael@389 139 turn was spawned from FhG FOKUS's SIP Express Router (SER). It
michael@389 140 provides SIP (RFC3621) registrar, proxy and routing functionality.
michael@389 141 A C shell like scripting language provides for control over the
michael@389 142 server's behaviour. It's modular architecture allows for fine
michael@389 143 grained loading of required functionality.
michael@389 144
michael@389 145 Kamailio can be used as a: Kamailio fits in scenarios:
michael@389 146
michael@389 147 Registrar server SIP trunking
michael@389 148 Router, proxy SIP load balancing
michael@389 149 Redirect server SIP front end termination
michael@389 150 Presence agent Residential providers
michael@389 151 Back to back user agent white label solutions
michael@389 152 Instant messaging server Enterprise services
michael@389 153 SIP to SMS gateway LCR for multi gateways
michael@389 154 SIP to XMPP gateway
michael@389 155 Load balancer or dispatcher
michael@389 156 Front end for asterisk
michael@389 157 NAT traversal unit
michael@389 158 Application server
michael@389 159
michael@389 160 %track
michael@389 161 prog kamailio = {
michael@389 162 version = %{version}
michael@389 163 url = http://www.kamailio.org/pub/kamailio/
michael@389 164 regex = (\d+\.\d+\.\d+)/
michael@389 165 url = http://www.kamailio.org/pub/kamailio/__NEWVER__/src/
michael@389 166 regex = kamailio-(__VER__)_src\.tar\.gz
michael@389 167 }
michael@389 168
michael@389 169 %prep
michael@389 170 %setup -q
michael@389 171 %{l_shtool} subst \
michael@389 172 -e 's;\$(LOCALBASE)/[^/][^/]*/sctp.h;;g' \
michael@389 173 -e 's;\$(LOCALBASE)/ssl/include;`%{l_prefix}/bin/pkg-config --cflags-only-I openssl`;g' \
michael@389 174 -e 's;\$(LOCALBASE)/ssl/lib;`%{l_prefix}/bin/pkg-config --libs openssl`;g' \
michael@389 175 -e 's;LOCALBASE *[\?:]*=.*;LOCALBASE = %{l_prefix};g' \
michael@391 176 -e 's;\(data_dir\) *=.*;\1 = share/$(MAIN_NAME);g' \
michael@391 177 -e 's;\(doc_dir\) *=.*;\1 = share/$(MAIN_NAME)/doc;g' \
michael@391 178 -e 's;\(man_dir\) *=.*;\1 = man/;g' \
michael@389 179 Makefile.defs
michael@389 180 %{l_shtool} subst \
michael@389 181 -e 's;CFLAGS *= *$;CFLAGS = %{l_cflags -O};g' \
michael@389 182 -e 's;LDFLAGS *= *$;LDFLAGS = %{l_ldflags};g' \
michael@389 183 -e 's;C_INCLUDES *= *$;C_INCLUDES = %{l_cppflags};g' \
michael@389 184 Makefile.defs
michael@389 185 %{l_shtool} subst \
michael@389 186 -e 's;/usr/include/readline/readline.h;;g' \
michael@389 187 utils/sercmd/Makefile
michael@389 188 %{l_shtool} subst \
michael@389 189 -e 's;-I$(LOCALBASE)/Berkeley[^ ]* *;;g' \
michael@389 190 -e 's;-I$(LOCALBASE)/include[^ ]* *;;g' \
michael@389 191 -e 's;-I$(SYSBASE)/include[^ ]* *;;g' \
michael@389 192 -e 's;LIBS=.*;LIBS=`%{l_prefix}/bin/pkg-config --libs db`;g' \
michael@389 193 utils/db_berkeley/Makefile
michael@389 194 %{l_shtool} subst \
michael@391 195 -e 's;\(\$(data_prefix)/\$(data_dir)/.*\)/kamailio;\1;g' \
michael@389 196 utils/kamctl/Makefile
michael@389 197 %{l_shtool} subst \
michael@389 198 -e 's;\(radiusclient\)-ng;\1;g' \
michael@389 199 -e 's;/usr/local\(/etc/radiusclient/radiusclient.conf\);%{l_prefix}\1;' \
michael@389 200 Makefile.radius \
michael@389 201 lib/kcore/radius.h \
michael@389 202 modules_s/avp_radius/avp_radius.c \
michael@389 203 modules_s/uri_radius/checks.c \
michael@389 204 modules_s/uri_radius/urirad_mod.c \
michael@389 205 modules_s/acc_radius/acc_radius.c \
michael@389 206 modules_s/auth_radius/authrad_mod.c \
michael@389 207 modules_s/auth_radius/sterman.h
michael@389 208 %{l_shtool} subst \
michael@389 209 -e 's;\(DEFS *[\?:+]*=[^\\]*\);\1 -D__EXTENSIONS__;g' \
michael@389 210 modules/db_mysql/Makefile \
michael@389 211 modules/xmlrpc/Makefile
michael@389 212 %{l_shtool} subst \
michael@389 213 -e 's;\(-keyout.*\);\1 || true;' \
michael@389 214 modules/tls/sip-router_cert.sh
michael@408 215 %{l_shtool} subst \
michael@408 216 -e 's;^#! */bin/bash;#! %{l_prefix}/bin/bash;' \
michael@408 217 -e 's; /\(etc/kamailio\); %{l_prefix}/\1;' \
michael@408 218 -e 's;-f /usr/local/etc/kamailio/kamctlrc;false;' \
michael@408 219 -e 's; /usr/local/etc/kamailio/kamctlrc;unleash-betty-boop;' \
michael@408 220 -e 's;-f ~/.kamctlrc;false;g' \
michael@408 221 -e 's;-f ./kamctlrc;false;g' \
michael@408 222 -e 's;\(ETCDIR="\)/usr/local/\(etc/kamailio"\);\1%{l_prefix}/\2;' \
michael@408 223 -e 's;PATH=\$PATH:/usr/local/sbin;PATH=%{l_prefix}/sbin:$PATH;' \
michael@408 224 -e 's;\(MYLIBDIR="\)/usr/local/\(lib/kamailio/kamctl"\);\1%{l_prefix}/\2;' \
michael@408 225 utils/kamctl/kam*ctl
michael@408 226 %{l_shtool} subst \
michael@408 227 -e 's;/var/run/\(kamailio.pid\);%{l_prefix}/var/kamailio/\1;g' \
michael@408 228 utils/kamctl/kamctl.base \
michael@408 229 utils/kamctl/kamctlrc
michael@408 230 %{l_shtool} subst \
michael@408 231 -e 's;\(#include.*\)memcache\.h;\1libmemcached/memcached.h;' \
michael@408 232 modules_k/memcached/memcached.h
michael@389 233
michael@389 234 %build
michael@389 235 # select modules
michael@408 236 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 237 %if "%{with_ssl}" == "yes"
michael@389 238 modslist="$modslist tls"
michael@389 239 %endif
michael@389 240 %if "%{with_croute}" == "yes"
michael@389 241 modslist="$modslist carrierroute"
michael@389 242 %endif
michael@389 243 %if "%{with_ldap}" == "yes"
michael@389 244 modslist="$modslist ldap h350"
michael@389 245 %endif
michael@389 246 %if "%{with_memcached}" == "yes"
michael@389 247 modslist="$modslist memcached"
michael@389 248 %endif
michael@389 249 %if "%{with_osp}" == "yes"
michael@389 250 modslist="$modslist osp"
michael@389 251 %endif
michael@389 252 %if "%{with_radius}" == "yes"
michael@389 253 modslist="$modslist acc_radius auth_radius avp_radius group misc_radius uri_radius"
michael@389 254 %endif
michael@389 255 %if "%{with_snmp}" == "yes"
michael@389 256 modslist="$modslist snmpstats"
michael@389 257 %endif
michael@389 258 %if "%{with_bdb}" == "yes"
michael@389 259 modslist="$modslist db_berkeley"
michael@389 260 %endif
michael@389 261 %if "%{with_mysql}" == "yes"
michael@389 262 modslist="$modslist db_mysql"
michael@389 263 %endif
michael@389 264 %if "%{with_pgsql}" == "yes"
michael@389 265 modslist="$modslist db_postgres"
michael@389 266 %endif
michael@408 267 %if "%{with_sqlite}" == "yes"
michael@408 268 modslist="$modslist db_sqlite"
michael@408 269 %endif
michael@389 270 %if "%{with_odbc}" == "yes"
michael@389 271 modslist="$modslist db_unixodbc"
michael@389 272 %endif
michael@389 273 %if "%{with_lua}" == "yes"
michael@389 274 modslist="$modslist app_lua"
michael@389 275 %endif
michael@389 276 %if "%{with_python}" == "yes"
michael@389 277 modslist="$modslist app_python"
michael@389 278 %endif
michael@389 279 %if "%{with_geoip}" == "yes"
michael@389 280 modslist="$modslist geoip"
michael@389 281 %endif
michael@389 282
michael@389 283 # build configuration
michael@389 284 %{l_make} %{l_mflags} \
michael@389 285 CC="%{l_cc}" \
michael@389 286 FLAVOUR=kamailio \
michael@408 287 DESTDIR=$RPM_BUILD_ROOT \
michael@408 288 INSTALL="%{l_shtool} install -c" \
michael@408 289 TAR="tar" \
michael@389 290 %if "%{with_sctp}" == "yes"
michael@389 291 SCTP=1 \
michael@389 292 %endif
michael@389 293 %if "%{with_ssl}" == "yes"
michael@389 294 TLS_HOOKS=1 \
michael@389 295 %endif
michael@389 296 prefix=%{l_prefix} \
michael@389 297 cfg
michael@389 298
michael@389 299 # build program
michael@389 300 %{l_make} %{l_mflags -O} \
michael@389 301 CC="%{l_cc}" \
michael@389 302 %if "%{with_sctp}" == "yes"
michael@389 303 SCTP=1 \
michael@389 304 %endif
michael@389 305 %if "%{with_ssl}" == "yes"
michael@389 306 TLS_HOOKS=1 \
michael@389 307 %endif
michael@389 308 prefix=%{l_prefix} \
michael@389 309 kamailio
michael@389 310
michael@389 311 # build utilities
michael@389 312 %{l_make} %{l_mflags -O} \
michael@389 313 CC="%{l_cc}" \
michael@389 314 %if "%{with_sctp}" == "yes"
michael@389 315 SCTP=1 \
michael@389 316 %endif
michael@389 317 %if "%{with_ssl}" == "yes"
michael@389 318 TLS_HOOKS=1 \
michael@389 319 %endif
michael@389 320 prefix=%{l_prefix} \
michael@389 321 modules="$modslist" \
michael@389 322 utils utils/kamctl
michael@389 323
michael@389 324 # build modules
michael@389 325 %{l_make} %{l_mflags -O} \
michael@389 326 CC="%{l_cc}" \
michael@389 327 LD_RPATH=-Wl,-rpath, \
michael@389 328 SER_RPATH_LST=%{l_prefix}/lib/kamailio \
michael@389 329 %if "%{with_sctp}" == "yes"
michael@389 330 SCTP=1 \
michael@389 331 %endif
michael@389 332 %if "%{with_ssl}" == "yes"
michael@389 333 TLS_HOOKS=1 \
michael@389 334 %endif
michael@389 335 include_modules="$modslist" \
michael@389 336 skip_modules="" \
michael@389 337 prefix=%{l_prefix} \
michael@389 338 every-module
michael@389 339
michael@389 340 %install
michael@389 341 rm -rf $RPM_BUILD_ROOT
michael@389 342
michael@389 343 # select modules
michael@408 344 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 345 %if "%{with_ssl}" == "yes"
michael@389 346 modslist="$modslist tls"
michael@389 347 %endif
michael@389 348 %if "%{with_croute}" == "yes"
michael@389 349 modslist="$modslist carrierroute"
michael@389 350 %endif
michael@389 351 %if "%{with_ldap}" == "yes"
michael@389 352 modslist="$modslist ldap h350"
michael@389 353 %endif
michael@389 354 %if "%{with_memcached}" == "yes"
michael@389 355 modslist="$modslist memcached"
michael@389 356 %endif
michael@389 357 %if "%{with_osp}" == "yes"
michael@389 358 modslist="$modslist osp"
michael@389 359 %endif
michael@389 360 %if "%{with_radius}" == "yes"
michael@389 361 modslist="$modslist acc_radius auth_radius avp_radius group misc_radius uri_radius"
michael@389 362 %endif
michael@389 363 %if "%{with_snmp}" == "yes"
michael@389 364 modslist="$modslist snmpstats"
michael@389 365 %endif
michael@389 366 %if "%{with_bdb}" == "yes"
michael@389 367 modslist="$modslist db_berkeley"
michael@389 368 %endif
michael@389 369 %if "%{with_mysql}" == "yes"
michael@389 370 modslist="$modslist db_mysql"
michael@389 371 %endif
michael@389 372 %if "%{with_pgsql}" == "yes"
michael@389 373 modslist="$modslist db_postgres"
michael@389 374 %endif
michael@389 375 %if "%{with_odbc}" == "yes"
michael@389 376 modslist="$modslist db_unixodbc"
michael@389 377 %endif
michael@389 378 %if "%{with_lua}" == "yes"
michael@389 379 modslist="$modslist app_lua"
michael@389 380 %endif
michael@389 381 %if "%{with_python}" == "yes"
michael@389 382 modslist="$modslist app_python"
michael@389 383 %endif
michael@389 384 %if "%{with_geoip}" == "yes"
michael@389 385 modslist="$modslist geoip"
michael@389 386 %endif
michael@389 387
michael@389 388 # install program, utils, and modules
michael@389 389 %{l_make} %{l_mflags} \
michael@389 390 include_modules="$modslist" \
michael@389 391 skip_modules="" \
michael@389 392 install
michael@389 393
michael@408 394 # pare unused documentation
michael@408 395 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/kamailio/docmodules*
michael@408 396
michael@389 397 # strip down installation
michael@389 398 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
michael@389 399
michael@389 400 # create installation hierarchy
michael@389 401 %{l_shtool} mkdir -f -p -m 700 \
michael@389 402 $RPM_BUILD_ROOT%{l_prefix}/var/kamailio
michael@389 403
michael@389 404 # install OSSP fsl configuration
michael@389 405 %{l_shtool} mkdir -f -p -m 755 \
michael@389 406 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
michael@389 407 %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@389 408 %{SOURCE fsl.kamailio} \
michael@389 409 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
michael@389 410
michael@389 411 # install runcommand script
michael@389 412 %{l_shtool} mkdir -f -p -m 755 \
michael@389 413 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
michael@389 414 %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@389 415 %{SOURCE rc.kamailio} \
michael@389 416 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
michael@389 417
michael@389 418 # determine installation files
michael@389 419 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
michael@389 420 %{l_files_std} \
michael@389 421 '%not %dir %{l_prefix}/etc/fsl' \
michael@389 422 '%config %{l_prefix}/etc/fsl/*' \
michael@389 423 '%config %{l_prefix}/etc/kamailio/*' \
michael@389 424 '%doc %{l_prefix}/share/kamailio/doc/*' \
michael@389 425 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/kamailio'
michael@389 426
michael@389 427 %files -f files
michael@389 428
michael@389 429 %clean
michael@389 430 rm -rf $RPM_BUILD_ROOT
michael@389 431
michael@389 432 %post
michael@389 433 # on install, setup database (kamctl db create /pfx/var/kamailio/db)
michael@389 434 if [ ! -d $RPM_INSTALL_PREFIX/var/kamailio/db ]; then
michael@389 435 %{l_shtool} mkdir -f -p -m 700 -o %{l_rusr} -g %{l_rgrp} \
michael@389 436 $RPM_INSTALL_PREFIX/var/kamailio/db
michael@389 437 rm -f $RPM_INSTALL_PREFIX/share/kamailio/dbtext/*.orig
michael@389 438 %{l_shtool} install -c -m 600 -o %{l_rusr} -g %{l_rgrp} \
michael@389 439 $RPM_INSTALL_PREFIX/share/kamailio/dbtext/* \
michael@389 440 $RPM_INSTALL_PREFIX/var/kamailio/db/
michael@389 441 fi
michael@389 442
michael@389 443 # after upgrade, restart service
michael@389 444 [ $1 -eq 2 ] || exit 0
michael@389 445 eval `%{l_rc} kamailio status 2>/dev/null`
michael@389 446 [ ".$kamailio_active" = .yes ] && %{l_rc} kamailio restart
michael@389 447 exit 0
michael@389 448
michael@389 449 %preun
michael@389 450 # before erase, stop service and remove log files
michael@389 451 [ $1 -eq 0 ] || exit 0
michael@389 452 %{l_rc} kamailio stop 2>/dev/null
michael@389 453 rm -rf $RPM_INSTALL_PREFIX/var/kamailio/db 2>/dev/null || true
michael@389 454 rm -f $RPM_INSTALL_PREFIX/var/kamailio/* 2>/dev/null || true
michael@389 455 exit 0
michael@389 456

mercurial