Browse Source

Fix system-hostname to set hostname in a way compatible with Calamares

Signed-off-by: Strahinya Radich <strajder@artixlinux.org>
master
Strahinya Radich 5 days ago
parent
commit
2805d5fbbd
  1. 1
      module/boot@/service/all-Local
  2. 1
      module/boot@/service/local/local-dmesg
  3. 27
      module/boot@/service/local/local-sethostname
  4. 33
      module/boot@/service/system/system-hostname
  5. 1
      service/boot@

1
module/boot@/service/all-Local

@ -14,7 +14,6 @@ local-nftables
local-ebtables
local-arptables
local-loop
local-sethostname
local-time
local-authfiles
local-tmpfiles

1
module/boot@/service/local/local-dmesg

@ -11,7 +11,6 @@ local-nftables
local-ebtables
local-arptables
local-loop
local-sethostname
local-time
local-tmpfiles
local-authfiles

27
module/boot@/service/local/local-sethostname

@ -1,27 +0,0 @@
[main]
@type = oneshot
@version = @vers@
@description = "Set hostname on /etc/hostname file"
@options = ( !log )
@depends = ( mount-rw )
@user = ( root )
[start]
@execute =
(
if { 66-yeller -cdp local-sethostname -1 /dev/console starts... }
if -nt {
execl-envfile ${conf_file}
execl-cmdline -s {
redirfd -w 1 ${conf_file_hostname}
66-echo -- ${HOSTNAME}
}
}
66-yeller -fcdp local-sethostname -1 /dev/console crashed!
)
[environment]
conf_file=!@bootconf@
conf_file_hostname=!/etc/hostname

33
module/boot@/service/system/system-hostname

@ -8,15 +8,36 @@
[start]
@execute =
(
if { 66-yeller -cdp system-hostname -1 /dev/console starts... }
if -nt {
if { 66-yeller -cdp system-hostname -1 /dev/console starts... }
execl-envfile ${conf_file}
s6-hostname ${HOSTNAME}
# 1. Load envfile; if HOSTNAME is not empty, call s6-hostname to set the
# value of that variable as the new hostname
#
# 2. Otherwise, if /etc/hostname is present, feed the first line from
# that file to s6-hostname
#
# 3. If both fail, default to the value of def_hostname, which is set to
# "artixlinux" by default
#
if -nt {
}
66-yeller -Wcdp system-hostname -1 /dev/console failed! -- check hostname
execl-envfile ${conf_file}
importas -D "" HOSTNAME HOSTNAME
ifelse { [ -n "${HOSTNAME}" ] }
{
s6-hostname ${HOSTNAME}
}
ifelse { [ -f /etc/hostname ] }
{
pipeline { sed 1q /etc/hostname }
withstdinas -E hostname s6-hostname "${hostname}"
}
s6-hostname ${def_hostname}
}
66-yeller -Wcdp system-hostname -1 /dev/console failed! -- check hostname
)
[environment]
conf_file=!@bootconf@
def_hostname=!artixlinux

1
service/boot@

@ -41,6 +41,7 @@
#======================= Global Settings ===============================
## Set your HOSTNAME.
## If set to empty, /etc/hostname will be used instead.
@HOSTNAME@

Loading…
Cancel
Save