summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2015-11-24 16:38:05 -0400
committerJoey Hess <joeyh@joeyh.name>2015-11-24 16:38:05 -0400
commit4db01fc714a12a5c8fed455ebbe37115f596aee5 (patch)
treea076929632099cb43df5697b8f9307f1843bdc11 /src
parent61be7bc943907d2252be711471df3c84b99514e7 (diff)
parent6f949b35602f7b2095b7248981dce7381a09852d (diff)
Merge branch 'joeyconfig'
Diffstat (limited to 'src')
-rw-r--r--src/Propellor.hs1
-rw-r--r--src/Propellor/Property/DiskImage.hs24
-rw-r--r--src/Propellor/Property/User.hs23
-rw-r--r--src/Propellor/Types.hs1
4 files changed, 38 insertions, 11 deletions
diff --git a/src/Propellor.hs b/src/Propellor.hs
index 9d45c376..53b209ca 100644
--- a/src/Propellor.hs
+++ b/src/Propellor.hs
@@ -31,7 +31,6 @@ module Propellor (
Host(..)
, Property
, RevertableProperty
- , (<!>)
, module Propellor.Types
-- * Config file
, defaultMain
diff --git a/src/Propellor/Property/DiskImage.hs b/src/Propellor/Property/DiskImage.hs
index 4878c365..2e0ec661 100644
--- a/src/Propellor/Property/DiskImage.hs
+++ b/src/Propellor/Property/DiskImage.hs
@@ -52,17 +52,21 @@ type DiskImage = FilePath
-- > import Propellor.Property.DiskImage
--
-- > let chroot d = Chroot.debootstrapped (System (Debian Unstable) "amd64") mempty d
--- > & Apt.installed ["linux-image-amd64"]
--- > & ...
+-- > & Apt.installed ["linux-image-amd64"]
+-- > & User.hasPassword (User "root")
+-- > & User.accountFor (User "demo")
+-- > & User.hasPassword (User "demo")
+-- > & User.hasDesktopGroups (User "demo")
+-- > & ...
-- > in imageBuilt "/srv/images/foo.img" chroot
--- > MSDOS (grubBooted PC)
--- > [ partition EXT2 `mountedAt` "/boot"
--- > `setFlag` BootFlag
--- > , partition EXT4 `mountedAt` "/"
--- > `addFreeSpace` MegaBytes 100
--- > `mountOpt` errorReadonly
--- > , swapPartition (MegaBytes 256)
--- > ]
+-- > MSDOS (grubBooted PC)
+-- > [ partition EXT2 `mountedAt` "/boot"
+-- > `setFlag` BootFlag
+-- > , partition EXT4 `mountedAt` "/"
+-- > `addFreeSpace` MegaBytes 100
+-- > `mountOpt` errorReadonly
+-- > , swapPartition (MegaBytes 256)
+-- > ]
--
-- Note that the disk image file is reused if it already exists,
-- to avoid expensive IO to generate a new one. And, it's updated in-place,
diff --git a/src/Propellor/Property/User.hs b/src/Propellor/Property/User.hs
index 78e606ac..f3842892 100644
--- a/src/Propellor/Property/User.hs
+++ b/src/Propellor/Property/User.hs
@@ -107,6 +107,29 @@ hasGroup (User user) (Group group') = check test $ cmdProperty "adduser"
where
test = not . elem group' . words <$> readProcess "groups" [user]
+-- | Gives a user access to the secondary groups, including audio and
+-- video, that the OS installer normally gives a desktop user access to.
+hasDesktopGroups :: User -> Property NoInfo
+hasDesktopGroups user@(User u) = combineProperties desc $
+ map (hasGroup user . Group) desktopgroups
+ where
+ desc = "user " ++ u ++ " is in standard desktop groups"
+ -- This list comes from user-setup's debconf
+ -- template named "passwd/user-default-groups"
+ desktopgroups =
+ [ "audio"
+ , "cdrom"
+ , "dip"
+ , "floppy"
+ , "video"
+ , "plugdev"
+ , "netdev"
+ , "scanner"
+ , "bluetooth"
+ , "debian-tor"
+ , "lpadmin"
+ ]
+
-- | Controls whether shadow passwords are enabled or not.
shadowConfig :: Bool -> Property NoInfo
shadowConfig True = check (not <$> shadowExists) $
diff --git a/src/Propellor/Types.hs b/src/Propellor/Types.hs
index 3d2fbf14..58e86247 100644
--- a/src/Propellor/Types.hs
+++ b/src/Propellor/Types.hs
@@ -27,6 +27,7 @@ module Propellor.Types
, IsProp(..)
, Combines(..)
, CombinedType
+ , ResultCombiner
, Propellor(..)
, LiftPropellor(..)
, EndAction(..)