initial vhclient

This commit is contained in:
Hans Karlinius
2024-11-13 16:18:39 +01:00
parent 6260eb304b
commit 61fb4cda6c
24 changed files with 55 additions and 101 deletions
+7
View File
@@ -0,0 +1,7 @@
## 0.1.1
- Updates
## 0.1.0
- Initial release
+3
View File
@@ -0,0 +1,3 @@
# Home Assistant Add-on: VirtualHere Client
## How to use
+41
View File
@@ -0,0 +1,41 @@
ARG BUILD_FROM=ghcr.io/hassio-addons/base:16.3.6
# hadolint ignore=DL3006
FROM ${BUILD_FROM}
# Copy root filesystem
COPY rootfs /
# https://www.virtualhere.com/sites/default/files/usbclient/vhclient${BUILD_ARCH}
RUN \
curl -sSLf -o /usr/bin/vhclient \
"https://www.virtualhere.com/sites/default/files/usbclient/vhclientx86_64"
RUN chmod a+x /usr/bin/vhclient
# Build arguments
ARG BUILD_ARCH
ARG BUILD_DATE
ARG BUILD_DESCRIPTION
ARG BUILD_NAME
ARG BUILD_REF
ARG BUILD_REPOSITORY
ARG BUILD_VERSION
# Labels
LABEL \
io.hass.name="${BUILD_NAME}" \
io.hass.description="${BUILD_DESCRIPTION}" \
io.hass.arch="${BUILD_ARCH}" \
io.hass.type="addon" \
io.hass.version=${BUILD_VERSION} \
maintainer="Hans Karlinius <carlscrona@gmail.com>" \
org.opencontainers.image.title="${BUILD_NAME}" \
org.opencontainers.image.description="${BUILD_DESCRIPTION}" \
org.opencontainers.image.vendor="Home Assistant Community Add-ons" \
org.opencontainers.image.authors="Hans Karlinius <carlscrona@gmail.com>" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.url="https://addons.community" \
org.opencontainers.image.source="https://github.com/${BUILD_REPOSITORY}" \
org.opencontainers.image.documentation="https://github.com/${BUILD_REPOSITORY}/blob/main/README.md" \
org.opencontainers.image.created=${BUILD_DATE} \
org.opencontainers.image.revision=${BUILD_REF} \
org.opencontainers.image.version=${BUILD_VERSION}
+1
View File
@@ -0,0 +1 @@
# Home Assistant Add-on: VirtualHere Client
+57
View File
@@ -0,0 +1,57 @@
#include <tunables/global>
profile example flags=(attach_disconnected,mediate_deleted) {
#include <abstractions/base>
# Capabilities
file,
signal (send) set=(kill,term,int,hup,cont),
# S6-Overlay
/init ix,
/bin/** ix,
/usr/bin/** ix,
/run/{s6,s6-rc*,service}/** ix,
/package/** ix,
/command/** ix,
/etc/services.d/** rwix,
/etc/cont-init.d/** rwix,
/etc/cont-finish.d/** rwix,
/run/{,**} rwk,
/dev/tty rw,
# Bashio
/usr/lib/bashio/** ix,
/tmp/** rwk,
# Access to options.json and other files within your addon
/data/** rw,
# Start new profile for service
/usr/bin/my_program cx -> my_program,
profile my_program flags=(attach_disconnected,mediate_deleted) {
#include <abstractions/base>
# Receive signals from S6-Overlay
signal (receive) peer=*_example,
# Access to options.json and other files within your addon
/data/** rw,
# Access to mapped volumes specified in config.json
/share/** rw,
# Access required for service functionality
# Note: List was built by doing the following:
# 1. Add what is obviously needed based on what is in the script
# 2. Add `complain` as a flag to this profile temporarily and run the addon
# 3. Review the audit log with `journalctl _TRANSPORT="audit" -g 'apparmor="ALLOWED"'` and add other access as needed
# Remember to remove the `complain` flag when you are done
/usr/bin/my_program r,
/bin/bash rix,
/bin/echo ix,
/etc/passwd r,
/dev/tty rw,
}
}
+36
View File
@@ -0,0 +1,36 @@
name: VirtualHere Client add-on
version: "0.1.1"
slug: vhclient
description: VirtualHere Client
arch:
- armhf
- armv7
- aarch64
- amd64
- i386
url: "https://git.carlscrona.se/haka/home-assistant-addons"
startup: services
boot: manual
host_network: true
devices:
- /dev/mem
privileged:
- NET_ADMIN
- SYS_ADMIN
- SYS_RAWIO
- SYS_TIME
- SYS_NICE
full_access: true
apparmor: false
map:
- addon_config:rw
usb: true
usbip: true
kernel_modules: true
options:
autofind: false
schema:
autofind: bool
stage: experimental
init: false
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

+1
View File
@@ -0,0 +1 @@
/sbin/modprobe vhci-hcd
+1
View File
@@ -0,0 +1 @@
mount -o remount -t sysfs sysfs /sys
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env bashio
# ==============================================================================
# Take down the S6 supervision tree when example fails
# s6-overlay docs: https://github.com/just-containers/s6-overlay
# ==============================================================================
declare APP_EXIT_CODE=${1}
if [[ "${APP_EXIT_CODE}" -ne 0 ]] && [[ "${APP_EXIT_CODE}" -ne 256 ]]; then
bashio::log.warning "Halt add-on with exit code ${APP_EXIT_CODE}"
echo "${APP_EXIT_CODE}" > /run/s6-linux-init-container-results/exitcode
exec /run/s6/basedir/bin/halt
fi
bashio::log.info "Service restart after closing"
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/with-contenv bashio
bashio::log.info "Starting VirtualHere Client as a daemon"
exec /usr/bin/vhclient -n -c /addon_config/vhclient.conf -l /dev/stdout
+3
View File
@@ -0,0 +1,3 @@
#!/bin/bash
echo "All done!" > /share/example_addon_output.txt
+4
View File
@@ -0,0 +1,4 @@
configuration:
autofind:
name: AUTOFIND
description: Turn auto-find off