Working/Current Wipe-->image method?
-
I’ve been searching the forums but the most recent post I can find is from ~3yrs ago. Like many, I’m looking for an automated solution to wipe the drive of a connected computer and once completed, start re-imaging.
I’ve come across this post for adding the wipe function to the main menu and george1421’s code works beautifully (well the wipe works, the ‘loop back to menu’ part crashes). That said, I’m wondering if there is a way to ‘tack-on’ the code from the fog.deployimage menu item so that once the wipe is finished, the imaging begins.
I’ve tried to do this in the simplest way, by copy–>pasting the two ‘parameters’ into a new menu entry but it seems that the wipe is skipped and the imaging starts immediately.
Does anyone have any idea how this might actually work? Is there a ‘wait for current process to end’ command I could throw in?
That said, is there any documentation ANYWHERE that has what kind of code is used in fog? Or a list of functions/variables that I could research?
Thanks in advance for any help given!
-
The short answer is you can’t do it that way but there is a way to hack your way to what you want.
You will need to replace the master FOG script with one that you tweak.
The master FOG script is here: https://github.com/FOGProject/fos/blob/master/Buildroot/board/FOG/FOS/rootfs_overlay/bin/fog
This file actually resides on the FOS Linux engine disk. More on that later.You will see at line 77 there is a call to
fog.download
that looks like thiselse case $type in down) fog.download ;; up) fog.upload ;; *)
Now we’ll look at this file: https://github.com/FOGProject/fos/blob/master/Buildroot/board/FOG/FOS/rootfs_overlay/bin/fog.wipe Specifically around line 24.
normal) echo -e " Starting normal disk wipe of $hd using shred...\n" usleep 10000000 shred -f -v -n 1 "$hd" echo -e "\n Wiping complete.\n" ;;
If we were to glue those bits together.
else case $type in down) hd="" [[ -z $seconds ]] && seconds=60 getHardDisk echo -e " Starting normal disk wipe of $hd using shred...\n" usleep 10000000 shred -f -v -n 1 "$hd" echo -e "\n Wiping complete.\n" fog.download ;; up) fog.upload ;; *) [[ -z $type ]] && type="Null" handleError "Fatal Error: Unknown request type :: $type" ;; esac fi
So you will want to download the master fog script
fog
from github and then use notepad++ (not windows notepad) to edit it. Then move the master scriptfog
to the fog server and follow the same concept as in this tutorial I use to patch fog.man.reg script, but in your case you will just replace thefog
script
https://forums.fogproject.org/topic/13500/dynamically-patching-fos-using-a-postinit-scriptWill it work ?? Heck I don’t know. On paper it should, but I have not tested it for flow or syntax error. YMMV
-
george1421, you are a bad mofo! I’ll try this out later today and report back with the results.
Thanks brotha!