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

    Rolling FOG out to US Site

    Scheduled Pinned Locked Moved Solved
    General
    5
    97
    46.1k
    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.
    • Tom ElliottT
      Tom Elliott
      last edited by Tom Elliott

      @george1421

      myip=`ip route get 8.8.8.8 | awk 'NR==1 {print $NF}' | cut -d "." -f1-2`;
      

      I’d recommend as:

      myip=$(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}' | cut -d "." -f1-2)
      

      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

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

        @Tom-Elliott said in Rolling FOG out to US Site:

        I’d recommend as:

        myip=$(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}' | cut -d "." -f1-2)

        Sweet, I learned something new today.

        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
        • george1421G
          george1421 Moderator @RobTitian16
          last edited by Tom Elliott

          @RobTitian16 You found the other issue I mentioned that the code copied out of the forums sometimes misses spaces that need to be in there.

          For example this code

           [[_! -d /ntfs_]] && mkdir -p /ntfs #REPLACE _ WITH SPACES
          

          gets converted into

           [[! -d /ntfs ]] && mkdir -p /ntfs
          

          note the missing space after the second left bracket. That is why I included the text file (which I may not have fixed every occurrence when I was quickly hacking it 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!

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

            https://www.shellcheck.net/

            Might be helpful if you’re going to use bash scripts to make sure there’s no mistakes in it.

            1 Reply Last reply Reply Quote 2
            • RobTitian16R
              RobTitian16 @george1421
              last edited by

              @george1421 Yep, I remembered it from last time.
              I did download the file and transfer it to my FOG Server, which is when I had to use dos2linux to convert it as it was giving some unusual errors.
              Apparently it really doesn’t like:

              $sitelocal = "en-GB";
              $uilang = "en-US";
              

              As I’m getting this error:

              0_1479333018583_Capture2.PNG

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

                @RobTitian16 nuts, that’s what happens when you do crud too stuff too fast while doing your real job.

                Remove the leading dollar sign “$” from each variable, that should not be there on a set action.

                As for the hint part I alluded to before… crud back in a minute.

                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!

                RobTitian16R george1421G 2 Replies Last reply Reply Quote 0
                • RobTitian16R
                  RobTitian16 @george1421
                  last edited by

                  @george1421 haha, I thought that but just wanted to confirm before fiddling 😛

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

                    @george1421 OK here is the hint.

                    1. If you schedule a debug deploy to your target computer.
                    2. Then pxe boot your target computer. After a few enter key presses you will be dropped to a linux command prompt.
                    3. From here you can enter fog and single step through the deployment tasks until you get to your postinstall script. If you script bombs out you can then work on editing your post install script. BUT what I recommend is to do step 4 and on.
                    4. Get the ip address of your target computer using ip addr show
                    5. Set roo’s password with passwd you can set it to anything you want.
                    6. Now from a windows or linux computer use putty to connect to your target computer.
                    7. At the command prompt key in fog to single step through the installation process.

                    Putty gives you the ability to copy, cut and paste as you edit the post install script.

                    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!

                    RobTitian16R 1 Reply Last reply Reply Quote 0
                    • RobTitian16R
                      RobTitian16 @george1421
                      last edited by RobTitian16

                      @george1421 Thanks!
                      Not sure why, but it’s still not copying the SetupComplete.cmd… I wonder if it’s because I made it on the FOG Server itself by just typing: “sudo vi SetupComplete.cmd” and then filling in the file with what I needed for the msi installer.

                      0_1479338512551_Capture2.PNG

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

                        @RobTitian16 What you need to confirm is does the entire target path exist?

                        If I had to bet, I would say this path exists on the target computer c:\windows\setup and thats it. If that is the case you need to create the scripts folder in c:\windows\setup folder.

                        Also remember I said CASE is important. /ntfs/windows/setup/scripts is not the same as /ntfs/Windows/Setup/Scripts as it would be in the windows OS it self, you are still running linux here.

                        If you single step through a fog deploy like I posted and run into that error, press ctrl-C to blow out of the script. Then you can inspect the /ntfs path to ensure everything is as you would expect it. It helps with debugging greatly.

                        Don’t give up here, you are doing some pretty complex stuff with FOG, but will end up with a sweet solution when it all comes together.

                        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!

                        RobTitian16R 1 Reply Last reply Reply Quote 1
                        • RobTitian16R
                          RobTitian16 @george1421
                          last edited by

                          @george1421 Thanks, George. Definitely not going to give up here - if anything I’m actually craving more understanding of the coding, etc. which I’ll hopefully gain in time 🙂
                          So I’d have to create this folder structure inside the image first? Can I not do it through the script whilst it’s in FOS?

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

                            @RobTitian16 you can do anything structure wise in the post install script. So if you know that you need to create the scripts folder then just issue this command.
                            md /ntfs/Windows/Setup/Scripts just before the copy command. But again you need to know exactly what your target system has.

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

                              @RobTitian16 In my setup I will quick patch a target system between image captures. So if I need to update the unattend.xml between image captures or update the setupcomplete.cmd file I can do that via a post install script. Then the next time we capture the image we integrate the “patches” we’ve been doing in the post install script. It works out pretty well.

                              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!

                              RobTitian16R 1 Reply Last reply Reply Quote 0
                              • RobTitian16R
                                RobTitian16 @george1421
                                last edited by

                                @george1421 Thanks for the help so far 🙂
                                The SetupComplete.cmd doesn’t seem to be working still - when running it through an elevated command prompt, it says: “the installation package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor…”

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

                                  @RobTitian16 OK wait, you are in the windows realm now? So FOS and linux has done its part !!

                                  So the setup complete file IS making to the target computer now?

                                  If so now you need to work in windows to understand what is not right.

                                  How is the fog client msi getting to the windows box? Is the setup complete batch file referencing the full path to the msi?

                                  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!

                                  RobTitian16R 1 Reply Last reply Reply Quote 0
                                  • RobTitian16R
                                    RobTitian16 @george1421
                                    last edited by

                                    @george1421 Yep, sorry - I responded at 1am which is really not a good idea as I had no idea where I was or what I was doing.

                                    I realised after your post I didn’t actually have a section that would copy across the FOG client msi to the Windows system. I tried to add a couple of lines that would copy across the FogService.zip from /root/trunk/packages/web/client and then unzip it, but it never worked when run (it always said it couldn’t unzip /ntfs/Windows/Setup/Scripts/FogService.zip [.zip]"

                                    So, I’ve now unzipped the FogService.zip on the FOG server and try to copy across the “Fog Service Installer.msi”. However, this doesn’t appear to be working, either. Perhaps I’ve missed something? Or perhaps there’s an easier way to get the msi across to the target computer?

                                       # Check if the file FOG Service Installer.msi exists in the source folder and then copy it to the destination on the C: drive.
                                       if [ -f "/root/trunk/packages/web/client/FogService/Fog Service Installer.msi" ]; then
                                       	cp "/root/trunk/packages/web/client/FOGService/FOG Service Installer.msi" "/ntfs/Windows/Setup/Scripts/FOG Service Installer.msi";
                                       fi  
                                    
                                       # Check if the file SetupComplete.cmd exists in the source folder and then copy it to the destination on 
                                           # the C: drive. 
                                    
                                           if [ -f "/images/drivers/Common/SetupComplete.cmd" ]; then
                                               cp /images/drivers/Common/SetupComplete.cmd /ntfs/Windows/Setup/Scripts/SetupComplete.cmd;
                                       		# append the msiexec command to the end of the setupComplete.cmd file 
                                       		echo "msiexec.exe /i "FOG Service Installer.msi" /quiet USETRAY=\"0\" WEBADDRESS=\"${FOGIP}\" " >> /ntfs/Windows/Setup/Scripts/SetupComplete.cmd
                                       		# just in case we edited the setupcomplete.cmd file in unix lets filter it to make it DOS compatible
                                       		unix2dos /ntfs/Windows/Setup/Scripts/SetupComplete.cmd
                                           fi
                                    
                                    Q Tom ElliottT 2 Replies Last reply Reply Quote 0
                                    • Q
                                      Quazz Moderator @RobTitian16
                                      last edited by

                                      @RobTitian16

                                      You don’t need the ; at the end of the cp commands.

                                      In fact, in your current structure you only need the ; after the if brackets because you have then on the same line.

                                      I don’t know (and somewhat doubt) that that’s the issue, but doesn’t hurt to check.

                                      Also, you don’t seem to check the existence of the /ntfs/Windows/Setup/Scripts folder before trying to copy there.

                                      So do something like

                                      if [ ! -d "/ntfs/Windows/Setup/Scripts" ]
                                      then
                                        mkdir "/ntfs/Windows/Setup/Scripts"
                                      fi
                                      

                                      Before the other two if statements.

                                      RobTitian16R 3 Replies Last reply Reply Quote 2
                                      • RobTitian16R
                                        RobTitian16 @Quazz
                                        last edited by

                                        @Quazz Thanks - will give this a go and see what happens.

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

                                          @RobTitian16 Thinking about it, Windows might sometimes create a scripts folder instead of a Scripts folder.

                                          So we need to check for both.

                                          #if scripts exists then by default Scripts does not, but if scripts does not exist then it's still possible Scripts doesn't either
                                          if  [  -d "/ntfs/Windows/Setup/scripts" ] 
                                          then
                                            mv "/ntfs/Windows/Setup/scripts" "/ntfs/Windows/Setup/Scripts"
                                          else
                                            mkdir "/ntfs/Windows/Setup/Scripts"
                                          fi
                                          

                                          Since Windows doesn’t care about capitalization, you can safely rename it to a capitalized version. This will be overzealous with the mkdir, triggering in more cases than necessary, but since mkdir can’t do anything if the target exists, I don’t consider this to be problematic.

                                          1 Reply Last reply Reply Quote 0
                                          • RobTitian16R
                                            RobTitian16 @Quazz
                                            last edited by

                                            @Quazz Unfortunately it’s still not copying the msi across.
                                            I wonder if it’s because of the quotations and if it doesn’t like them there.

                                            I’ve also noticed that with the following line, it doesn’t put “FOG Service Installer.msi” in quotes in the SetupComplete.cmd:

                                            echo "msiexec.exe /i "FOG Service Installer.msi" /quiet USETRAY=\"0\" WEBADDRESS=\"${FOGIP}\" " >> /ntfs/Windows/Setup/Scripts/SetupComplete.cmd
                                            
                                            Q 1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 5 / 5
                                            • First post
                                              Last post

                                            163

                                            Online

                                            12.1k

                                            Users

                                            17.3k

                                            Topics

                                            155.3k

                                            Posts
                                            Copyright © 2012-2024 FOG Project