diff options
author | Joey Hess <joey@kitenet.net> | 2012-07-31 16:19:24 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-07-31 16:19:24 -0400 |
commit | bcf5c81593f26a253b514224e3326defd6fa0a8d (patch) | |
tree | 70d65ead2eb53216200acd02b0f199da3c38cc61 /Command | |
parent | c70496dc7f89f07e05bea0257b7d93986dd61d89 (diff) |
when run in uninitialized git repo, do firstrun
My $HOME is in git, let's make it work :)
Diffstat (limited to 'Command')
-rw-r--r-- | Command/WebApp.hs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Command/WebApp.hs b/Command/WebApp.hs index a3294911f..e2442c37e 100644 --- a/Command/WebApp.hs +++ b/Command/WebApp.hs @@ -16,12 +16,13 @@ import Assistant.Threads.WebApp import Utility.WebApp import Utility.ThreadScheduler import Utility.Daemon (checkDaemon) +import Init import qualified Command.Watch import Control.Concurrent.STM def :: [Command] -def = [oneShot $ noRepo firstRun $ +def = [oneShot $ noRepo firstRun $ dontCheck repoExists $ withOptions [Command.Watch.foregroundOption, Command.Watch.stopOption] $ command "webapp" paramNothing seek "launch webapp"] @@ -34,14 +35,15 @@ start :: Bool -> Bool -> CommandStart start foreground stopdaemon = notBareRepo $ do if stopdaemon then stopDaemon - else do + else ifM (isInitialized) ( go , liftIO firstRun ) + stop + where + go = do f <- liftIO . absPath =<< fromRepo gitAnnexHtmlShim ifM (checkpid <&&> checkshim f) $ ( liftIO $ openBrowser f , startDaemon True foreground $ Just openBrowser ) - stop - where checkpid = do pidfile <- fromRepo gitAnnexPidFile liftIO $ isJust <$> checkDaemon pidfile |