Rename Linux host after deployment
-
I have a dual boot deployment situation. I manage the Windows part with my own scripts, but I would like to rename the Ubuntu part after deployment (changing the host name to the same name as the host name registered in FOG).
Can this be done somehow?The partition structure is very simple. I have 4 primary MBR partitions: the Windows recovery partition, the Windows partition, the Ubuntu partition and the swap.
-
The short answer is yes probably.
The solution is with a fog postinstall script. This script gets run just after the image is deployed to the target computer and before the first boot of the target OS on the computer.
What you need to do is write a bash script that mounts the ubuntu partition and then you can run a sed script against the host name file for unbuntu to change the host name. In a fog post install script you can get fog system variables by calling a file from the fog server.
-
You probably want to read through this tutorial to gets some clues. https://forums.fogproject.org/topic/7740/the-magical-mystical-fog-post-download-script
I realize its MS Windows centric. But the coding is all bash scripting. Pay attention to the bits about the sed script that will update the unattend.xml file’s host name. A similar concept can be run against ubuntu’s host name file.
-
Ok. Thank you for the answer.
-
@andreiv Here you see some great examples: https://forums.fogproject.org/topic/4510/scripts-customization-of-ubuntu-fog-service-for-ubuntu
-
@george1421 Ok. Thanks.
-
@sebastian-roth Great! Thanks.