diff options
author | Alexander Sulfrian <asulfrian@zedat.fu-berlin.de> | 2021-08-26 04:53:06 +0200 |
---|---|---|
committer | Nuno Goncalves <nunojpg@gmail.com> | 2021-09-26 14:58:33 +0200 |
commit | 7e241da2b738bd7f3074eb8cc571f4b3184bfc80 (patch) | |
tree | 315349a18caf801fe0956690e73382936d4d2cbd /net/usbip/files | |
parent | 489e60de0804512d290f1fe9bb83db87c02ea75a (diff) |
usbip: Add init script for usbip-server
Signed-off-by: Alexander Sulfrian <asulfrian@zedat.fu-berlin.de>
Diffstat (limited to 'net/usbip/files')
-rw-r--r-- | net/usbip/files/usbipd.conf | 12 | ||||
-rw-r--r-- | net/usbip/files/usbipd.init | 31 |
2 files changed, 43 insertions, 0 deletions
diff --git a/net/usbip/files/usbipd.conf b/net/usbip/files/usbipd.conf new file mode 100644 index 000000000..260323f94 --- /dev/null +++ b/net/usbip/files/usbipd.conf @@ -0,0 +1,12 @@ + +config server + option enable '1' + + # Set listen port + #option port '' + + # Listen on IPv4 + option ipv4 '1' + + # Listen on IPv6 + option ipv6 '1' diff --git a/net/usbip/files/usbipd.init b/net/usbip/files/usbipd.init new file mode 100644 index 000000000..e91770e54 --- /dev/null +++ b/net/usbip/files/usbipd.init @@ -0,0 +1,31 @@ +#!/bin/sh /etc/rc.common + +START=80 +USE_PROCD=1 + +usbipd_instance() { + local config="$1" + local enable + local port + local ipv4 + local ipv6 + + config_get_bool enable "$config" enable 1 + [ "${enable}" = "0" ] && return 1 + + config_get port "$config" port + config_get_bool ipv4 "$config" ipv4 1 + config_get_bool ipv6 "$config" ipv6 1 + + procd_open_instance usbipd + procd_set_param command /usr/sbin/usbipd + [ -n "${port}" ] && procd_append_param command -t${port} + [ "${ipv4}" = "1" ] && procd_append_param command --ipv4 + [ "${ipv6}" = "1" ] && procd_append_param command --ipv6 + procd_close_instance +} + +start_service() { + config_load usbipd + config_foreach usbipd_instance server +} |