mirror of
https://github.com/commaai/agnos-builder.git
synced 2026-07-24 16:32:12 +08:00
Avahi ssh publish (#476)
* add avahi-daemon and avahi-utils * avahi override * enable avahi daemon * avahi publish * Update userspace/usr/comma/avahi-publish-service.sh Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * Update avahi-publish-service.sh * Update userspace/files/avahi-ssh-publish.service Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * add device alias * remove openpilot reference --------- Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
This commit is contained in:
@@ -222,6 +222,9 @@ RUN echo "precedence ::ffff:0:0/96 100" >> /etc/gai.conf
|
||||
# Don't let logind delete /dev/shm
|
||||
COPY ./userspace/files/logind.conf /etc/systemd/logind.conf
|
||||
|
||||
# Copy Avahi daemon override
|
||||
COPY ./userspace/files/avahi-override.conf /etc/systemd/system/avahi-daemon.service.d/override.conf
|
||||
|
||||
# Remove qt network bearer plugins
|
||||
RUN rm -rf /usr/lib/aarch64-linux-gnu/qt5/plugins/bearer
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
[Unit]
|
||||
After=network.target
|
||||
Wants=network.target
|
||||
@@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description=Publish comma SSH service via Avahi
|
||||
After=avahi-daemon.service network.target
|
||||
Requires=avahi-daemon.service
|
||||
Wants=network.target
|
||||
StartLimitIntervalSec=0
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/comma/avahi-publish-service.sh
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
User=comma
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -13,7 +13,9 @@ apt-fast update && apt-fast install -y --no-install-recommends \
|
||||
ncdu \
|
||||
nfs-common \
|
||||
socat \
|
||||
wavemon
|
||||
wavemon \
|
||||
avahi-daemon \
|
||||
avahi-utils
|
||||
|
||||
# color prompt
|
||||
sed -i 's/#force_color_prompt=yes/force_color_prompt=yes/g' /home/comma/.bashrc
|
||||
|
||||
@@ -24,6 +24,8 @@ systemctl enable ssh-param-watcher.service
|
||||
systemctl enable adb-param-watcher.path
|
||||
systemctl enable adb-param-watcher.service
|
||||
systemctl enable logrotate-hourly.timer
|
||||
systemctl enable avahi-daemon
|
||||
systemctl enable avahi-ssh-publish.service
|
||||
|
||||
# Disable some of our services
|
||||
systemctl disable agnos-tests.service
|
||||
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Read the raw device model
|
||||
RAW_MODEL=$(tr -d '\0' < /sys/firmware/devicetree/base/model)
|
||||
|
||||
# Extract the device model (e.g., tici, tizi, mici)
|
||||
MODEL=$(echo "$RAW_MODEL" | sed 's/comma //g' | awk '{print $1}')
|
||||
|
||||
[ -z "$MODEL" ] && MODEL="unknown"
|
||||
|
||||
HOSTNAME=$(hostname)
|
||||
SERVICE_NAME="comma SSH - $MODEL - [$HOSTNAME]"
|
||||
|
||||
ALIAS_FILE="/data/params/d_tmp/ApiCache_Device"
|
||||
ALIAS=$(jq -e -r '.alias // empty' "$ALIAS_FILE" 2>/dev/null | grep -E '\S' || echo "$RAW_MODEL")
|
||||
|
||||
# Publish avahi service
|
||||
exec avahi-publish -s "$SERVICE_NAME" _ssh._tcp 22 "vendor=comma" "device=comma" "model=$MODEL" "alias=$ALIAS"
|
||||
Reference in New Issue
Block a user