Merge remote-tracking branch 'upstream/master'

This commit is contained in:
mofeng-git
2024-11-20 15:18:34 +00:00
166 changed files with 5421 additions and 2645 deletions

View File

@@ -50,10 +50,56 @@ fi
# shellcheck disable=SC1090
source <(dos2unix < /boot/pikvm.txt)
# shellcheck disable=SC1091
source /usr/share/kvmd/platform || true
rw
# ========== First boot configuration ==========
# ========== First boot and/or Avahi configuration ==========
make_avahi_service() {
local _base
local _serial
local _platform
_base=$(tr -d '\0' < /proc/device-tree/model || echo "Unknown base")
_serial=$( (cat /proc/device-tree/serial-number || echo "0000000000000000") | tr -d '\0' | tr '[:lower:]' '[:upper:]')
_platform="$PIKVM_MODEL-$PIKVM_VIDEO-$PIKVM_BOARD"
mkdir -p /etc/avahi/services
cat <<end_of_file > /etc/avahi/services/pikvm.service
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">pikvm-$_serial.local</name>
<service>
<type>_pikvm._tcp</type>
<port>443</port>
<txt-record>path=/</txt-record>
<txt-record>protocol=https</txt-record>
<txt-record>description=PiKVM Web Server</txt-record>
<txt-record>model=$PIKVM_MODEL</txt-record>
<txt-record>video=$PIKVM_VIDEO</txt-record>
<txt-record>board=$PIKVM_BOARD</txt-record>
<txt-record>base=$_base</txt-record>
<txt-record>serial=$_serial</txt-record>
<txt-record>platform=$_platform</txt-record>
</service>
<service>
<type>_https._tcp</type>
<port>443</port>
<txt-record>path=/</txt-record>
<txt-record>protocol=https</txt-record>
<txt-record>description=PiKVM Web Server</txt-record>
<txt-record>model=$PIKVM_MODEL</txt-record>
<txt-record>video=$PIKVM_VIDEO</txt-record>
<txt-record>board=$PIKVM_BOARD</txt-record>
<txt-record>base=$_base</txt-record>
<txt-record>serial=$_serial</txt-record>
<txt-record>model=$_platform</txt-record>
</service>
</service-group>
end_of_file
}
if [ -n "$FIRSTBOOT$FIRST_BOOT" ]; then
( \
@@ -90,11 +136,21 @@ if [ -n "$FIRSTBOOT$FIRST_BOOT" ]; then
unset disk part npart label
fi
make_avahi_service
# fc-cache is required for installed X server
# shellcheck disable=SC2015
which fc-cache && fc-cache || true
fi
if [ -n "$ENABLE_AVAHI" ]; then
if [ ! -f /etc/avahi/services/pikvm.service ]; then
make_avahi_service
fi
systemctl enable avahi-daemon || true
touch /boot/pikvm-reboot.txt
fi
# ========== OTG serial ==========

View File

@@ -55,7 +55,7 @@ cd "$path"
# - https://msol.io/blog/tech/create-a-self-signed-ecc-certificate
openssl ecparam -out server.key -name prime256v1 -genkey
openssl req -new -x509 -sha256 -nodes -key server.key -out server.crt -days 3650 \
-subj "/C=RU/ST=Moscow/L=Moscow/O=PiKVM/OU=PiKVM/CN=localhost"
-subj "/C=US/O=PiKVM/OU=PiKVM/CN=localhost"
#chown "root:kvmd-$target" "$path"/*
chmod 440 "$path/server.key"

View File

@@ -42,9 +42,6 @@ test -n "$port"
if [ "$port" = "HDMI-A-1" ]; then
status=$(head -n 1 "/sys/class/drm/$card-$port/status")
if [ "$status" = "connected" ]; then
if systemctl is-enabled -q kvmd-pass; then
systemctl restart kvmd-pass || true
fi
for pid in $(pgrep -f '^kvmd/streamer: ' || true); do
kill "$pid" || true
done