System.Unix.Chroot

Unixutils-1.54.1: A crude interface between Haskell and Unix-like operating systems

Safe Haskell | Safe
Language | Haskell98

System.Unix.Chroot

Description

This module, except for useEnv, is copied from the build-env package.

Synopsis

- fchroot :: (MonadIO m, MonadMask m) => FilePath -> m a -> m a
- useEnv :: (MonadIO m, MonadMask m) => FilePath -> (a -> m a) -> m a -> m a

# Documentation

fchroot :: (MonadIO m, MonadMask m) => FilePath -> m a -> m a #

fchroot runs an IO action inside a chroot fchroot performs a chroot, runs the action, and then restores the original root and working directory. This probably affects the chroot and working directory of all the threads in the process, so... NOTE: will throw IOError if internal chroot fails

useEnv :: (MonadIO m, MonadMask m) => FilePath -> (a -> m a) -> m a -> m a #

The ssh inside of the chroot needs to be able to talk to the running ssh-agent. Therefore we mount --bind the ssh agent socket dir inside the chroot (and umount it when we exit the chroot.