summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-06-16 02:49:26 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-06-16 02:49:26 -0400
commit7d6329e5e4e4dd488b24e0002edcb2220073d8e9 (patch)
tree018d86db37b6c633773c2cd8b374cd1e1658085e
parent0052cec2b7e39652bd52cd4978ed47d2daa5af68 (diff)
check lsof at runtime
-rw-r--r--Assistant.hs24
-rw-r--r--debian/control1
-rw-r--r--doc/install.mdwn2
3 files changed, 10 insertions, 17 deletions
diff --git a/Assistant.hs b/Assistant.hs
index 4042c6ede..54556616d 100644
--- a/Assistant.hs
+++ b/Assistant.hs
@@ -52,7 +52,6 @@ import Assistant.SanityChecker
import qualified Annex
import qualified Utility.Daemon
import Utility.LogFile
-import qualified Build.SysConfig as SysConfig
import Control.Concurrent
@@ -66,11 +65,11 @@ startDaemon foreground
pidfile <- fromRepo gitAnnexPidFile
go $ Utility.Daemon.daemonize logfd (Just pidfile) False
where
- go a
- | SysConfig.lsof = start a
- | otherwise =
- ifM (Annex.getState Annex.force)
- (start a, needlsof)
+ go a = ifM (liftIO $ inPath "lsof")
+ ( go a
+ , ifM (Annex.getState Annex.force)
+ (start a, needlsof)
+ )
start a = withThreadState $ \st -> do
dstatus <- startDaemonStatus
liftIO $ a $ do
@@ -85,16 +84,11 @@ startDaemon foreground
_ <- forkIO $ sanityCheckerThread st dstatus changechan
watchThread st dstatus changechan
- -- this message is optimised away when lsof is available
needlsof = error $ unlines
- [ "The lsof command is needed for watch mode to be safe."
- , "But this build of git-annex was made without lsof available. Giving up..."
- , ""
- , "You can use --force if lsof is available now. Please make very sure it is."
- , "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!"
+ [ "The lsof command is needed for watch mode to be safe, and is not in PATH."
+ , "To override lsof checks to ensure that files are not open for writing"
+ , "when added to the annex, you can use --force"
+ , "Be warned: This can corrupt data in the annex, and make fsck complain."
]
stopDaemon :: Annex ()
diff --git a/debian/control b/debian/control
index c587c29ec..6741ef943 100644
--- a/debian/control
+++ b/debian/control
@@ -28,7 +28,6 @@ Build-Depends:
uuid,
rsync,
openssh-client,
- lsof,
Maintainer: Joey Hess <joeyh@debian.org>
Standards-Version: 3.9.3
Vcs-Git: git://git.kitenet.net/git-annex
diff --git a/doc/install.mdwn b/doc/install.mdwn
index 43b5bba20..54b52d416 100644
--- a/doc/install.mdwn
+++ b/doc/install.mdwn
@@ -55,7 +55,7 @@ To build and use git-annex, you will need:
a sha1 command will also do)
* [gpg](http://gnupg.org/) (optional; needed for encryption)
* [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)
Then just [[download]] git-annex and run: `make; make install`