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

Provision with Script

Scheduled Pinned Locked Moved Solved
Feature Request
4
33
5.4k
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.
  • J
    Junkhacker Developer @zfeng
    last edited by Jan 9, 2020, 9:20 PM

    @zfeng this is very vague

    signature:
    Junkhacker
    We are here to help you. If you are unresponsive to our questions, don't expect us to be responsive to yours.

    Z 1 Reply Last reply Jan 9, 2020, 9:23 PM Reply Quote 0
    • Z
      zfeng @Junkhacker
      last edited by Jan 9, 2020, 9:21 PM

      @Junkhacker the script will install different projects from git repository. everyone of the them needs to have an argument to install specific package on the computer.

      For now, after I complete the provision part, I basically power up the computer and run Computer=ComputerA ./start.sh on the home directory.

      1 Reply Last reply Reply Quote 0
      • Z
        zfeng @Junkhacker
        last edited by Jan 9, 2020, 9:23 PM

        @Junkhacker I am sorry for not specific enough

        T J 2 Replies Last reply Jan 9, 2020, 9:24 PM Reply Quote 0
        • T
          Tom Elliott @zfeng
          last edited by Jan 9, 2020, 9:24 PM

          @zfeng I’m guessing the image is Linux based?

          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

          Z 1 Reply Last reply Jan 9, 2020, 9:25 PM Reply Quote 0
          • Z
            zfeng @Tom Elliott
            last edited by Jan 9, 2020, 9:25 PM

            @Tom-Elliott Yes. You guys are very responsive. I appreciate that

            1 Reply Last reply Reply Quote 0
            • J
              Junkhacker Developer @zfeng
              last edited by Jan 9, 2020, 9:26 PM

              @zfeng it sounds like George’s method of creating a file in /etc/init.d on the target disk would work well for you. you can find info on creating postdownload scripts by searching on the forums

              signature:
              Junkhacker
              We are here to help you. If you are unresponsive to our questions, don't expect us to be responsive to yours.

              Z 1 Reply Last reply Jan 9, 2020, 9:27 PM Reply Quote 1
              • Z
                zfeng @Junkhacker
                last edited by Jan 9, 2020, 9:27 PM

                @Junkhacker but how can I pass the argument to that script?

                T J 2 Replies Last reply Jan 9, 2020, 9:28 PM Reply Quote 0
                • T
                  Tom Elliott @zfeng
                  last edited by Jan 9, 2020, 9:28 PM

                  @zfeng so if you use post download script you could auto set your start script to have the host name preset

                  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

                  Z 1 Reply Last reply Jan 9, 2020, 9:49 PM Reply Quote 0
                  • J
                    Junkhacker Developer @zfeng
                    last edited by Jan 9, 2020, 9:39 PM

                    @zfeng you could do something like wget -o /root/script.sh <address>/script.sh; echo “Computer=$hostname /root/script.sh” > <drive mount point>/etc/init.d/oneshot.sh

                    something like that.

                    signature:
                    Junkhacker
                    We are here to help you. If you are unresponsive to our questions, don't expect us to be responsive to yours.

                    Z 1 Reply Last reply Jan 9, 2020, 9:57 PM Reply Quote 1
                    • Z
                      zfeng @Tom Elliott
                      last edited by Jan 9, 2020, 9:49 PM

                      @Tom-Elliott The best thing I can do now is to try out that, and see what comes. Let’s say I need provision a linux computer with script Computer=ComputerA ./start.sh on the home directory. Is there any instruction I can try that out?

                      1 Reply Last reply Reply Quote 0
                      • Z
                        zfeng @Junkhacker
                        last edited by Jan 9, 2020, 9:57 PM

                        @Junkhacker where should I specify wget -o /root/script.sh <address>/script.sh; echo “Computer=$hostname /root/script.sh” > <drive mount point>/etc/init.d/oneshot.sh command?

                        J 1 Reply Last reply Jan 9, 2020, 10:00 PM Reply Quote 0
                        • J
                          Junkhacker Developer @zfeng
                          last edited by Jan 9, 2020, 10:00 PM

                          @zfeng in a postdownload script, so that it will run when the imaging process completes but before the imaging task completes

                          signature:
                          Junkhacker
                          We are here to help you. If you are unresponsive to our questions, don't expect us to be responsive to yours.

                          Z 1 Reply Last reply Jan 10, 2020, 3:29 PM Reply Quote 1
                          • G
                            george1421 Moderator
                            last edited by george1421 Jan 9, 2020, 4:25 PM Jan 9, 2020, 10:25 PM

                            If you search the tutorials FOG forum I have several on creating postdown scipts to install model specific drivers (for windows). The concepts are the same for what you want to do. You will just mount the target computer’s linux root volume. https://forums.fogproject.org/topic/11126/using-fog-postinstall-scripts-for-windows-driver-injection-2017-ed

                            https://forums.fogproject.org/topic/9463/fog-postinit-scripts-before-the-magic-begins

                            and from here: https://forums.fogproject.org/topic/7740/the-magical-mystical-fog-post-download-script/4

                            These are the list of FOG variables that are available to postdownload scripts.

                            shutdown	# Shut down at the end of imaging
                            hostdesc	#Host Description from Host Managment-General
                            hostip		# IP address of the FOS client
                            hostimageid	# ID of image being deployed
                            hostbuilding	# ??
                            hostusead	# Join Domain after image task from Host Management-Active Directory
                            hostaddomain	# Domain name from Host Management-Active Directory
                            hostaduser	# Domain Username from Host Management-Active Directory
                            hostadou	# Organizational Unit from Host Management-Active Directory
                            hostproductkey=	# Host Product Key from Host Management-Active Directory
                            imagename	# Image Name from Image Management-General
                            imagedesc	# Image Description from Image Management-General
                            imageosid	# Operating System from Image Management-General
                            imagepath	# Image Path from Image Management-General (/images/ assumed)
                            primaryuser	# Primary User from Host Management-Inventory
                            othertag	# Other Tag #1 User from Host Management-Inventory
                            othertag1	# Other Tag #2 from Host Management-Inventory
                            sysman		# System Manufacturer from Host Management-Inventory (from SMBIOS)
                            sysproduct	# System Product from Host Management-Inventory (from SMBIOS)
                            sysserial	# System Serial Number from Host Management-Inventory (from SMBIOS)
                            mbman		# Motherboard Manufacturer from Host Management-Inventory (from SMBIOS)
                            mbserial	# Motherboard Serial Number from Host Management-Inventory (from SMBIOS)
                            mbasset		# Motherboard Asset Tag from Host Management-Inventory (from SMBIOS)
                            mbproductname	# Motherboard Product Name from Host Management-Inventory (from SMBIOS)
                            caseman		# Chassis Manufacturer from Host Management-Inventory (from SMBIOS)
                            caseserial	# Chassis Serial from Host Management-Inventory (from SMBIOS)
                            caseasset	# Chassis Asset from Host Management-Inventory (from SMBIOS)
                            location	# Host Location (name) from Host Management-General
                            

                            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 2
                            • G
                              george1421 Moderator
                              last edited by Jan 9, 2020, 10:34 PM

                              So you might ask how would you even begin to debug and/or write one of these scripts?

                              Simple you would go in a create your own bash script in /images/postinstall directory call it something like fog.aws or what ever in there create a simple bash script like

                              #!/bin/bash
                              
                              echo "debug my custom script here. Press Ctrl-C to exit now";
                              debugPause;
                              
                              

                              Link that script into the master fog.postdownload script. And then schedule a deployment. Before you hit the schedule task button, tick the debug check box. Then pxe boot the target computer. After a few screens of text where you need to clear with the enter key you will be dropped to the FOS Linux command prompt in debug mode. Key in fog to start the master fog script. The master fog script will stop at each break point waiting for you to press the enter key to move to the next debugPause statement. When you see the message you created in your fog.aws script, hit ctrl-C and exit out of the FOG installer script. At this point you will be where your post install script should run. Now you can start developing your post install actions. The fog post install script should be in /images/postinstall on the FOS Linux target computer you can edit with vi or what ever else is on FOS Linux. You can mount the disk partitions all of the contents of the disk image should be on the target computer by now.

                              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!

                              Z 1 Reply Last reply Jan 10, 2020, 3:14 PM Reply Quote 2
                              • Z
                                zfeng @george1421
                                last edited by Jan 10, 2020, 3:14 PM

                                @george1421 Thanks for that. I will try that out

                                1 Reply Last reply Reply Quote 0
                                • Z
                                  zfeng @Junkhacker
                                  last edited by Jan 10, 2020, 3:29 PM

                                  @Junkhacker thanks for that. I will try that out

                                  1 Reply Last reply Reply Quote 0
                                  • Z
                                    zfeng
                                    last edited by Jan 27, 2020, 8:17 PM

                                    @george1421 @Junkhacker @Tom-Elliott I see what it does now. I actually tried that out. Basically, it copied the script from fog server and placed that into the target computer. Once the target computer powers up, it will run the script automatically. That actually helps. Thanks for your guys effort. I will close this issue then.

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

                                    156

                                    Online

                                    12.0k

                                    Users

                                    17.3k

                                    Topics

                                    155.2k

                                    Posts
                                    Copyright © 2012-2024 FOG Project