Skip to content

Commit 9d82527

Browse files
author
DevelopmentalOctopus
committed
initial
0 parents  commit 9d82527

File tree

5 files changed

+109
-0
lines changed

5 files changed

+109
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea/
2+
Makefile

Dockerfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
FROM ubuntu:22.04
2+
# https://github.com/intiface/intiface-cli-rs/releases/latest
3+
ARG INTIFACE_CLI_VERSION=50
4+
5+
RUN mkdir -p /opt/intiface
6+
ENV PATH /opt/intiface:$PATH
7+
WORKDIR /opt/intiface
8+
# NOTE: some packages that are useful for debugging: bluez-tools, bluez-hcidump, btscanner, rfkill, usbutils
9+
10+
# https://github.com/intiface/intiface-desktop#linux-issues
11+
ARG DEBIAN_FRONTEND=noninteractive
12+
RUN apt-get -qy update \
13+
&& apt-get install -qy \
14+
bluez \
15+
libcap2-bin \
16+
unzip \
17+
wget \
18+
&& apt-get -qy clean \
19+
&& rm -rf /var/lib/apt/lists/* \
20+
&& wget -qO intiface-cli.zip https://github.com/intiface/intiface-cli-rs/releases/download/v${INTIFACE_CLI_VERSION}/intiface-cli-rs-linux-x64-Release.zip \
21+
&& unzip intiface-cli.zip \
22+
&& rm intiface-cli.zip \
23+
&& chmod +x IntifaceCLI \
24+
&& setcap cap_net_raw+eip IntifaceCLI \
25+
&& wget -qO device-config.json https://raw.githubusercontent.com/buttplugio/buttplug/master/buttplug/buttplug-device-config/buttplug-device-config.json \
26+
&& echo BLUETOOTH_ENABLED=1 | tee -a /etc/default/bluetooth
27+
28+
# TODO check for 404; version might have been bumped.
29+
RUN wget -qO libssl.deb http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1l-1ubuntu1.6_amd64.deb \
30+
&& dpkg -i libssl.deb \
31+
&& rm libssl.deb
32+
33+
COPY entrypoint.sh .
34+
RUN chmod 755 entrypoint.sh
35+
36+
ENTRYPOINT "/opt/intiface/entrypoint.sh"
37+
EXPOSE 12345
38+
39+
# Off/Error/Warn/Info/Debug/Trace
40+
ENV INTIFACE_CLI_LOG_LEVEL 'Info'
41+
ENV INTIFACE_CLI_SERVER_NAME 'Intiface Server'
42+
ENV INTIFACE_CLI_WITHOUT '--without-hid --without-serial --without-lovense-dongle-hid --without-lovense-dongle-serial'
43+
ENV INTIFACE_CLI_OVERRIDE_ALL_ARGS 'false'
44+
45+
ENV INTIFACE_CLI_REDOWNLOAD_DEVICE_CONFIG 'true'
46+
47+
# TODO healthcheck on the port.
48+
# TODO run as non-root
49+
# TODO be sure host kernel has bluetooth kernel module AND supports your bluetooth adapter.

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# intiface-cli-docker
2+
3+
Docker Container for [intiface-cli](https://github.com/intiface/intiface-cli-rs).
4+
5+
Works in kubernetes too.
6+
7+
Be sure your host kernel has a bluetooth kernel module AND supports your bluetooth adapter.
8+
9+
Remember that you can't mount symlinks (from udevadm etc.)
10+
11+
# TODO
12+
- run as non-root
13+
- healthcheck
14+
- basic one actually makes intiface-cli crash.

docker-compose.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: "3.7"
2+
3+
services:
4+
intiface:
5+
devices:
6+
- "/dev/bus/usb/FILL_IN_HERE:/dev/ttyUSB0" # TODO cgroup permissions?
7+
network_mode: "host"
8+
privileged: true
9+
restart: unless-stopped
10+
build: .
11+
ports:
12+
- "12345:12345"
13+
cap_add:
14+
- SYS_ADMIN

entrypoint.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
service dbus start
6+
service bluetooth start
7+
timeout 10s bash -c 'until service bluetooth status; do sleep 1; done'
8+
bluetoothctl list
9+
10+
if [[ "${INTIFACE_CLI_REDOWNLOAD_DEVICE_CONFIG}" == "true" ]]; then
11+
wget -qO device-config.json https://raw.githubusercontent.com/buttplugio/buttplug/master/buttplug/buttplug-device-config/buttplug-device-config.json
12+
fi
13+
14+
IntifaceCLI --version
15+
16+
# https://github.com/intiface/intiface-cli-rs#running
17+
if [[ "${INTIFACE_CLI_OVERRIDE_ALL_ARGS}" == "false" ]]; then
18+
exec IntifaceCLI \
19+
--servername "${INTIFACE_CLI_SERVER_NAME}" \
20+
--deviceconfig device-config.json \
21+
--stayopen \
22+
--wsallinterfaces \
23+
--wsinsecureport 12345 \
24+
--log "${INTIFACE_CLI_LOG_LEVEL}" \
25+
${INTIFACE_CLI_WITHOUT}
26+
else
27+
exec IntifaceCLI ${INTIFACE_CLI_OVERRIDE_ALL_ARGS}
28+
fi
29+
30+
# TODO --stayopen wanted?

0 commit comments

Comments
 (0)