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

    Postdownload Scripts

    Scheduled Pinned Locked Moved
    General
    3
    3
    879
    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
      SHerder
      last edited by

      I’m curious if there’s a way to have the postdownload scripts only run for certain images and not all of them.

      1 Reply Last reply Reply Quote 0
      • Tom ElliottT
        Tom Elliott
        last edited by

        No, it’s a run on everything, or not. Though you can add checks in your post download script to only run commands if the image is a certain name.

        For example, something like:

        case $img in
            ImageNameForDoingStuff)
                # do stuff for this image.
                ;;
            *)
                # do stuff for everything else, or return.
                ;;
        esac
        

        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
        • J
          jflippen
          last edited by

          Like @Tom-Elliott said, the initial postdownload script always runs. However, you can use CASE or IF statements to either call a function or open another script. Here is my current postdownload script that I got from one of @george1421 and his wonderful driver injection scripts found here

          #!/bin/bash
          . /usr/share/fog/lib/funcs.sh
          [[ -z $postdownpath ]] && postdownpath="/images/postdownloadscripts/"
          if [ $img == "Win7BaseVM" ] || [ $img == "Win10BaseVM" ] ; then
          	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 /ntf >/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.deletelog
          	        . ${postdownpath}fog.drivers
          	        #. ${postdownpath}fog.ad
          	        umount /ntfs
          	        ;;
          	    *)
          	        echo "Non-Windows Deployment"
          	        debugPause
          	        return
          	        ;;
          	esac
          fi
          

          You can see that I have an if statement at the beginning to only run his driver injection script if the image name is one of my golden image VM’s.

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

          306

          Online

          12.0k

          Users

          17.3k

          Topics

          155.2k

          Posts
          Copyright © 2012-2024 FOG Project