parameters: (self)
docstring: Create fstab.
docstring_summary: Create fstab.
docstring_tokens: Create fstab .
function: def generate_fstab(self):
          """ Create fstab. """
          mkdir_p(os.path.join(self.root_mount_point, "etc"))
          fstab_path = os.path.join(self.root_mount_point, "etc", "fstab")
  
          with open(fstab_path, "w") as fstab_file:
              print(FSTAB_HEADER, file=fstab_file)
  
              for partition in self.partitions:
                  # Special treatment for a btrfs subvolumes
                  if (partition["fs"] == "btrfs"
                     and partition["mountPoint"] == "/"):
                      # Subvolume list has been created in mount.conf and curated in mount module,
                      # so all subvolumes here should be safe to add to fstab
                      btrfs_subvolumes = libcalamares.globalstorage.value("btrfsSubvolumes")
                      for s in btrfs_subvolumes:
                          mount_entry = partition
                          mount_entry["mountPoint"] = s["mountPoint"]
                          mount_entry["subvol"] = s["subvolume"]
                          dct = self.generate_fstab_line_info(mount_entry)
                          if dct:
                                  self.print_fstab_line(dct, file=fstab_file)
                  elif partition["fs"] != "zfs":  # zfs partitions don't need an entry in fstab
                      dct = self.generate_fstab_line_info(partition)
                      if dct:
                          self.print_fstab_line(dct, file=fstab_file)
  
              if self.root_is_ssd:
                  # Mount /tmp on a tmpfs
                  dct = dict(device="tmpfs",
                             mount_point="/tmp",
                             fs="tmpfs",
                             options="defaults,noatime,mode=1777",
                             check=0,
                             )
                  self.print_fstab_line(dct, file=fstab_file)
function_tokens: def generate_fstab ( self ) : mkdir_p ( os . path . join ( self . root_mount_point , "etc" ) ) fstab_path = os . path . join ( self . root_mount_point , "etc" , "fstab" ) with open ( fstab_path , "w" ) as fstab_file : print ( FSTAB_HEADER , file = fstab_file ) for partition in self . partitions : # Special treatment for a btrfs subvolumes if ( partition [ "fs" ] == "btrfs" and partition [ "mountPoint" ] == "/" ) : # Subvolume list has been created in mount.conf and curated in mount module, # so all subvolumes here should be safe to add to fstab btrfs_subvolumes = libcalamares . globalstorage . value ( "btrfsSubvolumes" ) for s in btrfs_subvolumes : mount_entry = partition mount_entry [ "mountPoint" ] = s [ "mountPoint" ] mount_entry [ "subvol" ] = s [ "subvolume" ] dct = self . generate_fstab_line_info ( mount_entry ) if dct : self . print_fstab_line ( dct , file = fstab_file ) elif partition [ "fs" ] != "zfs" : # zfs partitions don't need an entry in fstab dct = self . generate_fstab_line_info ( partition ) if dct : self . print_fstab_line ( dct , file = fstab_file ) if self . root_is_ssd : # Mount /tmp on a tmpfs dct = dict ( device = "tmpfs" , mount_point = "/tmp" , fs = "tmpfs" , options = "defaults,noatime,mode=1777" , check = 0 , ) self . print_fstab_line ( dct , file = fstab_file )