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?
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.
- Schedule your deployment task, but before you hit the submit button tick the debug checkbox.
- 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
- Get the IP address of the target computer using
ip addr show
- Set root’s password with
passwdgive it a simple password like hello. Don’t worry it will be reset the system is rebooted.
- 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.
- 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
debugPausecommand. You can insert the
debugPausecommand into your post install script to stop the deployment at critical points. Pressing enter will continue the script until the next
- Add liberal echo commands to indicate the start, execution of critical points and exit of your post install script.
- If something goes wrong, pressing ctrl-c will exit out of the deployment script at the point where you hit ctrl-c.
- 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)
- You can start the deployment process over again without needing to reboot by just keying in
fogagain 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.