• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Working/Current Wipe-->image method?

    Scheduled Pinned Locked Moved
    FOG Problems
    2
    3
    214
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      smoooo
      last edited by smoooo

      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!

      1 Reply Last reply Reply Quote 0
      • george1421G
        george1421 Moderator
        last edited by george1421

        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 this

        else
            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 script fog 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 the fog script
        https://forums.fogproject.org/topic/13500/dynamically-patching-fos-using-a-postinit-script

        Will it work ?? Heck I don’t know. On paper it should, but I have not tested it for flow or syntax error. YMMV

        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

        1 Reply Last reply Reply Quote 0
        • S
          smoooo
          last edited by

          george1421, you are a bad mofo! I’ll try this out later today and report back with the results.

          Thanks brotha!

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post

          234

          Online

          12.0k

          Users

          17.3k

          Topics

          155.2k

          Posts
          Copyright © 2012-2024 FOG Project