Post Install Script does not work while deploying ubuntu 16.04 image using FOG.

I am getting “Command not found” error while deploying ubuntu 16.04 OS to a new system.
i used the Post install script in fog for ubuntu image deployment.
I followed this link: https://forums.fogproject.org/topic/7740/the-magical-mystical-fog-post-download-script
I am trying to install few applications and settings change for my requirement.
I created fog.sh file and edited with required commands to do the task, added fog.sh file path to fog.postdownload file as per the above article, still the same issue.

@sebastian-roth
Would you help me with the procedure to include chroot in my below mentioned script as i messed it up adding multiple things.?

I looked over your script. Looks like you’d put the chroot related lines at the start of your script. You should play around with chroot before doing this though. On a linux VM, boot to a live Ubuntu disk or something - then try to chroot from the Ubuntu disk to the local disk. Once you do this a couple times you’ll understand what chroot does and how to work with it. Also you should Google search it (or duckduckgo search it) too. We can’t do all your work for you, we rather show you the way.

@sebastian-roth
Thanks for the heads up.
However, i did add the chroot in the script, still it does not work.
Could you help me with adding this chroot command to my fog.sh script, how i can apply here.

First of all, thank you for sharing your script it helps greatly with resolving your issue.

The simple thing first. You can remove this line . /usr/share/fog/lib/funcs.sh since you are not using any of the fog built in functions.

Second, your script runs in the context of FOS. FOS is a highly customized version of linux, where target OS commands will not work as you found.

You can probably use the change root command like Sebastian mentioned, but I would be concerned about the operating environment of FOS interfering with ubuntu native commands like apt-get.

I think you should modify your postinstall script to drop this fog.sh script on your target system during imaging. Then configure ubuntu to execute this script via an rc.local startup script entry. Then at the end of your fog.sh script, have it remove the call to fog.sh from rc.local entry once fog.sh runs. That way your script is running within the context of your ubuntu environment.

To know where its failing we will need to see your fog.sh script to know where its actually failing. The command not found command simply indicates the command (function) you used is not available in FOS.