add support for fully automatic upgrades

The Upgrader avoids checking for upgrades on startup when it was just
upgraded. This avoids an upgrade loop if something goes wrong. One example
of something going wrong would be if the upgrade info file and the
distribution file get out of sync (or the distribution file is cached in
a proxy), so it thinks it has upgraded to a new version, but has really
not.
This commit is contained in:
Joey Hess 2013-11-24 13:20:58 -04:00
parent f04786f984
commit 6165284e39
4 changed files with 22 additions and 14 deletions

View file

@ -8,7 +8,7 @@
{-# LANGUAGE CPP #-}
module Assistant.Threads.UpgradeWatcher (
upgradWatcherThread
upgradeWatcherThread
) where
import Assistant.Common
@ -30,9 +30,9 @@ import qualified Data.Text as T
data WatcherState = InStartupScan | Started | Upgrading
deriving (Eq)
upgradWatcherThread :: UrlRenderer -> NamedThread
upgradWatcherThread urlrenderer = namedThread "UpgradeWatcher" $ do
whenM (liftIO $ checkSuccessfulUpgrade) $
upgradeWatcherThread :: UrlRenderer -> NamedThread
upgradeWatcherThread urlrenderer = namedThread "UpgradeWatcher" $ do
whenM (liftIO checkSuccessfulUpgrade) $
showSuccessfulUpgrade urlrenderer
go =<< liftIO upgradeFlagFile
where