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

Safe Haskell | None
Language | Haskell98

Propellor.Property.Fstab

Synopsis

- type FsType = String
- type Source = String
- type MountPoint = FilePath
- newtype MountOpts = MountOpts [String]
- mounted :: FsType -> Source -> MountPoint -> MountOpts -> Property Linux
- listed :: FsType -> Source -> MountPoint -> MountOpts -> Property UnixLike
- swap :: Source -> Property Linux
- newtype SwapPartition = SwapPartition FilePath
- fstabbed :: [MountPoint] -> [SwapPartition] -> Property Linux
- genFstab :: [MountPoint] -> [SwapPartition] -> (MountPoint -> MountPoint) -> IO [String]
- noFstab :: IO Bool

# Documentation

type FsType = String Source #

type of filesystem to mount ("auto" to autodetect)

type Source = String Source #

A device or other thing to be mounted.

type MountPoint = FilePath Source #

A mount point for a filesystem.

newtype MountOpts Source #

Filesystem mount options. Eg, MountOpts ["errors=remount-ro"]

For default mount options, use `mempty`.

Constructors

MountOpts [String] |

Instances

Monoid MountOpts Source # |
Methods mempty :: MountOpts mappend :: MountOpts -> MountOpts -> MountOpts mconcat :: [MountOpts] -> MountOpts
ToMountOpts MountOpts Source # |
Methods toMountOpts :: MountOpts -> MountOpts Source #

mounted :: FsType -> Source -> MountPoint -> MountOpts -> Property Linux Source #

Ensures that /etc/fstab contains a line mounting the specified `Source` on the specified `MountPoint`, and that it's currently mounted.

For example:

    mounted "auto" "/dev/sdb1" "/srv" mempty

Note that if anything else is already mounted at the `MountPoint`, it will be left as-is by this property.

listed :: FsType -> Source -> MountPoint -> MountOpts -> Property UnixLike Source #

Ensures that /etc/fstab contains a line mounting the specified `Source` on the specified `MountPoint`. Does not ensure that it's currently `mounted`.

swap :: Source -> Property Linux Source #

Ensures that /etc/fstab contains a line enabling the specified `Source` to be used as swap space, and that it's enabled.

newtype SwapPartition Source #

Constructors

SwapPartition FilePath |

fstabbed :: [MountPoint] -> [SwapPartition] -> Property Linux Source #

Replaces /etc/fstab with a file that should cause the currently mounted partitions to be re-mounted the same way on boot.

For each specified MountPoint, the UUID of each partition (or if there is no UUID, its label), its filesystem type, and its mount options are all automatically probed.

The SwapPartitions are also included in the generated fstab.

genFstab :: [MountPoint] -> [SwapPartition] -> (MountPoint -> MountPoint) -> IO [String] Source #

noFstab :: IO Bool Source #

Checks if /etc/fstab is not configured. This is the case if it doesn't exist, or consists entirely of blank lines or comments.

So, if you want to only replace the fstab once, and then never touch it again, allowing local modifications:

    check noFstab (fstabbed mnts [])