mirror of
https://github.com/OpenVoiceOS/OpenVoiceOS
synced 2025-01-20 13:09:55 +01:00
MycroftOS: Addition of hostname-service
This little systemd service adds the last bits of the MAC address to the hostname for support of multiple MycroftOS's on the same network.
This commit is contained in:
parent
3c630c1c7c
commit
46d316880f
@ -9,6 +9,7 @@ menu "Additional drivers, libraries and/or applications"
|
||||
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/alsa-plugins/Config.in"
|
||||
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/btspeaker/Config.in"
|
||||
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/fann/Config.in"
|
||||
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/hostname-service/Config.in"
|
||||
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/mycroft-mpd/Config.in"
|
||||
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/respeaker/Config.in"
|
||||
source "$BR2_EXTERNAL_MYCROFTOS_PATH/package/snapcast/Config.in"
|
||||
|
@ -394,6 +394,7 @@ BR2_PACKAGE_WIFI_AP=y
|
||||
BR2_PACKAGE_ALSA_PLUGINS=y
|
||||
BR2_PACKAGE_BTSPEAKER=y
|
||||
BR2_PACKAGE_FANN=y
|
||||
BR2_PACKAGE_HOSTNAME_SERVICE=y
|
||||
BR2_PACKAGE_MYCROFT_MPD=y
|
||||
BR2_PACKAGE_RESPEAKER=y
|
||||
BR2_PACKAGE_SNAPCAST=y
|
||||
|
5
buildroot-external/package/hostname-service/Config.in
Normal file
5
buildroot-external/package/hostname-service/Config.in
Normal file
@ -0,0 +1,5 @@
|
||||
config BR2_PACKAGE_HOSTNAME_SERVICE
|
||||
bool "hostname-service"
|
||||
help
|
||||
A systemd service that adds the last bits
|
||||
of the MAC address to the hostname.
|
@ -0,0 +1,21 @@
|
||||
################################################################################
|
||||
#
|
||||
# hostname-service
|
||||
#
|
||||
################################################################################
|
||||
|
||||
HOSTNAME_SERVICE_VERSION = 0.1.0
|
||||
HOSTNAME_SERVICE_SITE = $(BR2_EXTERNAL_MYCROFTOS_PATH)/package/hostname-service
|
||||
HOSTNAME_SERVICE_SITE_METHOD = local
|
||||
HOSTNAME_SERVICE_LICENSE = Apache License 2.0
|
||||
HOSTNAME_SERVICE_LICENSE_FILES = LICENSE
|
||||
|
||||
define HOSTNAME_SERVICE_INSTALL_TARGET_CMDS
|
||||
$(INSTALL) -D -m 644 $(@D)/hostname.service \
|
||||
$(TARGET_DIR)/usr/lib/systemd/system/hostname.service
|
||||
mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
|
||||
ln -fs ../../../../usr/lib/systemd/system/hostname.service \
|
||||
$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/hostname.service
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
11
buildroot-external/package/hostname-service/hostname.service
Normal file
11
buildroot-external/package/hostname-service/hostname.service
Normal file
@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Set hostname to MycroftOS-[MAC]
|
||||
Before=systemd-networkd.service
|
||||
Before=avahi-daemon.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/sh -c "hostnamectl set-hostname MycroftOS-`sed 's/://g' /sys/class/net/eth0/address | tail -c 7`"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user