summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authornomisge2020-06-04 17:39:31 +0200
committernomisge2020-06-04 17:39:31 +0200
commitf9883120cea0ac83d65716fae682c2079a9f9299 (patch)
tree83b6b69c8fe6eb8e400d9ae71ae5e428625125c1
downloadaur-f9883120cea0ac83d65716fae682c2079a9f9299.tar.gz
initial commit
-rw-r--r--.SRCINFO20
-rw-r--r--.gitignore9
-rw-r--r--PKGBUILD25
-rw-r--r--bind.conf6
-rw-r--r--remote.conf9
-rw-r--r--usbip-bind@.service17
-rw-r--r--usbip@.service14
7 files changed, 100 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..eb83e916207d
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,20 @@
+pkgbase = usbip-systemd
+ pkgdesc = Systemd service files for usbip - remote host and local client
+ pkgver = 1
+ pkgrel = 1
+ arch = any
+ license = GPL
+ depends = usbip
+ backup = etc/usbip/remote-devices/remote.conf
+ backup = etc/usbip/bind-devices/bind.conf
+ source = usbip-bind@.service
+ source = usbip@.service
+ source = remote.conf
+ source = bind.conf
+ sha256sums = 30f77b2bc666ec7360328aac2c7336dd77535dd9addf73083c672a7e20aaf2dc
+ sha256sums = 068c9680948e00997d78acd84eaccd78cf12c8bc332af9e10893679b9be61cc0
+ sha256sums = bf5c1ab65307aaedc964ab4666bcfde0f031149b64e5c832730d684f630b25d8
+ sha256sums = b7da25a1e649c1b18ff8736b355c2d5535038c9bfe85160b15ca5889f1bba67b
+
+pkgname = usbip-systemd
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..18221a914d7e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+*
+*/
+!.gitignore
+!.SRCINFO
+!PKGBUILD
+!bind.conf
+!remote.conf
+!usbip@.service
+!usbip-bind@.service
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..48d3f6dc4a41
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,25 @@
+# Maintainer: nomisge <nomisge @ live . de>
+pkgname=usbip-systemd
+pkgver=1
+pkgrel=1
+pkgdesc="Systemd service files for usbip - remote host and local client"
+arch=(any)
+license=('GPL')
+depends=('usbip')
+backup=('etc/usbip/remote-devices/remote.conf'
+ 'etc/usbip/bind-devices/bind.conf')
+source=("usbip-bind@.service"
+ "usbip@.service"
+ "remote.conf"
+ "bind.conf")
+sha256sums=('30f77b2bc666ec7360328aac2c7336dd77535dd9addf73083c672a7e20aaf2dc'
+ '068c9680948e00997d78acd84eaccd78cf12c8bc332af9e10893679b9be61cc0'
+ 'bf5c1ab65307aaedc964ab4666bcfde0f031149b64e5c832730d684f630b25d8'
+ 'b7da25a1e649c1b18ff8736b355c2d5535038c9bfe85160b15ca5889f1bba67b')
+package() {
+ cd "${srcdir}"
+ install -Dm644 "usbip-bind@.service" "${pkgdir}/usr/lib/systemd/system/usbip-bind@.service"
+ install -Dm644 "usbip@.service" "${pkgdir}/usr/lib/systemd/system/usbip@.service"
+ install -Dm644 "remote.conf" "${pkgdir}/etc/usbip/remote-devices/remote.conf"
+ install -Dm644 "bind.conf" "${pkgdir}/etc/usbip/bind-devices/bind.conf"
+}
diff --git a/bind.conf b/bind.conf
new file mode 100644
index 000000000000..497deca52c75
--- /dev/null
+++ b/bind.conf
@@ -0,0 +1,6 @@
+# /etc/usbip/bind-devices/bind.conf
+# This is a conf file for a dummy device, copy and/or change any occurence of 'bind' with your device name
+# Specifiy device by vendor and product id
+# e.g. USBIP_DEVICE=04f9:0169
+# then enable service: systemclt enable usbip-bind@bind.service
+USBIP_DEVICE=
diff --git a/remote.conf b/remote.conf
new file mode 100644
index 000000000000..8a245cacca1c
--- /dev/null
+++ b/remote.conf
@@ -0,0 +1,9 @@
+# /etc/usbip/remote-devices/remote.conf
+# This is a conf file for a dummy device, copy and/or change any occurence of 'remote' with your device name
+# Specify host by ip or hostname
+# USBIP_HOST=example.com
+# Specifiy device by vendor and product id
+# e.g. USBIP_DEVICE=012f:34ab
+# then start|stop service: systemclt start|stop usbip@remote.service
+USBIP_HOST=
+USBIP_DEVICE=
diff --git a/usbip-bind@.service b/usbip-bind@.service
new file mode 100644
index 000000000000..d4f19140ece2
--- /dev/null
+++ b/usbip-bind@.service
@@ -0,0 +1,17 @@
+# /etc/systemd/system/usbip-bind@.service
+[Unit]
+Description=USB-IP Binding on bus id %I
+After=network-online.target usbipd.service
+Wants=network-online.target
+Requires=usbipd.service
+
+[Service]
+Type=simple
+EnvironmentFile=/etc/usbip/bind-devices/%i.conf
+ExecStart=/bin/sh -c "/usr/bin/usbip bind -b $(/usr/bin/usbip list -p -l | grep '#usbid=$USBIP_DEVICE#' | cut '-d#' -f1)"
+RemainAfterExit=yes
+ExecStop=/bin/sh -c "/usr/bin/usbip unbind -b $(/usr/bin/usbip list -p -l | grep '#usbid=$USBIP_DEVICE#' | cut '-d#' -f1)"
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
diff --git a/usbip@.service b/usbip@.service
new file mode 100644
index 000000000000..2ec7c99a918e
--- /dev/null
+++ b/usbip@.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=usbip client
+After=network.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+EnvironmentFile=/etc/usbip/remote-devices/%i.conf
+ExecStart=/bin/sh -c "/usr/bin/usbip attach -r $USBIP_HOST -b $(/usr/bin/usbip list -r $USBIP_HOST | grep $USBIP_DEVICE | cut -d: -f1)"
+ExecStop=/bin/sh -c "/usr/bin/usbip detach -p $(/usr/bin/usbip port | grep -B1 $USBIP_DEVICE | grep '<Port in Use>' | sed -E 's/^Port ([0-9][0-9]).*/\\1/')"
+
+#[Install]
+#WantedBy=multi-user.target
+