diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-02-28 17:23:13 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-02-28 17:23:13 -0400 |
commit | 849a4b1a0d71071a602f552125fd7e25689662db (patch) | |
tree | 0b78308f8616c4920d1d109c5afe00bf52492595 /Assistant | |
parent | a35208c5df555006431a66436288ce156af4fdb9 (diff) |
When re-execing git-annex, use current program location, rather than ~/.config/git-annex/program, when possible.
Most of the time, there will be no discreprancy between programPath and
readProgramFile.
But, the programFile might have been written by an old version of git-annex
that is still installed, while a newer one is currently running. In this
case, we want to run the same one that's currently running.
This is especially important for things like the GIT_SSH=git-annex used for
ssh connection caching.
The only code that still uses readProgramFile directly is the upgrade code,
which needs to know where the standalone git-annex was installed, in order to
upgrade it.
Diffstat (limited to 'Assistant')
-rw-r--r-- | Assistant/Threads/Cronner.hs | 6 | ||||
-rw-r--r-- | Assistant/Threads/RemoteControl.hs | 4 | ||||
-rw-r--r-- | Assistant/Threads/SanityChecker.hs | 4 | ||||
-rw-r--r-- | Assistant/Threads/Transferrer.hs | 4 | ||||
-rw-r--r-- | Assistant/TransferSlots.hs | 4 | ||||
-rw-r--r-- | Assistant/XMPP/Git.hs | 4 |
6 files changed, 13 insertions, 13 deletions
diff --git a/Assistant/Threads/Cronner.hs b/Assistant/Threads/Cronner.hs index 451fa75c6..14026cfcc 100644 --- a/Assistant/Threads/Cronner.hs +++ b/Assistant/Threads/Cronner.hs @@ -15,7 +15,7 @@ import Assistant.Common import Assistant.DaemonStatus import Utility.NotificationBroadcaster import Annex.UUID -import Config.Files +import Annex.Path import Logs.Schedule import Utility.Scheduled import Types.ScheduledActivity @@ -181,7 +181,7 @@ runActivity urlrenderer activity nowt = do runActivity' :: UrlRenderer -> ScheduledActivity -> Assistant () runActivity' urlrenderer (ScheduledSelfFsck _ d) = do - program <- liftIO $ readProgramFile + program <- liftIO programPath g <- liftAnnex gitRepo fsckresults <- showFscking urlrenderer Nothing $ tryNonAsync $ do void $ batchCommand program (Param "fsck" : annexFsckParams d) @@ -196,7 +196,7 @@ runActivity' urlrenderer (ScheduledRemoteFsck u s d) = dispatch =<< liftAnnex (r dispatch Nothing = debug ["skipping remote fsck of uuid without a configured remote", fromUUID u, fromSchedule s] dispatch (Just rmt) = void $ case Remote.remoteFsck rmt of Nothing -> go rmt $ do - program <- readProgramFile + program <- programPath void $ batchCommand program $ [ Param "fsck" -- avoid downloading files diff --git a/Assistant/Threads/RemoteControl.hs b/Assistant/Threads/RemoteControl.hs index ae63aff5c..447b493c6 100644 --- a/Assistant/Threads/RemoteControl.hs +++ b/Assistant/Threads/RemoteControl.hs @@ -9,7 +9,7 @@ module Assistant.Threads.RemoteControl where import Assistant.Common import RemoteDaemon.Types -import Config.Files +import Annex.Path import Utility.Batch import Utility.SimpleProtocol import Assistant.Alert @@ -28,7 +28,7 @@ import qualified Data.Set as S remoteControlThread :: NamedThread remoteControlThread = namedThread "RemoteControl" $ do - program <- liftIO readProgramFile + program <- liftIO programPath (cmd, params) <- liftIO $ toBatchCommand (program, [Param "remotedaemon"]) let p = proc cmd (toCommand params) diff --git a/Assistant/Threads/SanityChecker.hs b/Assistant/Threads/SanityChecker.hs index 3073cfe41..0f2c1245a 100644 --- a/Assistant/Threads/SanityChecker.hs +++ b/Assistant/Threads/SanityChecker.hs @@ -39,7 +39,7 @@ import Git.Index import Assistant.Unused import Logs.Unused import Logs.Transfer -import Config.Files +import Annex.Path import Types.Key (keyBackendName) import qualified Annex #ifdef WITH_WEBAPP @@ -182,7 +182,7 @@ dailyCheck urlrenderer = do {- Run git-annex unused once per day. This is run as a separate - process to stay out of the annex monad and so it can run as a - batch job. -} - program <- liftIO readProgramFile + program <- liftIO programPath let (program', params') = batchmaker (program, [Param "unused"]) void $ liftIO $ boolSystem program' params' {- Invalidate unused keys cache, and queue transfers of all unused diff --git a/Assistant/Threads/Transferrer.hs b/Assistant/Threads/Transferrer.hs index 073dbef3c..9e9256e3a 100644 --- a/Assistant/Threads/Transferrer.hs +++ b/Assistant/Threads/Transferrer.hs @@ -11,13 +11,13 @@ import Assistant.Common import Assistant.TransferQueue import Assistant.TransferSlots import Logs.Transfer -import Config.Files +import Annex.Path import Utility.Batch {- Dispatches transfers from the queue. -} transfererThread :: NamedThread transfererThread = namedThread "Transferrer" $ do - program <- liftIO readProgramFile + program <- liftIO programPath batchmaker <- liftIO getBatchCommandMaker forever $ inTransferSlot program batchmaker $ maybe (return Nothing) (uncurry genTransfer) diff --git a/Assistant/TransferSlots.hs b/Assistant/TransferSlots.hs index bbc2ec7e5..7490ede39 100644 --- a/Assistant/TransferSlots.hs +++ b/Assistant/TransferSlots.hs @@ -28,7 +28,7 @@ import qualified Remote import qualified Types.Remote as Remote import Annex.Content import Annex.Wanted -import Config.Files +import Annex.Path import Utility.Batch import qualified Data.Map as M @@ -284,7 +284,7 @@ startTransfer t = do alterTransferInfo t $ \i -> i { transferPaused = False } liftIO $ throwTo tid ResumeTransfer start info = do - program <- liftIO readProgramFile + program <- liftIO programPath batchmaker <- liftIO getBatchCommandMaker inImmediateTransferSlot program batchmaker $ genTransfer t info diff --git a/Assistant/XMPP/Git.hs b/Assistant/XMPP/Git.hs index 2186b5bce..2841a1cf8 100644 --- a/Assistant/XMPP/Git.hs +++ b/Assistant/XMPP/Git.hs @@ -20,6 +20,7 @@ import Assistant.MakeRemote import Assistant.Sync import qualified Command.Sync import qualified Annex.Branch +import Annex.Path import Annex.UUID import Logs.UUID import Annex.TaggedPush @@ -27,7 +28,6 @@ import Annex.CatFile import Config import Git import qualified Git.Branch -import Config.Files import qualified Types.Remote as Remote import qualified Remote as Remote import Remote.List @@ -173,7 +173,7 @@ xmppPush cid gitpush = do installwrapper tmpdir = liftIO $ do createDirectoryIfMissing True tmpdir let wrapper = tmpdir </> "git-remote-xmpp" - program <- readProgramFile + program <- programPath writeFile wrapper $ unlines [ shebang_local , "exec " ++ program ++ " xmppgit" |