Easy way to test post installation scripts?

  • I am new to using scripts and have written a simple one to start experimenting with.
    Now the problem is when I want to test this script I have to deploy a laptop and wait till the end to see if it works.
    Is there any way I can skill the deploy part and go straight to testing the scripts?

  • Moderator

    Typically a post install script relies on the image being on the computer because the post install script would interact with the image once its downloaded to the disk.

    With that said I can give you some tips to make debugging a bit easier.

    1. Schedule your deployment task, but before you hit the submit button tick the debug checkbox.
    2. PXE boot the target computer. After a few screens of text that needs to be cleared with the enter key you will be dropped to a linux command prompt.
      These next to steps are optional
    3. Get the IP address of the target computer using ip addr show
    4. Set root’s password with passwd give it a simple password like hello. Don’t worry it will be reset the system is rebooted.
    5. Now use putty and connect to the target computer using the information from steps 3 and 4. Using putty you will be able to cut/copy/paste a bit easier than using the FOS Linux console. But these 3 steps are up to you
      The rest of the steps work both from the putty shell as well as the console shell.
    6. Start the deployment process from the command prompt by keying in fog. You will now single step through the imaging process pressing enter at the each debugPause command. You can insert the debugPause command into your post install script to stop the deployment at critical points. Pressing enter will continue the script until the next debugPause breakpoint.


    1. Add liberal echo commands to indicate the start, execution of critical points and exit of your post install script.
    2. If something goes wrong, pressing ctrl-c will exit out of the deployment script at the point where you hit ctrl-c.
    3. If you are linux savvy you can navigate to where the postinstall script is and rerun just that script after you fix what needs fixing. (I don’t know the path off the top of my head, sorry)
    4. You can start the deployment process over again without needing to reboot by just keying in fog again at the command prompt.

    If you are interacting with windows, I have some post install scripts with examplesin the tutorial forum. While they are windows focused they should show you some trick you could implement in your scripts.