check lsof at runtime
This commit is contained in:
parent
0052cec2b7
commit
7d6329e5e4
3 changed files with 10 additions and 17 deletions
24
Assistant.hs
24
Assistant.hs
|
@ -52,7 +52,6 @@ import Assistant.SanityChecker
|
||||||
import qualified Annex
|
import qualified Annex
|
||||||
import qualified Utility.Daemon
|
import qualified Utility.Daemon
|
||||||
import Utility.LogFile
|
import Utility.LogFile
|
||||||
import qualified Build.SysConfig as SysConfig
|
|
||||||
|
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
|
|
||||||
|
@ -66,11 +65,11 @@ startDaemon foreground
|
||||||
pidfile <- fromRepo gitAnnexPidFile
|
pidfile <- fromRepo gitAnnexPidFile
|
||||||
go $ Utility.Daemon.daemonize logfd (Just pidfile) False
|
go $ Utility.Daemon.daemonize logfd (Just pidfile) False
|
||||||
where
|
where
|
||||||
go a
|
go a = ifM (liftIO $ inPath "lsof")
|
||||||
| SysConfig.lsof = start a
|
( go a
|
||||||
| otherwise =
|
, ifM (Annex.getState Annex.force)
|
||||||
ifM (Annex.getState Annex.force)
|
(start a, needlsof)
|
||||||
(start a, needlsof)
|
)
|
||||||
start a = withThreadState $ \st -> do
|
start a = withThreadState $ \st -> do
|
||||||
dstatus <- startDaemonStatus
|
dstatus <- startDaemonStatus
|
||||||
liftIO $ a $ do
|
liftIO $ a $ do
|
||||||
|
@ -85,16 +84,11 @@ startDaemon foreground
|
||||||
_ <- forkIO $ sanityCheckerThread st dstatus changechan
|
_ <- forkIO $ sanityCheckerThread st dstatus changechan
|
||||||
watchThread st dstatus changechan
|
watchThread st dstatus changechan
|
||||||
|
|
||||||
-- this message is optimised away when lsof is available
|
|
||||||
needlsof = error $ unlines
|
needlsof = error $ unlines
|
||||||
[ "The lsof command is needed for watch mode to be safe."
|
[ "The lsof command is needed for watch mode to be safe, and is not in PATH."
|
||||||
, "But this build of git-annex was made without lsof available. Giving up..."
|
, "To override lsof checks to ensure that files are not open for writing"
|
||||||
, ""
|
, "when added to the annex, you can use --force"
|
||||||
, "You can use --force if lsof is available now. Please make very sure it is."
|
, "Be warned: This can corrupt data in the annex, and make fsck complain."
|
||||||
, "If run with --force and without lsof available, files can be added to the"
|
|
||||||
, "annex while a process still has them opened for writing. This can"
|
|
||||||
, "corrupt data in the annex, and make fsck complain."
|
|
||||||
, "Use the --force with caution, Luke!"
|
|
||||||
]
|
]
|
||||||
|
|
||||||
stopDaemon :: Annex ()
|
stopDaemon :: Annex ()
|
||||||
|
|
1
debian/control
vendored
1
debian/control
vendored
|
@ -28,7 +28,6 @@ Build-Depends:
|
||||||
uuid,
|
uuid,
|
||||||
rsync,
|
rsync,
|
||||||
openssh-client,
|
openssh-client,
|
||||||
lsof,
|
|
||||||
Maintainer: Joey Hess <joeyh@debian.org>
|
Maintainer: Joey Hess <joeyh@debian.org>
|
||||||
Standards-Version: 3.9.3
|
Standards-Version: 3.9.3
|
||||||
Vcs-Git: git://git.kitenet.net/git-annex
|
Vcs-Git: git://git.kitenet.net/git-annex
|
||||||
|
|
|
@ -55,7 +55,7 @@ To build and use git-annex, you will need:
|
||||||
a sha1 command will also do)
|
a sha1 command will also do)
|
||||||
* [gpg](http://gnupg.org/) (optional; needed for encryption)
|
* [gpg](http://gnupg.org/) (optional; needed for encryption)
|
||||||
* [lsof](ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/)
|
* [lsof](ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/)
|
||||||
(needed for watch mode)
|
(optional; recommended for watch mode)
|
||||||
* [ikiwiki](http://ikiwiki.info) (optional; used to build the docs)
|
* [ikiwiki](http://ikiwiki.info) (optional; used to build the docs)
|
||||||
|
|
||||||
Then just [[download]] git-annex and run: `make; make install`
|
Then just [[download]] git-annex and run: `make; make install`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue