diff options
| author | Joey Hess <joeyh@joeyh.name> | 2016-04-05 11:09:57 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2016-04-05 11:09:57 -0400 |
| commit | 7070899c187a3d2c6be538b8497428a23ae096f3 (patch) | |
| tree | 4e1e57417e02b2967a6e6edfb0bbbf81b65706d7 | |
| parent | 88dbf97a3678325340a7c10608c9552e0516faaf (diff) | |
comment
| -rw-r--r-- | doc/forum/newbie_trying_to_set_up_NFS_mount/comment_1_8524e66ddfa2d21ae7b70f257984fc2c._comment | 30 | ||||
| -rw-r--r-- | src/Propellor/Property/Mount.hs | 2 |
2 files changed, 31 insertions, 1 deletions
diff --git a/doc/forum/newbie_trying_to_set_up_NFS_mount/comment_1_8524e66ddfa2d21ae7b70f257984fc2c._comment b/doc/forum/newbie_trying_to_set_up_NFS_mount/comment_1_8524e66ddfa2d21ae7b70f257984fc2c._comment new file mode 100644 index 00000000..0a4367d9 --- /dev/null +++ b/doc/forum/newbie_trying_to_set_up_NFS_mount/comment_1_8524e66ddfa2d21ae7b70f257984fc2c._comment @@ -0,0 +1,30 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2016-04-05T14:53:53Z" + content=""" +The easy way to translate your command to a property is: + + cmdProperty "mount" ["-t", "nfs", "192.168.1.100:/mnt/usb1", "/mnt/nfs"] + `assume` MadeChange + +This has the benefit of working with any command you might want, +and the drawback of not preventing eg, re-mounting an already +mounted device. + +`mounted` takes a `MountOpts` which is a specialized data type. +You can construct one with eg, `(MountOpts ["defaults"])`. + +But, since `MountOpts` is a `Monoid`, and "defaults" is the default of an +empty `MountOpts`, you can more simply use `mempty` to get the default one: + + Mount.mounted "nfs" "192.168.1.100:/mnt/usb1" "/mnt/nfs" mempty + +Propellor.Property.Mount was mostly written for use by some other +properties, and so doesn't really target the end user as much. And, I +notice, its `mounted` property doesn't check if the device is already +mounted and so will try to re-mount unnecessarily. + +I'm not sure if manually driving the mount command makes the most sense; +wouldn't it be better to have a property that updates /etc/fstab? +"""]] diff --git a/src/Propellor/Property/Mount.hs b/src/Propellor/Property/Mount.hs index 5921755c..943986c6 100644 --- a/src/Propellor/Property/Mount.hs +++ b/src/Propellor/Property/Mount.hs @@ -19,7 +19,7 @@ type Source = String -- | A mount point for a filesystem. type MountPoint = FilePath --- | Filesystem mount options. Eg, "errors=remount-ro" +-- | Filesystem mount options. Eg, MountOpts ["errors=remount-ro"] newtype MountOpts = MountOpts [String] deriving Monoid |
