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

get imaged disk information for post download scripts

Scheduled Pinned Locked Moved Feature Request
12 Posts 3 Posters 3.5k Views
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.
  • G
    george1421 Moderator @mrayzies
    last edited by Jan 22, 2018, 8:33 PM

    @mrayzies ?? Not sure what you are saying. The ‘osdiskpart=/dev/sda2;’ makes me think you are looking at one of my early tutorials where for Win7 /dev/sda2 was the “C:” drive.

    Using FOG’s built in functions make the postinstall script a bit more robust.

    #!/bin/bash
    . /usr/share/fog/lib/funcs.sh
    [[ -z $postdownpath ]] && postdownpath="/images/postdownloadscripts/"
    case $osid in
        5|6|7|9)
            clear
            [[ ! -d /ntfs ]] && mkdir -p /ntfs
            getHardDisk
            if [[ -z $hd ]]; then
                handleError "Could not find hdd to use"
            fi
            getPartitions $hd
            for part in $parts; do
                umount /ntfs >/dev/null 2>&1
                fsTypeSetting "$part"
                case $fstype in
                    ntfs)
                        dots "Testing partition $part"
                        ntfs-3g -o force,rw $part /ntfs
                        ntfsstatus="$?"
                        if [[ ! $ntfsstatus -eq 0 ]]; then
                            echo "Skipped"
                            continue
                        fi
                        if [[ ! -d /ntfs/windows && ! -d /ntfs/Windows && ! -d /ntfs/WINDOWS ]]; then
                            echo "Not found"
                            umount /ntfs >/dev/null 2>&1
                            continue
                        fi
                        echo "Success"
                        break
                        ;;
                    *)
                        echo " * Partition $part not NTFS filesystem"
                        ;;
                esac
            done
            if [[ ! $ntfsstatus -eq 0 ]]; then
                echo "Failed"
                debugPause
                handleError "Failed to mount $part ($0)\n    Args: $*"
            fi
            echo "Done"
            debugPause
            . ${postdownpath}fog.copydrivers
            # . ${postdownpath}fog.updateunattend
            umount /ntfs
            ;;
        *)
            echo "Non-Windows Deployment"
            debugPause
            return
            ;;
    esac
    

    ref: https://forums.fogproject.org/topic/11126/using-fog-postinstall-scripts-for-windows-driver-injection-2017-ed

    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
    • M
      mrayzies
      last edited by Jan 22, 2018, 8:39 PM

      @george1421 – sorry, I’m a couple versions behind I guess; when did the shared library funcs.sh get introduced?

      I don’t see anything on the forum for this library either:

      • https://wiki.fogproject.org/wiki/index.php?title=Special%3ASearch&profile=default&search=funcs.sh&fulltext=Search
      • https://wiki.fogproject.org/wiki/index.php?title=Special%3ASearch&profile=default&search=postdownload&fulltext=Search
      G 1 Reply Last reply Jan 22, 2018, 8:40 PM Reply Quote 0
      • G
        george1421 Moderator @mrayzies
        last edited by george1421 Jan 22, 2018, 2:41 PM Jan 22, 2018, 8:40 PM

        @mrayzies said in get imaged disk information for post download scripts:

        funcs.sh

        Undocumented feature… 😉

        Actually one of the developers tuned up the script I wrote when the NVMe disks came on line. The NVMe naming convention is a bit different. The funcs.sh has always been in FOS, its just hasn’t been end user reachable.

        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
        • M
          mrayzies
          last edited by Jan 22, 2018, 8:51 PM

          @george1421 said in get imaged disk information for post download scripts:

          @mrayzies said in get imaged disk information for post download scripts:

          funcs.sh

          Undocumented feature… 😉

          The best ones always are.

          Actually one of the developers tuned up the script I wrote when the NVMe disks came on line. The NVMe naming convention is a bit different. The funcs.sh has always been in FOS, its just hasn’t been end user reachable.

          Can you confirm when that was? I’m running 1.4.4, but when I source that library on a debug installation, getHardDisk returns nothing.

          T G 2 Replies Last reply Jan 22, 2018, 8:53 PM Reply Quote 0
          • T
            Tom Elliott @mrayzies
            last edited by Jan 22, 2018, 8:53 PM

            @mrayzies What do you mean it returns nothing?

            It says:
            “Could not find hdd to use”?

            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! Get in contact with me (chat bubble in the top right corner) if you want to join in.

            Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

            Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

            1 Reply Last reply Reply Quote 0
            • G
              george1421 Moderator @mrayzies
              last edited by Jan 22, 2018, 8:55 PM

              @mrayzies It has been in the system since the 1.2.0 trunk days. Does FOG image the computer correctly?

              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
              • M
                mrayzies
                last edited by Jan 22, 2018, 9:01 PM

                @Tom-Elliott – no output (see image)

                0_1516654871576_funcs.jpg

                @george1421 – machine images properly; postdownload steps fail (due to hard-coded /dev/sda2)

                G 1 Reply Last reply Jan 22, 2018, 9:24 PM Reply Quote 0
                • T
                  Tom Elliott
                  last edited by Jan 22, 2018, 9:06 PM

                  funcs.sh has been in there since at least 0.30 days, though I’m sure it’s been there since much earlier. It just hadn’t been pushed into the repository until that point.

                  Reference:
                  First case of funcs.sh showing up.

                  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! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                  Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                  Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                  1 Reply Last reply Reply Quote 0
                  • M
                    mrayzies
                    last edited by Jan 22, 2018, 9:23 PM

                    OK, it’s my fault for skimming code — getHardDisk does not print anything to stdout but saves the output to a variable. Checking that variable shows it does properly find the NVME drive.

                    I think this request can be closed then as I can use this library to access things, like the imaged drive and make my postimaging scripts much more robust.

                    Thanks @george1421 & @Tom-Elliott

                    G 1 Reply Last reply Jan 22, 2018, 9:25 PM Reply Quote 0
                    • G
                      george1421 Moderator @mrayzies
                      last edited by Jan 22, 2018, 9:24 PM

                      @mrayzies Well when I run a pure debug console it doesn’t return a value either. I know it works because I’m using it on my production server. Let me see what I have in my dev environment. These are the same functions FOG uses to lay the image down on the target computer so they have to work.

                      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
                      • G
                        george1421 Moderator @mrayzies
                        last edited by Jan 22, 2018, 9:25 PM

                        @mrayzies Good to hear. If you look at my very first post you can see a ref link to the current versions of the post install scripts. You might get some ideas on how to update yours.

                        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
                        • 1 / 1
                        1 / 1
                        • First post
                          11/12
                          Last post

                        181

                        Online

                        12.4k

                        Users

                        17.4k

                        Topics

                        155.9k

                        Posts
                        Copyright © 2012-2025 FOG Project