mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-02 13:53:01 +02:00
Add script to generate entries for external ports
For the user to be able to enable them in runtime
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
pkglibexec_SCRIPTS = bootstrap error load \
|
||||
gen-hostkeys gen-admin-auth gen-hostname gen-interfaces gen-motd
|
||||
gen-hostkeys gen-admin-auth gen-hostname gen-interfaces gen-motd gen-hardware
|
||||
|
||||
@@ -98,6 +98,7 @@ factory()
|
||||
# Create an overlay for /etc/hostname to change the default in an br2-external
|
||||
gen-hostname >"$FACTORY_D/20-hostname.json"
|
||||
gen-motd >"$FACTORY_D/20-motd.json"
|
||||
gen-hardware >"$FACTORY_D/20-hardware.json"
|
||||
# shellcheck disable=SC2086
|
||||
gen-interfaces $GEN_IFACE_OPTS >"$FACTORY_D/20-interfaces.json"
|
||||
|
||||
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
usb_ports=$(cat /run/system.json | jq -r '.["usb-ports"] | map(.name) | unique | join(" ")')
|
||||
|
||||
gen_port()
|
||||
{
|
||||
local port="$1"
|
||||
cat <<EOF
|
||||
{
|
||||
"class": "infix-hardware:usb",
|
||||
"name": "$port",
|
||||
"state": {
|
||||
"admin-state": "unlocked"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
}
|
||||
cat <<EOF
|
||||
{
|
||||
"ietf-hardware:hardware": {
|
||||
"component": [
|
||||
$(for port in $usb_ports; do gen_port "$port"; done)
|
||||
]}
|
||||
}
|
||||
EOF
|
||||
Reference in New Issue
Block a user