nfsexports

package module
v0.0.0-...-0364872 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2021 License: MIT Imports: 7 Imported by: 17

README

nfsexports Build Status

Go util to manage NFS exports /etc/exports.

Features

  • Add and remove exports
  • Verify the added export is valid, before updating
  • Auto-creates missing exports file, which auto starts nfsd on OS X
  • Handles missing line breaks
package main

import (
    "github.com/johanneswuerbach/nfsexports"
)

func main() {
  newExports, err := nfsexports.Add("", "myExport", "/Users 192.168.64.16 -alldirs -maproot=root")
  if err != nil {
      panic(err)
  }

  newExports, err := nfsexports.Remove("", "myExport")
  if err != nil {
      panic(err)
  }

  if err = nfsexports.ReloadDaemon(); err != nil {
      panic(err)
  }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(exportsFile string, identifier string, export string) ([]byte, error)

Add export, if exportsFile is an empty string /etc/exports is used

func Exists

func Exists(exportsFile string, identifier string) (bool, error)

Exists checks the existence of a given export The export must, however, have been created by this library using Add

func List

func List(exportsFile string) (map[string]string, error)

List returns the list of exports *created by* nfsexports This means other exports might be present in the file but won't be returned by this function

func ListAll

func ListAll(exportsFile string) ([]string, error)

ListAll returns all nfsexports present in the exports file. ListAll does not check the validity of the exports; It simply returns any line present in the file that is not a comment

func ReloadDaemon

func ReloadDaemon() error

ReloadDaemon reload NFS daemon

func Remove

func Remove(exportsFile string, identifier string) ([]byte, error)

Remove export, if exportsFile is an empty string /etc/exports is used

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL