diff options
| author | Joey Hess <joeyh@joeyh.name> | 2016-03-26 15:14:20 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2016-03-26 15:14:20 -0400 |
| commit | 636c7cf5ba42d3636e06f298feae0b9219be6067 (patch) | |
| tree | 07dd62f06b56e7eddcd6d53973e4f4c063d00c27 /doc | |
| parent | 341064ea8cfaeb04ec4129239edc096a314de036 (diff) | |
update docs for new property types
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/FreeBSD.mdwn | 6 | ||||
| -rw-r--r-- | doc/Linux.mdwn | 2 | ||||
| -rw-r--r-- | doc/haskell_newbie.mdwn | 2 | ||||
| -rw-r--r-- | doc/writing_properties.mdwn | 10 |
4 files changed, 11 insertions, 9 deletions
diff --git a/doc/FreeBSD.mdwn b/doc/FreeBSD.mdwn index 2edff223..47b9c65b 100644 --- a/doc/FreeBSD.mdwn +++ b/doc/FreeBSD.mdwn @@ -1,8 +1,10 @@ Propellor is in the early stages of supporting FreeBSD. It should basically work, and there are some modules with FreeBSD-specific properties. -However, many other properties assume they're being run on a -Debian Linux system, and need additional porting to support FreeBSD. +However, many other properties only work on a Debian Linux system, and need +additional porting to support FreeBSD. Such properties have types like +`Property DebianLike`. The type checker will detect and reject attempts +to combine such properties with `Property FreeBSD`. [Sample config file](http://git.joeyh.name/?p=propellor.git;a=blob;f=config-freebsd.hs) which configures a FreeBSD system, as well as a Linux one. diff --git a/doc/Linux.mdwn b/doc/Linux.mdwn index 0434d69d..00276f69 100644 --- a/doc/Linux.mdwn +++ b/doc/Linux.mdwn @@ -6,4 +6,4 @@ Indeed, Propellor has been ported to [[FreeBSD]] now! See [[forum/Supported_OS]] for porting tips. Note that you can run Propellor on a OSX laptop and have it manage Linux -systems. +and other systems. diff --git a/doc/haskell_newbie.mdwn b/doc/haskell_newbie.mdwn index e92481f9..a150b202 100644 --- a/doc/haskell_newbie.mdwn +++ b/doc/haskell_newbie.mdwn @@ -96,7 +96,7 @@ is. <pre> config.hs:30:19: Couldn't match expected type `RevertableProperty' - with actual type `Property NoInfo' + with actual type `Property DebianLike' In the return type of a call of `Apt.installed' In the second argument of `(!)', namely `Apt.installed ["ssh"]' In the first argument of `(&)', namely diff --git a/doc/writing_properties.mdwn b/doc/writing_properties.mdwn index 2209026f..1b7f046a 100644 --- a/doc/writing_properties.mdwn +++ b/doc/writing_properties.mdwn @@ -31,7 +31,7 @@ Propellor makes it very easy to put together a property like this. Let's start with a property that combines the two properties you mentioned: - hasLoginShell :: UserName -> FilePath -> Property + hasLoginShell :: UserName -> FilePath -> Property UnixLike hasLoginShell user shell = shellSetTo user shell `requires` shellEnabled shell The shellEnabled property can be easily written using propellor's file @@ -40,14 +40,14 @@ manipulation properties. -- Need to add an import to the top of the source file. import qualified Propellor.Property.File as File - shellEnabled :: FilePath -> Property + shellEnabled :: FilePath -> Property UnixLike shellEnabled shell = "/etc/shells" `File.containsLine` shell And then, we want to actually change the user's shell. The `chsh(1)` program can do that, so we can simply tell propellor the command line to run: - shellSetTo :: UserName -> FilePath -> Property + shellSetTo :: UserName -> FilePath -> Property UnixLike shellSetTo user shell = cmdProperty "chsh" ["--shell", shell, user] The only remaining problem with this is that shellSetTo runs chsh every @@ -56,7 +56,7 @@ it runs, even when it didn't really do much. Now, there's an easy way to avoid that problem, we could just tell propellor to assume that chsh has not made a change: - shellSetTo :: UserName -> FilePath -> Property + shellSetTo :: UserName -> FilePath -> Property UnixLike shellSetTo user shell = cmdProperty "chsh" ["--shell", shell, user] `assume` NoChange @@ -64,7 +64,7 @@ But, it's not much harder to do this right. Let's make the property check if the user's shell is already set to the desired value and avoid doing anything in that case. - shellSetTo :: UserName -> FilePath -> Property + shellSetTo :: UserName -> FilePath -> Property UnixLike shellSetTo user shell = check needchangeshell $ cmdProperty "chsh" ["--shell", shell, user] where |
