Add configure network implementation
parent
5548e05319
commit
e348549800
@ -1,5 +1,33 @@
|
||||
let RUN_IN_CHROOT = true;
|
||||
|
||||
def set_hostname [hostname: string] {
|
||||
debug $"Setting host name to ($hostname)"
|
||||
touch /etc/hostname
|
||||
$"\n($hostname)\n" | save -a /etc/hostname
|
||||
}
|
||||
|
||||
def create_hosts [] {
|
||||
debug "Configuring hosts file"
|
||||
touch /etc/hosts
|
||||
"\n127.0.0.1 localhost\n" | save -a /etc/hosts
|
||||
}
|
||||
|
||||
def create_ipv6_loopback [] {
|
||||
debug "Creating ipv6 loopback"
|
||||
touch /etc/hosts
|
||||
"\n::1 localhost\n" | save -a /etc/hosts
|
||||
}
|
||||
|
||||
# Applies all system changes of `configure-network`
|
||||
def main [cfg] {
|
||||
echo "Executing up task `configure-network` with config" $cfg
|
||||
debug $"Configuring network with config ($cfg)"
|
||||
|
||||
set_hostname $cfg.hostname
|
||||
create_hosts
|
||||
|
||||
if $cfg.ipv6_loopback {
|
||||
create_ipv6_loopback
|
||||
}
|
||||
|
||||
info "Configured network"
|
||||
}
|
||||
|
Loading…
Reference in New Issue