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

    fog.drivers script will not run correctly in postdownloadscripts

    Scheduled Pinned Locked Moved Solved
    FOG Problems
    7
    69
    31.5k
    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.
    • THEMCVT
      THEMCV
      last edited by

      Server
      • FOG Version: 1.3.0-RC-16
      • OS: Debian 8 ‘jessie’
      Client
      • Service Version: v0.11.5
      • OS: Windows 7
      Description

      We’re trying to get a master image made and using lots of sources on the forum, we found a script here:

      #!/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) #pruduct is typo, just realized sorry :(
              ;;
          *)
              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
      system64="/ntfs/Windows/SysWOW64/regedit.exe" # sloppy detect if 64bit or not
      [[! -f $system64]] && setarch="x86" || setarch="x64"
      #############################################
      #this is not section necessary needed, it's just to make the path "human readable"
      #rather than using osid for filepath
      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!
      clientdriverpath="/ntfs/Windows/DRV"
      remotedriverpath="/images/drivers/$osn/$machine"
      [[! -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/Win7/Latitude E5410/x86
      rsync -aqz "$remotedriverpath" "$clientdriverpath" >/dev/null 2>&1
      [[! $? -eq 0]] && handleError "Failed to download driver information"
      
      #if you wanted to use driver.cab use this line below.
      #i.e. /fog/Drivers/Win7/Latitude E5410/E5410-Win7-A07-KTT4G.CAB
      #cabextract -d "$clientdriverpath" "$remotedriverpath/*.CAB" >/dev/null 2>&1
      
      #if you wanted to mix both cab and extracted use these:
      #rsync -aqz --exclude='*.CAB' "$remotedriverpath" "$clientdriverpath" >/dev/null 2>&1
      #[[! $? -eq 0]] && handleError "Failed to sync cab and non-cab drivers"
      #cabextract -d "$clientdriverpath" "$remotedriverpath/*.CAB" >/dev/null 2>&1
      #[[! $? -eq 0]] && handleError "Failed to extract cab files"
      
      #this next bit adds driver location on pc to devicepath in registry (so sysprep uses it to reference)
      # remember to make devicepath= match the path you've used locally
      #also do not remove %SystemRoot%\inf
      #and to add more locations just use ; in between each location
      regfile="/ntfs/Windows/System32/config/SOFTWARE"
      key="\Microsoft\Windows\CurrentVersion\DevicePath"
      devpath="%SystemRoot%\inf;%SystemRoot%\DRV";
      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 :-)"
      

      Looking it over and it seems good to go, I tried it and received the following error:

      mount: mounting <ip address>:/fog/ on /fog failed: Permission denied
      /images/postdownloadscripts/fog.drivers: line 2: $'\r': command not found
      /images/postdownloadscripts/fog.drivers: line 3: $'\r': command not found
      /images/postdownloadscripts/fog.drivers: line 4: $'\r':syntax error near unexpected token  '$'in\r''
      'images/postdownloadscripts/fog.drivers: line 4: 'case $manu in umount: can't unmount /ntfs: Invalid Argument
      

      Then it finishes out and boots into Windows without its drivers it needs.

      the drivers are in /images/drivers/Win7/Optiplex 790/x64 for this lone machine at the moment.

      I’ve been working on this for a while and the drivers are my downfall. I can’t seem to parse these scripts myself.

      Anything and anything would be amazing and helpful.

      Thank you

      Tom ElliottT 1 Reply Last reply Reply Quote 0
      • Wayne WorkmanW
        Wayne Workman
        last edited by

        Pinging @george1421 and @Lee-Rowlett to take a look.

        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!
        Daily Clean Installation Results:
        https://fogtesting.fogproject.us/
        FOG Reporting:
        https://fog-external-reporting-results.fogproject.us/

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

          This isn’t one based on any of my scripts. but since its throwing an error right at line 2 with \r something. It kind of makes me thing this script was created using notepad and then copied to the FOG server. If this is the case you might want to use the dos2unix command to clean up the \r or carriage returns in the file. If this file was viewed with vi I would expect to see the \r in the file.

          With that said, I know the lenovos and the dells put the system name in different locations in smbios. If the above script isn’t working I can look in mine to find the right smbios name for the non-dells.

          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!

          THEMCVT 3 Replies Last reply Reply Quote 1
          • THEMCVT
            THEMCV @george1421
            last edited by

            @george1421 Nail on the head. Copied it into Notepad++ to review it and then copied it back.

            I’ll try that. Thank you so much.

            1 Reply Last reply Reply Quote 0
            • THEMCVT
              THEMCV @george1421
              last edited by

              @george1421 I installed dos2unix and converted the fog.driver. Testing now.

              We have all Dells thankfully. 🙂

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

                @THEMCV THEN, if you have ONLY Dells, I might suggest you change the order of the driver library to match the format of the dell cabs.

                This I can tell came from Lee’s script. (understand this is only a personal opinion of the setup)
                remotedriverpath="/images/drivers/$osn/$machine"

                This structure is different than what comes in the dell cab of machine then OS. In my scripts I would use this format
                remotedriverpath="/images/drivers/$machine/$osn/$arch'

                There is no right or wrong way here, I just pick easy over neat.

                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!

                THEMCVT 1 Reply Last reply Reply Quote 1
                • THEMCVT
                  THEMCV @george1421
                  last edited by

                  @george1421 Here’s what I got back this time:

                  mount: mounting <ip address>:/fog/ on /fog failed: Permission denied
                  * Mounting device.................................................Done
                  /images/postdownloadscripts/fog.drivers: line 15: [[-z: command not found
                  /images/postdownloadscripts/fog.drivers: line 18: [[!: command not found
                  * Preparing Drivers....................................................../images/postdownloadscripts/fog.drivers: line 35: [[!: command not found
                  In Progress/images/postdownloadscripts/fog.drivers: line 43: [[!: command not found
                  Done
                  umount: can't unmount /ntfs: Invalid Argument
                  
                  1 Reply Last reply Reply Quote 0
                  • THEMCVT
                    THEMCV @george1421
                    last edited by

                    @george1421 I extracted the driver from the .CAB file, but I will try switching them out tomorrow when I get in. 🙂

                    george1421G 2 Replies Last reply Reply Quote 0
                    • george1421G
                      george1421 Moderator @THEMCV
                      last edited by

                      @THEMCV said in fog.drivers script will not run correctly in postdownloadscripts:

                      @george1421 I extracted the driver from the .CAB file, but I will try switching them out tomorrow when I get in. 🙂

                      It makes it easier when you have new models to just extract the cabs and throw it in a directory on a windows computer to build the structure. Then use 7-zip to create an archive to copy to the fog server, then use unzip to extract.

                      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 1
                      • george1421G
                        george1421 Moderator @THEMCV
                        last edited by

                        @THEMCV But your error is having a problem in line 15 with the test of $machine is zero. Just wondering if the word if needs to precede the conditional test. I’m not an expert bash programmer so I can’t about all of the shortcuts you can do in bash.

                        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!

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

                          @george1421 It’s got nothing to do with the if or not. It’s because (and I’m just guessing) he literally copied and pasted the code.

                          Right now the code braces are stripping spaces.

                          So he is literally having his file with: [[-z $machine]] rather than [[_-z $machine_]] (replacing the _ with actual spaces.

                          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 2
                          • Tom ElliottT
                            Tom Elliott @THEMCV
                            last edited by Wayne Workman

                            @THEMCV Please try this:

                            wget -O /images/postdownloadscripts/fog.drivers http://mastacontrola.com/fog.drivers

                            –Fixed.
                            Wayne

                            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

                            THEMCVT 1 Reply Last reply Reply Quote 2
                            • THEMCVT
                              THEMCV @Tom Elliott
                              last edited by

                              @Tom-Elliott I downloaded that and we’re definitely farther! No more parsing errors, so that’s amazing. Thank you! 🙂

                              Now it’s telling me

                              mount: mounting 10.4.200.150:/fog/ on /fog failed: permission denied
                                 * Mounting Device...................................................................Done
                                 * Preparing Drivers..................................................................In progress
                              

                              Then it tells me an error has been detected

                              Failed to download driver information
                              

                              So I double checked my directory which is: /images/Drivers/Win7/OptiPlex 980/x64

                              I’m using extracted CAB drivers for now, but might switch/try just CAB files. They seem to be in place where they should be.

                              Thank you Tom.

                              Wayne WorkmanW 1 Reply Last reply Reply Quote 0
                              • Wayne WorkmanW
                                Wayne Workman @THEMCV
                                last edited by Wayne Workman

                                @THEMCV It’s failing on this line:

                                rsync -aqz "$remotedriverpath" "$clientdriverpath" >/dev/null 2>&1
                                

                                SO, just before that, for troubleshooting purposes, echo out the command it’s running like:

                                echo
                                echo "rsync -aqz \"$remotedriverpath\" \"$clientdriverpath\""
                                echo
                                

                                Put those three lines one line above the problem line, exactly as I typed it. It will echo out the actual command being run. Then, run the script. The command will get echoed out and look proper. Examine it, copy it, and try to run the command by itself and see what happens.

                                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!
                                Daily Clean Installation Results:
                                https://fogtesting.fogproject.us/
                                FOG Reporting:
                                https://fog-external-reporting-results.fogproject.us/

                                THEMCVT 1 Reply Last reply Reply Quote 1
                                • THEMCVT
                                  THEMCV @Wayne Workman
                                  last edited by

                                  @Wayne-Workman Okay, got it.

                                  mount: mounting 10.4.200.150:/fog/ on /fog failed: permission denied
                                     * Mounting Device...................................................................Done
                                     * Preparing Drivers..................................................................In progress
                                  rsync -aqz "/images/drivers/Win7/OptiPlex 980" "/ntfs/Windows/DRV"
                                  

                                  Then

                                  Failed to download driver information
                                  

                                  It definitely sat on Preparing Drivers much longer than before, but the same outcome.

                                  I confirmed the directory is /images/drivers/Win7/OptiPlex 980/x64

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

                                    @THEMCV Is it /images/drivers/Win7/OptiPlex 980/x64 or is it /images/Drivers/Win7/OptiPlex 980/x64

                                    (Notice the D in drivers is capitalized).

                                    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

                                    THEMCVT 1 Reply Last reply Reply Quote 1
                                    • THEMCVT
                                      THEMCV @Tom Elliott
                                      last edited by

                                      @Tom-Elliott It was /Drivers/ and not /drivers/ but I changed to /drivers/. Same issue.

                                      When I was looking over the code I misread and thought I saw a reference to /Drivers, so that’s on me.

                                      1 Reply Last reply Reply Quote 0
                                      • Q
                                        Quazz Moderator
                                        last edited by

                                        Am I going crazy or is this a simple issue with the fog server not mounting on the client?

                                        mount: mounting 10.4.200.150:/fog/ on /fog failed: permission denied
                                        

                                        Is the IP correct? Does the /fog folder exist?

                                        george1421G THEMCVT 2 Replies Last reply Reply Quote 0
                                        • george1421G
                                          george1421 Moderator @Quazz
                                          last edited by george1421

                                          @Quazz That is what I was just trying to reverse engineer. Where did the /fog directory come from? The only nfs share is /images.

                                          The info that is missing here is that I the mount isn’t happening in this script but in the fog postdownload script from here: https://forums.fogproject.org/topic/4278/utilizing-postscripts-rename-joindomain-drivers-snapins/29

                                          [edit] Side note, I found that my post install scripts fail when deploying to NVMe disks since the disk structure is different. I was looking at merging some of the code magic Tom created into my scripts too.

                                          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!

                                          THEMCVT 1 Reply Last reply Reply Quote 1
                                          • THEMCVT
                                            THEMCV @Quazz
                                            last edited by

                                            @Quazz The IP is correct. I must have gotten things turned around looking at the Auto install script on the FOG wiki.

                                            So I need to make a fog directory in root like this, correct?

                                            /fog/Drivers/Win7/OptiPlex 980/x64
                                            
                                            Q 1 Reply Last reply Reply Quote 1
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 1 / 4
                                            • First post
                                              Last post

                                            170

                                            Online

                                            12.0k

                                            Users

                                            17.3k

                                            Topics

                                            155.2k

                                            Posts
                                            Copyright © 2012-2024 FOG Project