In our company, I'm creating an Ubuntu Autoinstaller (v. 20.04). For some company reasons, its required modify initramfs. (initrd file).
I'm created a script, and added a link to init
file in main
initrd folder. Its showing correctly, but I did not find a solution, how from this script, set hostname for currently installed system. Hostname after autoinstallation is ubuntu
always.
Question is: How to set hostname from custom initrd script?
I'm tried a lot attempts, but neither works.:
netcfg/get_hostname=$hostnam
or
mdadm --assemble --scan --homehost='$hostnam' --auto=yes --auto-update-homehost
or
echo "export HOST=\"$hostnam\"" | tee -a /etc/casper.conf >/dev/null
or
echo $hostnam | tee /etc/hostname >/dev/null
or
hostnamectl set-hostname $hostnam
Thanks.