updateConfig :: String -- Capsule name
               -> FilePath -- Capsule location
               -> Options -- Options
               -> IO FilePath -- Temporary config file location
  updateConfig capsule capsuleLoc opts = do
    rand <- (randomIO :: IO Int)
    let tmpConfig = "/tmp/config-" ++ capsule ++ show rand
    let tmpFstab = "/tmp/fstab-" ++ capsule ++ show rand
    let update c =  Lxc.setConfig "lxc.rootfs" [(capsuleLoc </> "rootfs")] .
                    Lxc.setConfig "lxc.mount"  [tmpFstab] .
                    Lxc.setConfig "lxc.utsname" [capsule] $ c
    writeFstab capsuleLoc tmpFstab opts
    Lxc.readConfig configloc >>= Lxc.writeConfig tmpConfig . update
    return tmpConfig
    where 
      configloc = (capsuleLoc </> "config")
            
  -- Write the FSTAB for the capsule.
updateConfig :: String -- Capsule name
               -> FilePath -- Capsule location
               -> Options -- Options
               -> IO FilePath
updateConfig capsule capsuleLoc opts = do
    rand <- (randomIO :: IO Int)
    let tmpConfig = "/tmp/config-" ++ capsule ++ show rand
    let tmpFstab = "/tmp/fstab-" ++ capsule ++ show rand
    let update c =  Lxc.setConfig "lxc.rootfs" [(capsuleLoc </> "rootfs")] .
                    Lxc.setConfig "lxc.mount"  [tmpFstab] .
                    Lxc.setConfig "lxc.utsname" [capsule] $ c
    writeFstab capsuleLoc tmpFstab opts
    Lxc.readConfig configloc >>= Lxc.writeConfig tmpConfig . update
    return tmpConfig
    where 
      configloc = (capsuleLoc </> "config")
            
  -- Write the FSTAB for the capsule.
updateConfig capsule capsuleLoc opts = do
    rand <- (randomIO :: IO Int)
    let tmpConfig = "/tmp/config-" ++ capsule ++ show rand
    let tmpFstab = "/tmp/fstab-" ++ capsule ++ show rand
    let update c =  Lxc.setConfig "lxc.rootfs" [(capsuleLoc </> "rootfs")] .
                    Lxc.setConfig "lxc.mount"  [tmpFstab] .
                    Lxc.setConfig "lxc.utsname" [capsule] $ c
    writeFstab capsuleLoc tmpFstab opts
    Lxc.readConfig configloc >>= Lxc.writeConfig tmpConfig . update
    return tmpConfig
    where 
      configloc = (capsuleLoc </> "config")
            
  -- Write the FSTAB for the capsule.