File asterisk-chan-dongle.spec of Package asterisk-chan-dongle

#
# spec file for package asterisk-chan-dongle
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2018-2023 LISA GmbH, Bingen, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define realname chan_dongle
%define mod_dir  %{_libdir}/asterisk/modules
# Common info
Name:           asterisk-chan-dongle
Version:        20221104T100058.503dba8
Release:        0
Summary:        Asterisk's chan_dongle driver for Huawei UMTS cards
License:        GPL-2.0-only
Group:          Productivity/Telephony/Servers
URL:            https://github.com/wdoekes/asterisk-chan-dongle
Source:         %{realname}-%{version}.tar.xz
Patch:          chan-dongle-fix-locking.diff
BuildRequires:  asterisk-devel
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  libtool
BuildRequires:  pkgconfig(sqlite3)
BuildRequires:  pkgconfig(udev)
%{!?_udevrulesdir: %global _udevrulesdir %(pkg-config --variable=udevdir udev)/rules.d }
Requires:       asterisk
Requires:       udev
Provides:       chan-dongle
Provides:       chan_dongle
Provides:       asterisk-chan_dongle

%description
This channel driver should work with the following UMTS cards:
 * Huawei K3715
 * Huawei E169 / K3520
 * Huawei E155X
 * Huawei E175X
 * Huawei E261
 * Huawei K3765

Check complete list in: http://wiki.e1550.mobi/doku.php?id=requirements#list_of_supported_models

Before using this channel driver, make sure to:

 * Disable PIN code on your SIM card

Supported features:
 * Place and terminate voice calls
 * Send and receive SMS
 * Send and receive USSD commands / messages

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}
%patch -p1 

%build
./bootstrap
%configure \
 --with-astversion=16.0
 DESTDIR=%{mod_dir}
make %{?_smp_mflags}

# add asterisk user to lock group 
# chan_dongle tries to lock the devices in /var/lock
%pre
usermod -a -G dialout asterisk || :

%post
%{?udev_rules_update:%{udev_rules_update}}

# remove asterisk from the lock group (if uninstalled)
%postun
if [ "$1" = "0" ]; then
    gpasswd -d asterisk dialout || :
fi

%install
install -D -m755 chan_dongle.so %{buildroot}%{mod_dir}/chan_dongle.so

%files
%doc *.txt *.md BUGS etc
%{mod_dir}/chan_dongle.so

%changelog
openSUSE Build Service is sponsored by