diff options
| author | Joey Hess <joeyh@joeyh.name> | 2017-07-05 16:46:36 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2017-07-05 16:46:36 -0400 |
| commit | 36671f5c992905aa71722b16d800313f60a02622 (patch) | |
| tree | b53b03ce18732be50a8268b624bc688439dac5ec | |
| parent | f9f1158c0c0fc173045ec7bb7fcbacdd76b24ffd (diff) | |
add Overwrite configuration
| -rw-r--r-- | joeyconfig.hs | 2 | ||||
| -rw-r--r-- | src/Propellor/Property/XFCE.hs | 14 |
2 files changed, 9 insertions, 7 deletions
diff --git a/joeyconfig.hs b/joeyconfig.hs index f8b26a2b..20e73cef 100644 --- a/joeyconfig.hs +++ b/joeyconfig.hs @@ -118,7 +118,7 @@ demo = host "demo" $ props & root `User.hasInsecurePassword` "debian" & user `User.hasInsecurePassword` "debian" & XFCE.installedMin - & XFCE.defaultPanelFor user + & XFCE.defaultPanelFor user OverwriteExisting & LightDM.autoLogin user & Apt.installed ["firefox"] where diff --git a/src/Propellor/Property/XFCE.hs b/src/Propellor/Property/XFCE.hs index a1b9d7d7..e0c062ae 100644 --- a/src/Propellor/Property/XFCE.hs +++ b/src/Propellor/Property/XFCE.hs @@ -15,13 +15,12 @@ installedMin :: Property DebianLike installedMin = Apt.installedMin ["xfce4", "xfce4-terminal", "task-desktop"] `describe` "minimal XFCE desktop installed" +data Overwrite = OverwriteExisting | PreserveExisting + -- | Normally at first login, XFCE asks what kind of panel the user wants. -- This enables the default configuration noninteractively. --- --- If the user subsequently modifies their panel, their modifications will --- not be overwritten by this property. -defaultPanelFor :: User -> Property DebianLike -defaultPanelFor u@(User username) = property' desc $ \w -> do +defaultPanelFor :: User -> Overwrite -> Property DebianLike +defaultPanelFor u@(User username) overwrite = property' desc $ \w -> do home <- liftIO $ User.homedir u ensureProperty w (go home) where @@ -31,10 +30,13 @@ defaultPanelFor u@(User username) = property' desc $ \w -> do -- This location is probably Debian-specific. defcf = "/etc/xdg/xfce4/panel/default.xml" go :: FilePath -> Property DebianLike - go home = tightenTargets $ check (not <$> doesFileExist cf) $ + go home = tightenTargets $ checkoverwrite cf cf `File.isCopyOf` defcf `before` File.applyPath home basecf (\f -> File.ownerGroup f u (userGroup u)) `requires` Apt.installed ["xfce4-panel"] where cf = home </> basecf + checkoverwrite cf p = case overwrite of + OverwriteExisting -> p + PreserveExisting -> check (not <$> doesFileExist cf) p |
