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

    fog.drivers script always needs drivers

    Scheduled Pinned Locked Moved Solved
    FOG Problems
    2
    6
    1.9k
    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.
    • C
      chief
      last edited by

      Server
      • FOG Version: 1.4.3
      • OS: Ubuntu 16.04
      Client
      • Service Version: 0.11.12
      • OS: Windows 10
      Description

      I’m trying to set up a new Windows 10 image and inject drivers with the fog.drivers script I got from this forum. Any PC without drivers seems to fail to image if there isn’t a drivers folder on the fogserver. Is there a way to bypass the drivers copy and just image the machine, if the folder is missing on fog? The files I use are below.

      fog.postdownload

      #!/bin/bash
      case $osid in
          [5-7]|9)
              clearScreen
              getHardDisk
              getPartitions $hd
              if [[ ! -d /ntfs ]]; then
                  mkdir -p /ntfs >/dev/null 2>&1
                  [[ ! $? -eq 0 ]] && echo " * Failed to Mount Device"
              fi
              for part in $parts; do
                  umount /ntfs >/dev/null 2>&1
                  ntfs-3g -o remove_hiberfile,rw $part /ntfs >/dev/null 2>&1
                  [[ ! $? -eq 0 ]] && continue
              done
              . ${postdownpath}fog.drivers
              umount /fog /ntfs /images >/dev/null 2>&1
              ;;
      esac
      

      fog.drivers

      #!/bin/bash
      ceol=`tput el`;
      manu=`dmidecode -s system-manufacturer`;
      case $manu in
          [Ll][Ee][Nn][Oo][Vv][Oo])
              machine=$(dmidecode -s system-version)
              ;;
          *[Dd][Ee][Ll][Ll]*)
              machine=$(dmidecode -s system-product-name)
              ;;
          *)
              machine=$(dmidecode -s system-product-name) # Technically, we can remove the dell one as it's the "default"
              ;;
      esac
      [[ -z $machine ]] && return #assuming you want it to break if it is not lenovo or dell?
      machine="${machine%"${machine##*[![:space:]]}"}" #Removes Trailing Spaces
      
      #############################################
      # Quick hack to find out if the installed OS image is a x86 or x64
      system64="/ntfs/Windows/SysWOW64/regedit.exe" # sloppy detect if 64bit or not
      [[ ! -f $system64 ]] && arch="x86" || arch="x64"
      
      #############################################
      #this section has been updated to bring the osn names in line
      # with how the Dell CABs are defined
      case $osid in
          5) osn="win7" ;;
          6) osn="win8" ;;
          7) osn="win8.1" ;;
          9) osn="win10" ;;
      esac
      
      #############################################
      dots "Preparing Drivers"
      # below creates local folder on imaged pc
      # this can be anywhere you want just remember
      # to make sure it matches throughout! (case IS important here)
      clientdriverpath="/ntfs/Windows/DRV"
      remotedriverpath="/images/drivers/$machine/$osn/$arch"
      
      [[ ! -d $clientdriverpath ]] && mkdir -p "$clientdriverpath" >/dev/null 2>&1
      echo -n "In Progress"
      
      #there's 3 ways you could handle this,
      #driver cab file, extracted driver files or both
      #so on the server put extracted driver files to match below folder tree
      #i.e. Model Latitude E5410, Windows 7 x86 image would be:
      #/fog/Drivers/Latitude E5410/win7/x86
      
      rsync -aqz "$remotedriverpath" "$clientdriverpath" >/dev/null 2>&1
      [[ ! $? -eq 0 ]] && handleError "Failed to download driver information for [$machine/$osn/$arch]"
      
      
      regfile="/ntfs/Windows/System32/config/SOFTWARE"
      key="\Microsoft\Windows\CurrentVersion\DevicePath"
      devpath="%SystemRoot%\DRV;%SystemRoot%\inf;";
      reged -e "$regfile" &>/dev/null <<EOFREG
      ed $key
      $devpath
      q
      y
      EOFREG
      echo -e "\b\b\b\b\b\b\b\b\b\b\b${ceol}Done"; # this just removes "In Progress and replaces it with done :-)"
      
      
      george1421G 1 Reply Last reply Reply Quote 0
      • george1421G
        george1421 Moderator @chief
        last edited by george1421

        @chief In your fog.drivers update the bottom section with a if conditional to test to see if the directory exists.

        #############################################
        dots "Preparing Drivers"
        # below creates local folder on imaged pc
        # this can be anywhere you want just remember
        # to make sure it matches throughout! (case IS important here)
        clientdriverpath="/ntfs/Windows/DRV"
        remotedriverpath="/images/drivers/$machine/$osn/$arch"
        
        if [ -d $remotedriverpath ]; then
        
            [[ ! -d $clientdriverpath ]] && mkdir -p "$clientdriverpath" >/dev/null 2>&1
            echo -n "In Progress"
        
            #there's 3 ways you could handle this,
            #driver cab file, extracted driver files or both
            #so on the server put extracted driver files to match below folder tree
            #i.e. Model Latitude E5410, Windows 7 x86 image would be:
            #/fog/Drivers/Latitude E5410/win7/x86
        
            rsync -aqz "$remotedriverpath" "$clientdriverpath" >/dev/null 2>&1
            [[ ! $? -eq 0 ]] && handleError "Failed to download driver information for [$machine/$osn/$arch]"
        
        
            regfile="/ntfs/Windows/System32/config/SOFTWARE"
            key="\Microsoft\Windows\CurrentVersion\DevicePath"
            devpath="%SystemRoot%\DRV;%SystemRoot%\inf;";
            reged -e "$regfile" &>/dev/null <<EOFREG
        ed $key
        $devpath
        q
        y
        EOFREG
            echo -e "\b\b\b\b\b\b\b\b\b\b\b${ceol}Done"; # this just removes "In Progress and replaces it with done :-)"
        fi
        

        While it looks like a type-o the text between the EOFREG need to be on the first character of the line. In the code above I added if [ -d remotedriverpath ]; then in to test if the source directory exists.

        On a side note understand the registry patch at the end will not work with Win10. You need to add a section to your unattend.xml file to tell OOBE where to look for the drivers.

        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!

        C 2 Replies Last reply Reply Quote 2
        • C
          chief @george1421
          last edited by

          @george1421 Thanks. That seems to have solved it.

          1 Reply Last reply Reply Quote 0
          • C
            chief @george1421
            last edited by

            @george1421 Actually. I have tested on another machine and it’s not copying the drivers across now if they are on the server. Is there any other way around it?

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

              @chief Ok I made a sad rookie mistake.

              The test for the directory was posted as

              if [ -d remotedriverpath ]; then
              

              I missed the variable identifier, that line should read.

              if [ -d $remotedriverpath ]; then
              

              Note the missing ( $ ) character.

              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
              • C
                chief
                last edited by

                I’ve tested and it still doesn’t copy the drivers when they are there?

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

                159

                Online

                12.0k

                Users

                17.3k

                Topics

                155.2k

                Posts
                Copyright © 2012-2024 FOG Project