summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog2
-rw-r--r--src/Propellor/Property/Apt.hs24
-rw-r--r--src/System/Console/Concurrent/Internal.hs13
3 files changed, 17 insertions, 22 deletions
diff --git a/debian/changelog b/debian/changelog
index ba3f31c2..5a73f002 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ propellor (3.0.2) UNRELEASED; urgency=medium
* Added Apt.periodicUpdates.
Thanks, Félix Sipma.
+ * Apt.unattendedUpgrades: Enable mailing problems reports to root.
+ Thanks, Félix Sipma.
-- Joey Hess <id@joeyh.name> Tue, 05 Apr 2016 13:48:47 -0400
diff --git a/src/Propellor/Property/Apt.hs b/src/Propellor/Property/Apt.hs
index 58a83c43..5e185a0e 100644
--- a/src/Propellor/Property/Apt.hs
+++ b/src/Propellor/Property/Apt.hs
@@ -249,15 +249,21 @@ unattendedUpgrades = enable <!> disable
| otherwise = "false"
configure :: Property DebianLike
- configure = withOS "unattended upgrades configured" $ \w o ->
- case o of
- -- the package defaults to only upgrading stable
- (Just (System (Debian suite) _))
- | not (isStable suite) -> ensureProperty w $
- "/etc/apt/apt.conf.d/50unattended-upgrades"
- `File.containsLine`
- ("Unattended-Upgrade::Origins-Pattern { \"o=Debian,a="++showSuite suite++"\"; };")
- _ -> noChange
+ configure = propertyList "unattended upgrades configured" $ props
+ & enableupgrading
+ & unattendedconfig `File.containsLine` "Unattended-Upgrade::Mail \"root\";"
+ where
+ enableupgrading :: Property DebianLike
+ enableupgrading = withOS "unattended upgrades configured" $ \w o ->
+ case o of
+ -- the package defaults to only upgrading stable
+ (Just (System (Debian suite) _))
+ | not (isStable suite) -> ensureProperty w $
+ unattendedconfig
+ `File.containsLine`
+ ("Unattended-Upgrade::Origins-Pattern { \"o=Debian,a="++showSuite suite++"\"; };")
+ _ -> noChange
+ unattendedconfig = "/etc/apt/apt.conf.d/50unattended-upgrades"
-- | Enable periodic updates (but not upgrades), including download
-- of packages.
diff --git a/src/System/Console/Concurrent/Internal.hs b/src/System/Console/Concurrent/Internal.hs
index 6426f37d..ffe6a9e8 100644
--- a/src/System/Console/Concurrent/Internal.hs
+++ b/src/System/Console/Concurrent/Internal.hs
@@ -34,7 +34,6 @@ import qualified Data.Text as T
import qualified Data.Text.IO as T
import Control.Applicative
import Prelude
-import System.Log.Logger
import Utility.Monad
import Utility.Exception
@@ -290,30 +289,18 @@ fgProcess p = do
r@(_, _, _, h) <- P.createProcess p
`onException` dropOutputLock
registerOutputThread
- debug ["fgProcess", showProc p]
-- Wait for the process to exit and drop the lock.
asyncProcessWaiter $ do
void $ tryIO $ P.waitForProcess h
unregisterOutputThread
dropOutputLock
- debug ["fgProcess done", showProc p]
return (toConcurrentProcessHandle r)
-
-debug :: [String] -> IO ()
-debug = debugM "concurrent-output" . unwords
-
-showProc :: P.CreateProcess -> String
-showProc = go . P.cmdspec
- where
- go (P.ShellCommand s) = s
- go (P.RawCommand c ps) = show (c, ps)
#ifndef mingw32_HOST_OS
bgProcess :: P.CreateProcess -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ConcurrentProcessHandle)
bgProcess p = do
(toouth, fromouth) <- pipe
(toerrh, fromerrh) <- pipe
- debug ["bgProcess", showProc p]
let p' = p
{ P.std_out = rediroutput (P.std_out p) toouth
, P.std_err = rediroutput (P.std_err p) toerrh