2014-04-06 23:06:03 +00:00
|
|
|
{- git-annex command
|
|
|
|
-
|
2016-11-20 18:39:26 +00:00
|
|
|
- Copyright 2014-2016 Joey Hess <id@joeyh.name>
|
2014-04-06 23:06:03 +00:00
|
|
|
-
|
2019-03-13 19:48:14 +00:00
|
|
|
- Licensed under the GNU AGPL version 3 or higher.
|
2014-04-06 23:06:03 +00:00
|
|
|
-}
|
|
|
|
|
2016-11-20 18:39:26 +00:00
|
|
|
{-# LANGUAGE CPP #-}
|
|
|
|
|
2014-04-06 23:06:03 +00:00
|
|
|
module Command.RemoteDaemon where
|
|
|
|
|
|
|
|
import Command
|
|
|
|
import RemoteDaemon.Core
|
2016-11-20 18:39:26 +00:00
|
|
|
import Utility.Daemon
|
2023-03-21 22:22:41 +00:00
|
|
|
#ifndef mingw32_HOST_OS
|
2021-05-12 19:08:03 +00:00
|
|
|
import Annex.Path
|
2023-03-21 22:22:41 +00:00
|
|
|
#endif
|
2014-04-06 23:06:03 +00:00
|
|
|
|
2015-07-08 16:33:27 +00:00
|
|
|
cmd :: Command
|
2016-11-20 19:45:01 +00:00
|
|
|
cmd = noCommit $
|
2019-09-30 18:40:46 +00:00
|
|
|
command "remotedaemon" SectionCommon
|
2016-11-20 18:39:26 +00:00
|
|
|
"persistent communication with remotes"
|
2019-09-30 18:40:46 +00:00
|
|
|
paramNothing (run <$$> const (parseDaemonOptions False))
|
2014-04-06 23:06:03 +00:00
|
|
|
|
2016-11-20 18:39:26 +00:00
|
|
|
run :: DaemonOptions -> CommandSeek
|
|
|
|
run o
|
2023-04-10 17:38:14 +00:00
|
|
|
| stopDaemonOption o = giveup "--stop not implemented for remotedaemon"
|
2016-11-20 18:39:26 +00:00
|
|
|
| foregroundDaemonOption o = liftIO runInteractive
|
|
|
|
| otherwise = do
|
|
|
|
#ifndef mingw32_HOST_OS
|
2021-05-12 19:08:03 +00:00
|
|
|
git_annex <- liftIO programPath
|
|
|
|
ps <- gitAnnexDaemonizeParams
|
|
|
|
let logfd = openFd "/dev/null" ReadOnly Nothing defaultFileFlags
|
|
|
|
liftIO $ daemonize git_annex ps logfd Nothing False runNonInteractive
|
2016-11-20 18:39:26 +00:00
|
|
|
#else
|
|
|
|
liftIO $ foreground Nothing runNonInteractive
|
|
|
|
#endif
|