summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-03 17:07:27 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-03 17:07:27 -0400
commit3aa991bc7961433c0b888a2ab184b22942e5de79 (patch)
tree87d9649c8519d3d49b8128c9b343b14119db45f2 /Command
parent19a17dddb2baad5fbfa3203449ac416b30b8fa1b (diff)
webapp: New preferences page allows enabling/disabling debug logging at runtime, as well as configuring numcopies and diskreserve.
Diffstat (limited to 'Command')
-rw-r--r--Command/Assistant.hs26
-rw-r--r--Command/WebApp.hs17
2 files changed, 16 insertions, 27 deletions
diff --git a/Command/Assistant.hs b/Command/Assistant.hs
index ea8a87a3d..69a127b50 100644
--- a/Command/Assistant.hs
+++ b/Command/Assistant.hs
@@ -50,21 +50,17 @@ checkAutoStart = ifM (elem "--autostart" <$> getArgs)
autoStart :: IO ()
autoStart = do
- autostartfile <- autoStartFile
- let nothing = error $ "Nothing listed in " ++ autostartfile
- ifM (doesFileExist autostartfile)
- ( do
- dirs <- nub . lines <$> readFile autostartfile
- program <- readProgramFile
- when (null dirs) nothing
- forM_ dirs $ \d -> do
- putStrLn $ "git-annex autostart in " ++ d
- ifM (catchBoolIO $ go program d)
- ( putStrLn "ok"
- , putStrLn "failed"
- )
- , nothing
- )
+ dirs <- liftIO readAutoStartFile
+ when (null dirs) $ do
+ f <- autoStartFile
+ error $ "Nothing listed in " ++ f
+ program <- readProgramFile
+ forM_ dirs $ \d -> do
+ putStrLn $ "git-annex autostart in " ++ d
+ ifM (catchBoolIO $ go program d)
+ ( putStrLn "ok"
+ , putStrLn "failed"
+ )
where
go program dir = do
changeWorkingDirectory dir
diff --git a/Command/WebApp.hs b/Command/WebApp.hs
index 274a00c93..5e461ed21 100644
--- a/Command/WebApp.hs
+++ b/Command/WebApp.hs
@@ -64,20 +64,13 @@ start' allowauto = do
liftIO $ isJust <$> checkDaemon pidfile
checkshim f = liftIO $ doesFileExist f
-{- When run without a repo, see if there is an autoStartFile,
- - and if so, start the first available listed repository.
- - If not, it's our first time being run! -}
+{- When run without a repo, start the first available listed repository in
+ - the autostart file. If not, it's our first time being run! -}
startNoRepo :: IO ()
startNoRepo = do
- autostartfile <- autoStartFile
- ifM (doesFileExist autostartfile) ( autoStart autostartfile , firstRun )
-
-autoStart :: FilePath -> IO ()
-autoStart autostartfile = do
- dirs <- nub . lines <$> readFile autostartfile
- edirs <- filterM doesDirectoryExist dirs
- case edirs of
- [] -> firstRun -- what else can I do? Nothing works..
+ dirs <- liftIO $ filterM doesDirectoryExist =<< readAutoStartFile
+ case dirs of
+ [] -> firstRun
(d:_) -> do
changeWorkingDirectory d
state <- Annex.new =<< Git.CurrentRepo.get