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

Safe HaskellNone
LanguageHaskell98

Propellor.Property.Parted

Contents

Synopsis

Types

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 PartTable Source #

A disk's partition table.

Constructors

PartTable TableType [Partition] 

Instances

Show PartTable Source # 

Methods

showsPrec :: Int -> PartTable -> ShowS

show :: PartTable -> String

showList :: [PartTable] -> ShowS

Monoid PartTable Source # 

partTableSize :: PartTable -> ByteSize Source #

Gets the total size of the disk specified by the partition table.

data Partition Source #

A partition on the disk.

Constructors

Partition 

Fields

Instances

Show Partition Source # 

Methods

showsPrec :: Int -> Partition -> ShowS

show :: Partition -> String

showList :: [Partition] -> ShowS

mkPartition :: Fs -> PartSize -> Partition Source #

Makes a Partition with defaults for non-important values.

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 #

newtype PartSize Source #

All partition sizing is done in megabytes, so that parted can automatically lay out the partitions.

Note that these are SI megabytes, not mebibytes.

Constructors

MegaBytes Integer 

Instances

Show PartSize Source # 

Methods

showsPrec :: Int -> PartSize -> ShowS

show :: PartSize -> String

showList :: [PartSize] -> ShowS

Monoid PartSize Source # 
PartedVal PartSize Source # 

Methods

pval :: PartSize -> String Source #

type ByteSize = Integer Source #

toPartSize :: ByteSize -> PartSize Source #

Rounds up to the nearest MegaByte.

type MkfsOpts = [String] Source #

Options passed to a mkfs.* command when making a filesystem.

Eg, ["-m0"]

data PartType Source #

Type of a partition.

Constructors

Primary 
Logical 
Extended 

Instances

Show PartType Source # 

Methods

showsPrec :: Int -> PartType -> ShowS

show :: PartType -> String

showList :: [PartType] -> ShowS

PartedVal PartType Source # 

Methods

pval :: PartType -> String Source #

data PartFlag Source #

Flags that can be set on a partition.

Instances

Show PartFlag Source # 

Methods

showsPrec :: Int -> PartFlag -> ShowS

show :: PartFlag -> String

showList :: [PartFlag] -> ShowS

PartedVal PartFlag Source # 

Methods

pval :: PartFlag -> String Source #

Properties

partitioned :: Eep -> FilePath -> PartTable -> Property DebianLike Source #

Partitions a disk using parted, and formats the partitions.

The FilePath can be a block device (eg, /dev/sda), or a disk image file.

This deletes any existing partitions in the disk! Use with EXTREME caution!

parted :: Eep -> FilePath -> [String] -> Property (DebianLike + ArchLinux) Source #

Runs parted on a disk with the specified parameters.

Parted is run in script mode, so it will never prompt for input. It is asked to use cylinder alignment for the disk.

installed :: Property (DebianLike + ArchLinux) Source #

Gets parted installed.

PartSpec combinators

calcPartTable :: DiskSize -> TableType -> [PartSpec DiskPart] -> PartTable Source #

Calculate a partition table, for a given size of disk.

For example:

	calcPartTable (DiskSize (1024 * 1024 * 1024 * 100)) MSDOS
 		[ partition EXT2 `mountedAt` "/boot"
 			`setSize` MegaBytes 256
 			`setFlag` BootFlag
		, partition EXT4 `mountedAt` "/"
			`useDisk` RemainingSpace
		]

newtype DiskSize Source #

Size of a disk, in bytes.

Constructors

DiskSize ByteSize 

Instances

Show DiskSize Source # 

Methods

showsPrec :: Int -> DiskSize -> ShowS

show :: DiskSize -> String

showList :: [DiskSize] -> ShowS

data DiskSpaceUse Source #

Constructors

Percent Int 
RemainingSpace 

useDiskSpace :: PartSpec DiskPart -> DiskSpaceUse -> PartSpec DiskPart Source #

Make a partition use some percentage of the size of the disk (less all fixed size partitions), or the remaining space in the disk.