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

Postdownloadscripts to specific partitions

Scheduled Pinned Locked Moved Solved
FOG Problems
4
11
2.3k
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.
  • T
    Thiago
    last edited by Jan 21, 2016, 12:05 PM

    I need a little help with postdownloadscripts. Are they executed after all image are deployed or one partition?

    We have 4 partitions in a disk (mbr) and we need to change a hostname in linux and hostname in a file under Windows partition.
    The problem is that linux and windows are not fixed to a partition numbers (sometimes sda3 or sda and so on)

    How can i identify Windows or Linux, excluding swap and recovery?
    Maybe this is more about linux skills than fog.

    C 1 Reply Last reply Jan 21, 2016, 1:34 PM Reply Quote 0
    • C
      ch3i Moderator @Thiago
      last edited by ch3i Jan 21, 2016, 7:34 AM Jan 21, 2016, 1:34 PM

      @Thiago Hi, you can use fdisk -l to identify the partition type via the id

      List of IDs :

      0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris
       1  FAT12           39  Plan 9          82  Linux swap / So c1  DRDOS/sec (FAT-
       2  XENIX root      3c  PartitionMagic  83  Linux           c4  DRDOS/sec (FAT-
       3  XENIX usr       40  Venix 80286     84  OS/2 hidden C:  c6  DRDOS/sec (FAT-
       4  FAT16 <32M      41  PPC PReP Boot   85  Linux extended  c7  Syrinx
       5  Extended        42  SFS             86  NTFS volume set da  Non-FS data
       6  FAT16           4d  QNX4.x          87  NTFS volume set db  CP/M / CTOS / .
       7  HPFS/NTFS       4e  QNX4.x 2nd part 88  Linux plaintext de  Dell Utility
       8  AIX             4f  QNX4.x 3rd part 8e  Linux LVM       df  BootIt
       9  AIX bootable    50  OnTrack DM      93  Amoeba          e1  DOS access
       a  OS/2 Boot Manag 51  OnTrack DM6 Aux 94  Amoeba BBT      e3  DOS R/O
       b  W95 FAT32       52  CP/M            9f  BSD/OS          e4  SpeedStor
       c  W95 FAT32 (LBA) 53  OnTrack DM6 Aux a0  IBM Thinkpad hi eb  BeOS fs
       e  W95 FAT16 (LBA) 54  OnTrackDM6      a5  FreeBSD         ee  GPT
       f  W95 Ext'd (LBA) 55  EZ-Drive        a6  OpenBSD         ef  EFI (FAT-12/16/
      10  OPUS            56  Golden Bow      a7  NeXTSTEP        f0  Linux/PA-RISC b
      11  Hidden FAT12    5c  Priam Edisk     a8  Darwin UFS      f1  SpeedStor
      12  Compaq diagnost 61  SpeedStor       a9  NetBSD          f4  SpeedStor
      14  Hidden FAT16 <3 63  GNU HURD or Sys ab  Darwin boot     f2  DOS secondary
      16  Hidden FAT16    64  Novell Netware  af  HFS / HFS+      fb  VMware VMFS
      17  Hidden HPFS/NTF 65  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE
      18  AST SmartSleep  70  DiskSecure Mult b8  BSDI swap       fd  Linux raid auto
      1b  Hidden W95 FAT3 75  PC/IX           bb  Boot Wizard hid fe  LANstep
      1c  Hidden W95 FAT3 80  Old Minix       be  Solaris boot    ff  BBT
      1e  Hidden W95 FAT1
      
      1 Reply Last reply Reply Quote 1
      • G
        george1421 Moderator
        last edited by george1421 Jan 21, 2016, 8:01 AM Jan 21, 2016, 1:42 PM

        Do you mean you are putting both linux and windows on the same hard drive?

        If not then you can check the system type and then make your partition selection from that. If you do have floating partitions, I think you better work on a different plan because this will be trouble to manage.

        Just for reference you can use the variable $osid to identify the OS that will be deployed to the target computer.

        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!

        T 1 Reply Last reply Jan 21, 2016, 2:11 PM Reply Quote 0
        • T
          Thiago @george1421
          last edited by Jan 21, 2016, 2:11 PM

          @george1421
          Yes, Windows and linux are on the same drive. All computers have only 1 disk.
          While our organization don’t make a default layout for disks (fixed parts for specific system), i will try using $osid.
          This variable inside a postdownscript env, identify parts or system images defined in fog web ui?

          1 Reply Last reply Reply Quote 0
          • G
            george1421 Moderator
            last edited by Jan 21, 2016, 2:17 PM

            The $osid is populated with the value you assign to the image from within the fog console. The integer number stored in $osid is the integer value listed in the drop down list for Operating System under image management.

            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
            • S
              Sebastian Roth Moderator
              last edited by Jan 21, 2016, 9:01 PM

              @Thiago $osid is set for a whole image (all partitions) AFAIK. So this won’t be of much help for you. ch3i’s suggestion using fdisk sounds like a good idea. Or you can use lsblk -o KNAME,FSTYPE

              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

              T 1 Reply Last reply Jan 22, 2016, 11:33 AM Reply Quote 1
              • T
                Thiago @Sebastian Roth
                last edited by Jan 22, 2016, 11:33 AM

                @Sebastian-Roth
                Thanks for the tip.
                assuming we have only one disk on each machine, there are always 2 parts for Windows (winre and C:) and 2 for linux (swap and /).
                My 1st idea is to do something like this:

                #for linux
                fdisk -l /dev/sda | awk '/ 83 / {print $1}'
                

                or this

                #for windows, it requires more pipes
                fdisk -l /dev/sda | awk '/ 7 /' | sort -k5 -h | tail -n1 | awk '{print $1}'
                

                I will work on this.
                Thank you all for the great help.

                1 Reply Last reply Reply Quote 0
                • G
                  george1421 Moderator
                  last edited by george1421 Jan 22, 2016, 5:40 AM Jan 22, 2016, 11:40 AM

                  Sorry for me being dumb here, but what is the use case for having both windows and linux partitions on the same physical disk? Are you doing a dual boot between linux and windows?

                  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!

                  T 1 Reply Last reply Jan 22, 2016, 11:55 AM Reply Quote 0
                  • T
                    Thiago @george1421
                    last edited by Jan 22, 2016, 11:55 AM

                    @george1421
                    Yes we have dual boot system. Debian 8 with Win10/Vista.
                    Computers Lab.

                    G 1 Reply Last reply Jan 22, 2016, 12:41 PM Reply Quote 0
                    • G
                      george1421 Moderator @Thiago
                      last edited by Jan 22, 2016, 12:41 PM

                      @Thiago OK then please stay with me here (not trying to be too difficult).

                      Can I assume you have one image you captured and are deploying to these computers? If so that captured image has a specific drive layout and doesn’t matter if it is windows or linux. For example /dev/sda2 within that image will always be the linux swap partition when you deploy that specific captured image. Or if you have 2 image captured, for image 1, /dev/sda2 will always be that swap partition. So if this is the case you will always know the layout of the target computer because of the layout of the original captured image.

                      There is also a post download variable you can use called $img that matches the captured image name in fog. You could create a switch statement so if $img = “image1” then geometry is x,y, if $img = “image2” then geometry is y,z.

                      Don’t get me wrong, you can do it the way you have planned no problem. It would be more flexible if you have many images, but if you only have a few making a few assumptions (educated guesses) based on the know configuration of the captured image would give you results faster.

                      The other thought I had, what are you using for the dual boot loader for these computers? Grub? It may be possible to query the grub config file to find the location of important partitions 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!

                      T 1 Reply Last reply Jan 22, 2016, 1:06 PM Reply Quote 0
                      • T
                        Thiago @george1421
                        last edited by Jan 22, 2016, 1:06 PM

                        @george1421
                        we have a few images. my script mount directly (i.e. mount /dev/sda2 /windows)
                        The problem is: now, our server will be used by another department with other config (i only know that they have 4 parts, using mbr) and sometimes the image name can change, disk layout too.
                        I like your idea and wanna let things more generalized as possible.
                        in any case, this is temporary until standardize all
                        Thanks a lot

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

                        238

                        Online

                        12.0k

                        Users

                        17.3k

                        Topics

                        155.2k

                        Posts
                        Copyright © 2012-2024 FOG Project