FOG Post Deploy Script Rename Host (Linux)


  • Hi

    Below are my post install script. Im trying to change the hostname for ubuntu desktop image but it is not taking effect. I’m using virtual box to trying out my script. May i know which part of my script having problem?

    . /usr/share/fog/lib/funcs.sh
    #########################################################
    # Functions
    #########################################################
    FUNC_DOTS() {
        max=65
        if [ -n "$1" ]; then
    		n=`expr $max - ${#1}`
    		echo -n " * ${1:0:max}"
    		if [ "$n" -gt 0 ]; then
    			for i in $(seq $n); do
    				printf %s .
    			done
    		fi
    	fi
    }
    
    #########################################################
    # Update hostname file
    #########################################################
    FUNC_DOTS "Updating /etc/hostname"
    echo $hostname
    echo $hostname >/etc/hostname
    echo "Done"
    
  • Moderator

    @wt_101 If I can suggest you look at this post: https://forums.fogproject.org/topic/11126/using-fog-postinstall-scripts-for-windows-driver-injection-2017-ed

    it gives you an idea how to do this with windows. You can use the same concept, except for maybe look for the partition that has an /etc directory.

    Here is a bit older script that shows a few different techniques. https://forums.fogproject.org/topic/7740/the-magical-mystical-fog-post-download-script


  • I have found the problem which i missing out of the below segment connecting my drive. After adding below script it is working fine.

    Currently i find the disk “/dev/sda5” during my partclone deploy screen and paste into above code.

    osdiskpart="/dev/sda5";
    mkdir /ntfs 2>/dev/null
    mount "${osdiskpart}" /ntfs 2>/tmp/mntfail
    

    This raise another question on “/dev/sda5” where can i get the osdiskpart based on the images so that i do not need to hardcode into my post deploy script?

344
Online

9.0k
Users

15.6k
Topics

145.1k
Posts