aboutsummaryrefslogtreecommitdiffstats
path: root/unmaintained/usbip-utils
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@gmail.com>2016-08-25 15:26:24 +0200
committerCarlo Landmeter <clandmeter@gmail.com>2016-08-25 15:26:24 +0200
commitb6af1e02efe594039707cd882517663d5370f375 (patch)
treeff9c2d55873e051e82972ba64c017352d3a75d34 /unmaintained/usbip-utils
parenta71346b7acebc600960a98c84fb32cfd72fe864b (diff)
downloadaports-b6af1e02efe594039707cd882517663d5370f375.tar.bz2
aports-b6af1e02efe594039707cd882517663d5370f375.tar.xz
testing/[multiple]: move unmaintained packages
This moves all packages from testing to unmaintained which have not been updated for atleast 6 months. If you are affected by this commit please follow this proceddure: * make sure your packages build on all architectures * move your pacakge(s) back to testing * if you want to keep this package and can maintain it (or find somebody to maintain it for you) for a minimum of 6 months ask it to be moved to community
Diffstat (limited to 'unmaintained/usbip-utils')
-rw-r--r--unmaintained/usbip-utils/APKBUILD69
-rw-r--r--unmaintained/usbip-utils/sigcld.patch13
-rw-r--r--unmaintained/usbip-utils/usbip.confd18
-rw-r--r--unmaintained/usbip-utils/usbip.initd244
4 files changed, 344 insertions, 0 deletions
diff --git a/unmaintained/usbip-utils/APKBUILD b/unmaintained/usbip-utils/APKBUILD
new file mode 100644
index 0000000000..d75c042532
--- /dev/null
+++ b/unmaintained/usbip-utils/APKBUILD
@@ -0,0 +1,69 @@
+# Contributor: Der Tiger <der.tiger.alpine@arcor.de>
+# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
+pkgname=usbip-utils
+pkgver=3.14
+pkgrel=0
+pkgdesc="Utilities for USB device sharing over IP network"
+url="https://www.kernel.org/doc/readme/drivers-staging-usbip-userspace-README"
+arch="all"
+license="GPLv2"
+depends="glib sysfsutils usbutils"
+depends_dev="gcc automake autoconf libtool sysfsutils-dev glib-dev"
+makedepends="$depends_dev tar"
+install=""
+subpackages="$pkgname-dev $pkgname-doc"
+source="http://ftp.kernel.org/pub/linux/kernel/v3.x/linux-$pkgver.tar.gz
+ sigcld.patch
+ usbip.initd
+ usbip.confd"
+
+_baseurl="linux-$pkgver/drivers/staging/usbip/userspace"
+_builddir="$srcdir"/userspace
+
+prepare() {
+ mkdir -p "$srcdir"
+ mkdir -p "$_builddir"
+ tar -zxvf $srcdir/linux-$pkgver.tar.gz $_baseurl --strip-components=4 -C $_builddir
+
+ local i
+ cd "$_builddir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+}
+
+build() {
+ cd "$_builddir"
+ export CFLAGS=$(echo $CFLAGS | sed 's|-Os|-O2|')
+ export CPPFLAGS="$CFLAGS"
+ /bin/sh autogen.sh
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --libdir=/usr/lib \
+ --datarootdir=/usr/share
+ make || return 1
+}
+
+package() {
+ cd "$_builddir"
+ make DESTDIR="$pkgdir" install || return 1
+ install -m755 -D "$srcdir"/usbip.initd "$pkgdir"/etc/init.d/usbip
+ install -m755 -D "$srcdir"/usbip.confd "$pkgdir"/etc/conf.d/usbip
+}
+
+md5sums="47dbb96b400c694d52ac61f2149aadfd linux-3.14.tar.gz
+5d8ecbdfd0757538e59db7ea80b278a8 sigcld.patch
+c3f342cdda80901668dd5c437899a9af usbip.initd
+cc863a7da6390319cefa20297b35dd58 usbip.confd"
+sha256sums="967fe34abb97456bd2484bc7fdae8240e696aa00c4b0079f8e1e4382ebada2ce linux-3.14.tar.gz
+70b0a78cca949a5a834e0195676577a44461219056b5a9aab9ff329eb1425c3f sigcld.patch
+bcb4ea61ddeb7e1ecb9abf7890c0e98ba11042dd2b7409c8f1823ffae3b26fd8 usbip.initd
+f649eba29178dbaf903b938111f51994eb0e50a8fc004a1e85cc11fb598d5ecf usbip.confd"
+sha512sums="5d00fc3808ac0896c8009f41471e29d60ba5912a2e9dc4da2464e690d8f66442f00f14189bd90d556293ca111aba33097f4df06606eeca0c857d1e25fb80ff07 linux-3.14.tar.gz
+9572bcc378523cca337324b8519d87813310ae08a358811f8075d54f1e741eb68c8027f9073452e6e942178b46d2f2942d54e68f97f96665fcd6285cfebe07a7 sigcld.patch
+102f03eca0d4fea382cb6ded11c3c432ee211659a21cd2a03cb0ec3d02ea9f5c9684360db5799b706e61ba1eb63c305815364a8b663372e905273ab441a07c6b usbip.initd
+eb8de617e27c4d5fdfee9c442e8f74b0afb4d0fe7b59eca3a19629eb70fea7e09b3c125bc968aa8810d845ce661c829bd0f3fdb2288664f2cccf423bc0ae6ae8 usbip.confd"
diff --git a/unmaintained/usbip-utils/sigcld.patch b/unmaintained/usbip-utils/sigcld.patch
new file mode 100644
index 0000000000..8616faec35
--- /dev/null
+++ b/unmaintained/usbip-utils/sigcld.patch
@@ -0,0 +1,13 @@
+diff --git a/src/usbipd.c b/src/usbipd.c
+index 7980f8b..3ccf94f 100644
+--- a/src/usbipd.c
++++ b/src/usbipd.c
+@@ -451,7 +451,7 @@ static void set_signal(void)
+ sigaction(SIGTERM, &act, NULL);
+ sigaction(SIGINT, &act, NULL);
+ act.sa_handler = SIG_IGN;
+- sigaction(SIGCLD, &act, NULL);
++ sigaction(SIGCHLD, &act, NULL);
+ }
+
+ static const char *pid_file;
diff --git a/unmaintained/usbip-utils/usbip.confd b/unmaintained/usbip-utils/usbip.confd
new file mode 100644
index 0000000000..dcd259c2b2
--- /dev/null
+++ b/unmaintained/usbip-utils/usbip.confd
@@ -0,0 +1,18 @@
+#--------------------------------
+# USBIP Settings
+#--------------------------------
+# - Start daemon to share local devices
+USBIP_START_DAEMON=no
+
+# - Automatically bind local busses
+# format: "{bus} [{bus2} [..]]"
+# or : "{vendorID}:{productID} [..]"
+# example: "3-8 1-1 1b2c:4d1a"
+USBIP_AUTO_BIND=""
+
+# - Automatically attach remote busses
+# format: "{host ip} {remote bus} [..]"
+# or: "{host ip} {vendorID}:{productID} [..]"
+# example: "10.10.10.10 5-1 192.168.0.1 1234:abcd"
+USBIP_AUTO_ATTACH=""
+
diff --git a/unmaintained/usbip-utils/usbip.initd b/unmaintained/usbip-utils/usbip.initd
new file mode 100644
index 0000000000..58e2358c31
--- /dev/null
+++ b/unmaintained/usbip-utils/usbip.initd
@@ -0,0 +1,244 @@
+#!/sbin/runscript
+
+description="Load USBIP kernel modules and run daemon"
+
+: ${USBIP_EXEC:=$(which usbip)}
+: ${USBIP_EXEC_DAEMON:=$(which usbipd)}
+
+depend()
+{
+ provide usbip
+ need sysfs net
+}
+
+LoadKernelModule ()
+{
+ local module=$1
+ #-----------------
+ result=
+ if [ -z "$(/sbin/lsmod | grep "^$(basename $module)")" ]
+ then
+ local filename=$(/sbin/modprobe -l $module)
+ if [ -n "$filename" ]
+ then
+ if ! /sbin/modprobe $filename
+ then
+ eerror "Cannot load kernel module '$filename'."
+ result=failed
+ fi
+ else
+ eerror "Cannot find kernel module '$module'."
+ result=failed
+ fi
+ fi
+ [ -z "$result" ]
+}
+
+IsAvailable ()
+{
+ local bus_or_device=$(echo $1 | tr '[A-Z]' '[a-z]')
+ local host=$2
+ #-----------------
+ host=${host:+--remote=$host}
+ : ${host:=--local}
+ $USBIP_EXEC list --parsable $host |
+ sed -n 's|.*busid='$bus_or_device'#.*|yes|p; \
+ s|.*usbid='$bus_or_device'#.*|yes|p'
+}
+
+GetBus ()
+{
+ local device=$(echo $1 | tr '[A-Z]' '[a-z]')
+ local host=$2
+ #-----------------
+ host=${host:+--remote=$host}
+ : ${host:=--local}
+ case "$host" in
+ "--remote"*) # FIXME: USBIP bug causing remote devices not to be listed parsable
+ $USBIP_EXEC list --parsable $host |
+ sed -n 's|^[ \t]*\([0-9][0-9]*-[0-9][0-9]*\):.*('"$device"').*|\1|p';;
+ *)
+ $USBIP_EXEC list --parsable $host |
+ sed -n 's|.*busid=\([0-9][0-9]*-[0-9][0-9]*\)#usbid='"$device"'#.*|\1|p';;
+ esac
+}
+
+ExecuteUsbip()
+{
+ local command=$1
+ local bus=$2
+ local host=$3
+ local port=$4
+ #-----------------
+ local result=
+ if [ -n "$command" ]
+ then
+ if $USBIP_EXEC $command ${bus:+--busid=$bus} ${host:+--remote=$host} ${port:+--port $port} 1> /dev/null 2> /dev/null
+ then
+ einfo "Executed command '$command'${bus:+ with bus '$bus'}${host:+ on host '$host'}${port:+ on port '$port'}, successfully."
+ else
+ ewarn "Executing command '$command'${bus:+ with bus '$bus'}${host:+ on host '$host'}${port:+ on port '$port'} failed."
+ result=failed
+ fi
+ fi
+ [ -z "$result" ]
+}
+
+ValidateCommand ()
+{
+ local command=$1
+ local bus_or_device=$2
+ local host=$3
+ #-----------------
+ local result=
+ local bus=
+ if [ -z "$host" -o -n "$(echo $host | grep '^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$')" ]
+ then
+ if [ -n "$(echo $bus_or_device | grep '^[[:xdigit:]]\{4\}:[[:xdigit:]]\{4\}$')" ]
+ then
+ bus="$(GetBus $bus_or_device $host)"
+ if [ -z "$bus" ]
+ then
+ ewarn "Device '$bus_or_device' not available${host:+ on host '$host'}."
+ result=failed
+ fi
+ else
+ if [ -n "$(echo $bus_or_device | grep '^[0-9][0-9]*-[0-9][0-9]*$')" ]
+ then
+ bus=$bus_or_device
+ else
+ ewarn "Unrecognized bus or device '$bus_or_device'."
+ result=failed
+ fi
+ fi
+ if [ -n "$bus" ]
+ then
+ case "$command" in
+ "bind"|"unbind")
+ ExecuteUsbip $command $bus || result=failed;;
+ "attach")
+ if [ -n "$host" ]
+ then
+ ExecuteUsbip $command $bus $host || result=failed
+ else
+ ewarn "Host statement is missing in command '$command'."
+ result=failed
+ fi
+ ;;
+ *)
+ ewarn "Unhandled command '$command'."; result=failed;;
+ esac
+ fi
+ else
+ ewarn "Illegal host ip address '$host'."
+ result=failed
+ fi
+ [ -z "$result" ]
+}
+
+ProcessList ()
+{
+ local command=$1
+ shift
+ local list=$*
+ #-----------------
+ local result=
+ local no_host=
+ case "$command" in
+ "bind"|"unbind") no_host=yes;;
+ *) no_host=;;
+ esac
+ local host=
+ local item=
+ ( for item in $list
+ do
+ if [ -n "$host" -o -n "$no_host" ]
+ then
+ ValidateCommand $command $item $host || result=failed
+ host=
+ else
+ host=$item
+ fi
+ done
+ [ -z "$result" ] )
+}
+
+DetachAll ()
+{
+ # FIXME: At this stage, there is no way to get the vhci_hcd port id of any attached device
+ for port in $(seq 0 15)
+ do
+ $USBIP_EXEC detach --port $port 2> /dev/null
+ done
+ [ 1 -eq 1 ]
+}
+
+UnbindAll ()
+{
+ local result=
+ ProcessList unbind "$($USBIP_EXEC list --parsable --local | sed -n 's|^busid=\([0-9][0-9]*-[0-9][0-9]*\)#.*=usbip-host#$|\1|p' | tr '\n' ' ')"
+}
+
+start_daemon()
+{
+ ebegin "Starting usbip daemon"
+ if LoadKernelModule usbip-host
+ then
+ start-stop-daemon --start --exec $USBIP_EXEC_DAEMON -- -D
+ fi
+ eend $?
+}
+
+start()
+{
+ ebegin "Starting usbip"
+ if LoadKernelModule usbip-core
+ then
+ if LoadKernelModule vhci-hcd
+ then
+ eend 0
+ if yesno "${USBIP_START_DAEMON:-no}"
+ then
+ start_daemon
+ fi
+ if [ -n "$USBIP_AUTO_BIND" ]
+ then
+ ebegin "Auto-binding local busses"
+ ProcessList bind $USBIP_AUTO_BIND
+ eend $?
+ fi
+ if [ -n "$USBIP_AUTO_ATTACH" ]
+ then
+ ebegin "Auto-attaching remote busses"
+ ProcessList attach $USBIP_AUTO_ATTACH
+ eend $?
+ fi
+ else
+ eend 1
+ fi
+ else
+ eend 1
+ fi
+}
+
+stop_daemon()
+{
+ ebegin "Stopping usbip daemon"
+ start-stop-daemon --stop --exec $USBIP_EXEC_DAEMON
+ eend $?
+}
+
+stop()
+{
+ ebegin "Detaching remote busses"
+ DetachAll
+ eend $?
+ ebegin "Un-binding local busses"
+ UnbindAll
+ eend $?
+ if [ -n "$(pidof $(basename "$USBIP_EXEC_DAEMON"))" ]
+ then
+ stop_daemon
+ fi
+}
+