summaryrefslogtreecommitdiff
path: root/src/Propellor/Types/OS.hs
diff options
context:
space:
mode:
authorJoey Hess2016-03-07 16:36:36 -0400
committerJoey Hess2016-03-07 16:36:36 -0400
commit16a95afa2fe22a4df9c371489c4ee7ffdef8e07b (patch)
tree6e0869e78aba03be2591569369e1e099bb86568e /src/Propellor/Types/OS.hs
parent9bbc292b3f903a1476e3524bb9198e58ce300401 (diff)
parent822694e790102efa2a5bb4a0c3d62c6fce1d4e87 (diff)
Merge remote-tracking branch 'remotes/misandrist/FreeBSD' into wip
Diffstat (limited to 'src/Propellor/Types/OS.hs')
-rw-r--r--src/Propellor/Types/OS.hs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/Propellor/Types/OS.hs b/src/Propellor/Types/OS.hs
index 0abc76ac..a1ba14d4 100644
--- a/src/Propellor/Types/OS.hs
+++ b/src/Propellor/Types/OS.hs
@@ -4,6 +4,8 @@ module Propellor.Types.OS (
System(..),
Distribution(..),
DebianSuite(..),
+ FreeBSDRelease(..),
+ FBSDVersion(..),
isStable,
Release,
Architecture,
@@ -18,6 +20,7 @@ module Propellor.Types.OS (
import Network.BSD (HostName)
import Data.Typeable
+import Data.String
-- | High level description of a operating system.
data System = System Distribution Architecture
@@ -26,6 +29,7 @@ data System = System Distribution Architecture
data Distribution
= Debian DebianSuite
| Buntish Release -- ^ A well-known Debian derivative founded by a space tourist. The actual name of this distribution is not used in Propellor per <http://joeyh.name/blog/entry/trademark_nonsense/>)
+ | FreeBSD FreeBSDRelease
deriving (Show, Eq)
-- | Debian has several rolling suites, and a number of stable releases,
@@ -33,6 +37,24 @@ data Distribution
data DebianSuite = Experimental | Unstable | Testing | Stable Release
deriving (Show, Eq)
+-- | FreeBSD breaks their releases into "Production" and "Legacy".
+data FreeBSDRelease = FBSDProduction FBSDVersion | FBSDLegacy FBSDVersion
+ deriving (Show, Eq)
+
+data FBSDVersion = FBSD101 | FBSD102 | FBSD093
+ deriving (Eq)
+
+instance IsString FBSDVersion where
+ fromString "10.1-RELEASE" = FBSD101
+ fromString "10.2-RELEASE" = FBSD102
+ fromString "9.3-RELEASE" = FBSD093
+ fromString _ = error "Invalid FreeBSD release"
+
+instance Show FBSDVersion where
+ show FBSD101 = "10.1-RELEASE"
+ show FBSD102 = "10.2-RELEASE"
+ show FBSD093 = "9.3-RELEASE"
+
isStable :: DebianSuite -> Bool
isStable (Stable _) = True
isStable _ = False