propellor-5.3.3: property-based host configuration management in haskell

Safe Haskell | None
Language | Haskell98

Propellor.Property.DiskImage.PartSpec

Contents

- PartSpec combinators
- Partition properties

Description

Disk image partition specification.

Synopsis

- type PartSpec t = (Maybe MountPoint, MountOpts, PartSize -> Partition, t)
- data Fs
  - = EXT2
  - | EXT3
  - | EXT4
  - | BTRFS
  - | REISERFS
  - | XFS
  - | FAT
  - | VFAT
  - | NTFS
  - | LinuxSwap
- data PartSize
  - = MegaBytes Integer
  - | Bytes Integer
- partition :: Monoid t => Fs -> PartSpec t
- swapPartition :: Monoid t => PartSize -> PartSpec t
- rawPartition :: Monoid t => PartSize -> PartSpec t
- mountedAt :: PartSpec t -> MountPoint -> PartSpec t
- addFreeSpace :: PartSpec t -> PartSize -> PartSpec t
- setSize :: PartSpec t -> PartSize -> PartSpec t
- mountOpt :: ToMountOpts o => PartSpec t -> o -> PartSpec t
- errorReadonly :: MountOpts
- reservedSpacePercentage :: PartSpec t -> Int -> PartSpec t
- setFlag :: PartSpec t -> PartFlag -> PartSpec t
- extended :: PartSpec t -> PartSpec t
- hasPartition :: PartSpec PartLocation -> Property (HasInfo + UnixLike)
- adjustPartition :: MountPoint -> (PartSpec PartLocation -> PartSpec PartLocation) -> Property (HasInfo + UnixLike)
- data PartLocation
  - = Beginning
  - | Middle
  - | End
- partLocation :: PartSpec PartLocation -> PartLocation -> PartSpec PartLocation
- hasPartitionTableType :: TableType -> Property (HasInfo + UnixLike)
- data TableType
  - = MSDOS
  - | GPT
  - | AIX
  - | AMIGA
  - | BSD
  - | DVH
  - | LOOP
  - | MAC
  - | PC98
  - | SUN
- data PartInfo
- toPartTableSpec :: PartInfo -> PartTableSpec
- data PartTableSpec = PartTableSpec TableType [PartSpec ()]

# Documentation

type PartSpec t = (Maybe MountPoint, MountOpts, PartSize -> Partition, t) Source #

Specifies a mount point, mount options, and a constructor for a Partition that determines its size.

data Fs Source #

Filesystems etc that can be used for a partition.

Constructors

EXT2 |
EXT3 |
EXT4 |
BTRFS |
REISERFS |
XFS |
FAT |
VFAT |
NTFS |
LinuxSwap |

Instances

Eq Fs Source # |
Methods (==) :: Fs -> Fs -> Bool (/=) :: Fs -> Fs -> Bool
Show Fs Source # |
Methods showsPrec :: Int -> Fs -> ShowS show :: Fs -> String showList :: [Fs] -> ShowS
PartedVal Fs Source # |
Methods pval :: Fs -> String Source #

data PartSize Source #

Size of a partition.

Constructors

MegaBytes Integer |
Bytes Integer |

Instances

Show PartSize Source # |
Methods showsPrec :: Int -> PartSize -> ShowS show :: PartSize -> String showList :: [PartSize] -> ShowS
Monoid PartSize Source # |
Methods mempty :: PartSize mappend :: PartSize -> PartSize -> PartSize mconcat :: [PartSize] -> PartSize

partition :: Monoid t => Fs -> PartSpec t Source #

Specifies a partition with a given filesystem.

The partition is not mounted anywhere by default; use the combinators below to configure it.

# PartSpec combinators

swapPartition :: Monoid t => PartSize -> PartSpec t Source #

Specifies a swap partition of a given size.

rawPartition :: Monoid t => PartSize -> PartSpec t Source #

Specifies a partition without any filesystem, of a given size.

mountedAt :: PartSpec t -> MountPoint -> PartSpec t Source #

Specifies where to mount a partition.

addFreeSpace :: PartSpec t -> PartSize -> PartSpec t Source #

Partitions in disk images default to being sized large enough to hold the files that live in that partition.

This adds additional free space to a partition.

