You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tourmaline/configs/crystal/configure-network/up.nu

34 lines
718 B
Plaintext

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] {
debug $"Configuring network with config ($cfg)"
set_hostname $cfg.hostname
create_hosts
if $cfg.ipv6_loopback {
create_ipv6_loopback
}
info "Configured network"
}