From f76dd1fe89ce5bcd812aa766564ec2e099a2d88c Mon Sep 17 00:00:00 2001 From: Jonathan Dieter Date: Thu, 15 Jan 2015 16:54:28 +0200 Subject: [PATCH] Initial release --- .gitignore | 1 + extract_usbip.sh | 19 ++++++++ sources | 1 + usbip-client.service | 10 ++++ usbip-server.service | 9 ++++ usbip.spec | 107 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 147 insertions(+) create mode 100755 extract_usbip.sh create mode 100644 usbip-client.service create mode 100644 usbip-server.service create mode 100644 usbip.spec diff --git a/.gitignore b/.gitignore index e69de29..4266f0a 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/usbip-3.18.tar.xz diff --git a/extract_usbip.sh b/extract_usbip.sh new file mode 100755 index 0000000..ec4dd1e --- /dev/null +++ b/extract_usbip.sh @@ -0,0 +1,19 @@ +#!/bin/sh +if [ "q$1" == "q" ]; then + echo "Usage: $0 " + exit 1 +fi +echo "Extracting linux source" +tar -xf "linux-$1".tar.xz +if [ "$?" -ne "0" ]; then + echo "Error extracting kernel source" + exit 1 +fi +if [ -d "usbip-$1" ]; then + rm -rf "usbip-$1" +fi +mv "linux-${1}"/tools/usb/usbip "usbip-$1" +echo "Creating usbip archive" +tar -cJvf "usbip-$1".tar.xz "usbip-$1" +rm -rf "linux-$1" +rm -rf "usbip-$1" diff --git a/sources b/sources index e69de29..d23ebad 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +e90a3347a759ab9ba0000bd358012974 usbip-3.18.tar.xz diff --git a/usbip-client.service b/usbip-client.service new file mode 100644 index 0000000..2562e7b --- /dev/null +++ b/usbip-client.service @@ -0,0 +1,10 @@ +[Unit] +Description=USB/IP client modules + +[Service] +Type=OneShot +RemainAfterExit=true +ExecStart=/sbin/modprobe -qab vhci-hcd + +[Install] +WantedBy=multi-user.target diff --git a/usbip-server.service b/usbip-server.service new file mode 100644 index 0000000..52bf9ed --- /dev/null +++ b/usbip-server.service @@ -0,0 +1,9 @@ +[Unit] +Description=USB/IP server daemon + +[Service] +ExecStartPre=/sbin/modprobe -qab usbip_host +ExecStart=/usr/sbin/usbipd + +[Install] +WantedBy=multi-user.target diff --git a/usbip.spec b/usbip.spec new file mode 100644 index 0000000..bfe274c --- /dev/null +++ b/usbip.spec @@ -0,0 +1,107 @@ +%global _hardened_build 1 + +Name: usbip +License: GPLv2+ +Summary: USB/IP user-space +Group: System Environment/Daemons +Version: 3.18 +Release: 3%{?dist} +#Source: https://www.kernel.org/pub/linux/kernel/v3.x/linux-%%{version}.tar.xz +# In the interests of keeping the source rpm from being ridiculously large, +# download the Linux kernel from above and run `extract_usbip.sh ` +# in the SOURCE directory. +URL: https://www.kernel.org +Source: usbip-%{version}.tar.xz +Source1: usbip-server.service +Source2: usbip-client.service +Source99: extract_usbip.sh +Requires: kmod(usbip-core.ko) +Requires: kmod(usbip-host.ko) +Requires: kmod(vhci-hcd.ko) +Requires: hwdata +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +BuildRequires: systemd +BuildRequires: libudev-devel +BuildRequires: libtool autoconf + +# Use the same directory of the main package for subpackage licence and docs +%global _docdir_fmt %{name} + +%description +USB/IP allows you to share USB devices over a network. With USB/IP, you can +plug a USB device into one computer and use it on a different computer on the +network. + +This package contains the user-space tools for USB/IP, both for servers and +clients + +%package devel +Summary: USB/IP headers and development libraries +Group: System Environment/Libraries +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +This package contains headers and static libraries for USB/IP user-space +development + +%prep +%setup -q + +%build +./autogen.sh +%configure --disable-static --with-usbids-dir=%{_datadir}hwdata +make %{?_smp_mflags} + +%install +%make_install +rm -f %{buildroot}%{_libdir}/libusbip*.la +mkdir -p %{buildroot}%{_unitdir} +install -pm 644 %{SOURCE1} %{buildroot}%{_unitdir} +install -pm 644 %{SOURCE2} %{buildroot}%{_unitdir} + +%post +%systemd_post usbip-client.service usbip-server.service +/sbin/ldconfig + +%preun +%systemd_preun usbip-client.service usbip-server.service + +%postun +%systemd_postun_with_restart usbip-client.service usbip-server.service +/sbin/ldconfig + +%files +%license COPYING +%doc README AUTHORS +%{_sbindir}/* +%{_libdir}/*.so.* +%{_mandir}/man8/* +%{_unitdir}/* + +%files devel +%license COPYING +%{_includedir}/* +%{_libdir}/*.so + +%changelog +* Thu Jan 15 2015 - Jonathan Dieter - 3.18-3 +- Improve description + +* Wed Jan 14 2015 - Jonathan Dieter - 3.18-2 +- Remove clean section +- Remove defattr in files list +- Use license macro for COPYING +- Use combined doc directory +- Combine systemd macros into one +- Remove /etc/default config file +- Stop rmmoding when services stop +- Remove unneeded After=syslog.target in services +- Update to 3.18 +- Replace /usr/share with datadir macro in configure +- Switch to make_install macro +- When manually using install, preserve timestamps + +* Tue Dec 16 2014 - Jonathan Dieter - 3.17-1 +- Initial release