File usb_modeswitch.spec of Package usb_modeswitch

# spec file for package usb_modeswitch
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, 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

%define source_name	usb-modeswitch
%define date		20170806
%define _udevdir %(pkg-config --variable=udevdir udev)
Name:           usb_modeswitch
Version:        2.5.1
Release:        0
Summary:        A mode switching tool for controlling multiple-device USB gear
License:        GPL-2.0+
Group:          Hardware/Mobile
Patch1:         usb_modeswitch-fix_fsf_address.patch
BuildRequires:  fdupes
BuildRequires:  pkg-config
BuildRequires:  tcl
BuildRequires:  pkgconfig(libusb-1.0)
BuildRequires:  pkgconfig(udev)
BuildRequires:  systemd
Requires:       tcl >= 8.4
Requires:       usb_modeswitch-data = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

USB_ModeSwitch is a mode switching tool for controlling "flip flop"
(multiple device) USB gear. It allows so-called "Zero-CD" devices that
show up as USB storage initially to be switched into their more useful
"application mode". This is most common for UMTS/3G wireless WAN

%package data
Summary:        Data Files for USB Modeswitch
Group:          Hardware/Mobile
Requires:       %{name} = %{version}
BuildArch:      noarch

%description data
Data files for usb_modeswitch package.

%setup -q -a1 -n %{source_name}-%{version}

cp %{SOURCE2} .
cp %{SOURCE3} .

CFLAGS="%{optflags}" make

# The install target recreates usb_modeswitch_dispatcher, which is racy in respect to its
# installation. install-common just uses the file from the build phase. boo#998641
make DESTDIR=%{buildroot} install-common %{?_smp_mflags} UDEVDIR=%{buildroot}%{_udevdir}
install -Dm 444 usb_modeswitch@.service %{buildroot}%{_unitdir}/usb_modeswitch@.service

cd %{source_name}-data-%{date}
make DESTDIR=%{buildroot} install %{?_smp_mflags} RULESDIR=%{buildroot}%{_udevdir}/rules.d

%fdupes -s %{buildroot}

%service_add_pre usb_modeswitch@.service

%service_add_post usb_modeswitch@.service

%service_del_preun usb_modeswitch@.service

%service_del_postun usb_modeswitch@.service

%doc README COPYING device_reference.txt parameter_reference.txt
%config %{_sysconfdir}/usb_modeswitch.conf

%files data

openSUSE Build Service is sponsored by