Skip to content

Commit

Permalink
net: Allow to configure hostname via TARGET_HOSTNAME
Browse files Browse the repository at this point in the history
  • Loading branch information
wolneykien authored and antohami committed Jan 5, 2023
1 parent ff66f76 commit 3dcca39
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions features.in/net/README
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
Эта фича конфигурирует базовую поддержку сети, включая нужную подсистему
(etcnet, NetworkManager поверх etcnet или connman).

Используйте TARGET_HOSTNAME для определения имени узла (файлы
/etc/sysconfig/network и /etc/hostname).
1 change: 1 addition & 0 deletions features.in/net/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use/net: use/services use/pkgpriorities
@$(call add,THE_PACKAGES,iputils)
@$(call add,PINNED_PACKAGES,$$(THE_NET_SUBSYS))
@$(call set,THE_NET_SUBSYS,network-config-subsystem)
@$(call xport,TARGET_HOSTNAME)

use/net/etcnet: use/net
@$(call set,THE_NET_SUBSYS,etcnet)
Expand Down
10 changes: 10 additions & 0 deletions features.in/net/rootfs/image-scripts.d/50-net-hostname
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh -efu
#
# Sets up the node's hostname.

. shell-config

if [ -n "${GLOBAL_TARGET_HOSTNAME:-}" ]; then
shell_config_set /etc/sysconfig/network 'TARGET_HOSTNAME' "$GLOBAL_TARGET_HOSTNAME"
echo "$GLOBAL_TARGET_HOSTNAME" >/etc/hostname
fi

0 comments on commit 3dcca39

Please sign in to comment.