mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
pikvm/kvmd#170: alternative implementation
This commit is contained in:
parent
fb9d860cf2
commit
5c3ac4c9c1
@ -55,6 +55,39 @@ rw
|
||||
|
||||
# ========== First boot configuration ==========
|
||||
|
||||
make_avahi_service() {
|
||||
local _serial
|
||||
_serial=$(tr -d '\0' < /proc/device-tree/serial-number || echo "0000000000000000")
|
||||
local _model
|
||||
_model=$(tr -d '\0' < /proc/device-tree/model || echo "Unknown model")
|
||||
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>serial=$_serial</txt-record>
|
||||
<txt-record>model=$_model</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>serial=$_serial</txt-record>
|
||||
<txt-record>model=$_model</txt-record>
|
||||
</service>
|
||||
</service-group>
|
||||
end_of_file
|
||||
}
|
||||
|
||||
if [ -n "$FIRSTBOOT$FIRST_BOOT" ]; then
|
||||
( \
|
||||
(umount /etc/machine-id || true) \
|
||||
@ -90,6 +123,8 @@ 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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user