setSize :: PartSpec t -> PartSize -> PartSpec t Source #

Specify a fixed size for a partition.

mountOpt :: ToMountOpts o => PartSpec t -> o -> PartSpec t Source #

Specifies a mount option, such as "noexec"

errorReadonly :: MountOpts Source #

Mount option to make a partition be remounted readonly when there's an error accessing it.

reservedSpacePercentage :: PartSpec t -> Int -> PartSpec t Source #

Sets the percent of the filesystem blocks reserved for the super-user.

The default is 5% for ext2 and ext4. Some filesystems may not support this.

setFlag :: PartSpec t -> PartFlag -> PartSpec t Source #

Sets a flag on the partition.

extended :: PartSpec t -> PartSpec t Source #

Makes a MSDOS partition be Extended, rather than Primary.

# Partition properties

These properties do not do any disk partitioning on their own, but the Info they set can be used when building a disk image for a host.

hasPartition :: PartSpec PartLocation -> Property (HasInfo + UnixLike) Source #

Indicates that a host has a partition.

For example:

    	& hasPartiton (partition EXT2 `mountedAt` "/boot" `partLocation` Beginning)
    	& hasPartiton (partition EXT4 `mountedAt` "/")
    	& hasPartiton (partition EXT4 `mountedAt` "/home" `partLocation` End `reservedSpacePercentage` 0)

adjustPartition :: MountPoint -> (PartSpec PartLocation -> PartSpec PartLocation) -> Property (HasInfo + UnixLike) Source #

Adjusts the PartSpec for the partition mounted at the specified location.

For example:

    	& adjustPartition "/boot" (`addFreeSpace` MegaBytes 150)

data PartLocation Source #

Indicates partition layout in a disk. Default is somewhere in the middle.

Constructors

Beginning |
Middle |
End |

Instances

Eq PartLocation Source # |
Methods (==) :: PartLocation -> PartLocation -> Bool (/=) :: PartLocation -> PartLocation -> Bool
Ord PartLocation Source # |
Methods compare :: PartLocation -> PartLocation -> Ordering (<) :: PartLocation -> PartLocation -> Bool (<=) :: PartLocation -> PartLocation -> Bool (>) :: PartLocation -> PartLocation -> Bool (>=) :: PartLocation -> PartLocation -> Bool max :: PartLocation -> PartLocation -> PartLocation min :: PartLocation -> PartLocation -> PartLocation
Monoid PartLocation Source # |
Methods mempty :: PartLocation mappend :: PartLocation -> PartLocation -> PartLocation mconcat :: [PartLocation] -> PartLocation

partLocation :: PartSpec PartLocation -> PartLocation -> PartSpec PartLocation Source #

hasPartitionTableType :: TableType -> Property (HasInfo + UnixLike) Source #

Indicates the partition table type of a host.

When not specified, the default is MSDOS.

For example:

    	& hasPartitionTableType GPT

data TableType Source #

Types of partition tables supported by parted.

Constructors

MSDOS |
GPT |
AIX |
AMIGA |
BSD |
DVH |
LOOP |
MAC |
PC98 |
SUN |

Instances

Show TableType Source # |
Methods showsPrec :: Int -> TableType -> ShowS show :: TableType -> String showList :: [TableType] -> ShowS
PartedVal TableType Source # |
Methods pval :: TableType -> String Source #

data PartInfo Source #

Instances

Show PartInfo Source # |
Methods showsPrec :: Int -> PartInfo -> ShowS show :: PartInfo -> String showList :: [PartInfo] -> ShowS
Monoid PartInfo Source # |
Methods mempty :: PartInfo mappend :: PartInfo -> PartInfo -> PartInfo mconcat :: [PartInfo] -> PartInfo
IsInfo PartInfo Source # |
Methods propagateInfo :: PartInfo -> PropagateInfo Source #

toPartTableSpec :: PartInfo -> PartTableSpec Source #

data PartTableSpec Source #

Specifies a partition table.

Constructors

PartTableSpec TableType [PartSpec ()] |

Instances

Show PartTableSpec Source # |
Methods showsPrec :: Int -> PartTableSpec -> ShowS show :: PartTableSpec -> String showList :: [PartTableSpec] -> ShowS