linux upgrade code debugged and working
This commit is contained in:
parent
fdc10b9436
commit
fead2941cd
3 changed files with 29 additions and 12 deletions
|
@ -91,9 +91,9 @@ onDel file = case parseTransferFile file of
|
|||
minfo <- removeTransfer t
|
||||
|
||||
-- Run transfer hook.
|
||||
void $ maybe noop (\hook -> void $ forkIO $ hook t)
|
||||
. M.lookup (transferKey t)
|
||||
. transferHook <$> getDaemonStatus
|
||||
m <- transferHook <$> getDaemonStatus
|
||||
maybe noop (\hook -> void $ liftIO $ forkIO $ hook t)
|
||||
(M.lookup (transferKey t) m)
|
||||
|
||||
finished <- asIO2 finishedTransfer
|
||||
void $ liftIO $ forkIO $ do
|
||||
|
|
|
@ -93,10 +93,13 @@ startDistributionDownload d = do
|
|||
-}
|
||||
distributionDownloadComplete :: GitAnnexDistribution -> Assistant () -> Transfer -> Assistant ()
|
||||
distributionDownloadComplete d cleanup t
|
||||
| transferDirection t == Download =
|
||||
| transferDirection t == Download = do
|
||||
debug ["finished downloading git-annex distribution"]
|
||||
maybe cleanup (upgradeToDistribution d cleanup)
|
||||
=<< liftAnnex (withObjectLoc k fsckit (getM fsckit))
|
||||
| otherwise = cleanup
|
||||
| otherwise = do
|
||||
debug ["finished downloading git-annex distribution 2"]
|
||||
cleanup
|
||||
where
|
||||
k = distributionKey d
|
||||
fsckit f = case Backend.maybeLookupBackendName (Types.Key.keyBackendName k) of
|
||||
|
@ -122,15 +125,24 @@ upgradeToDistribution d cleanup f = do
|
|||
#else
|
||||
{- Linux uses a tarball, so untar it (into a temp directory)
|
||||
- and move the directory into place. -}
|
||||
olddir <- parentDir <$> liftIO programFile
|
||||
olddir <- parentDir <$> liftIO readProgramFile
|
||||
let topdir = parentDir olddir
|
||||
let newdir = topdir </> "git-annex.linux." ++ distributionVersion d
|
||||
liftIO $ void $ tryIO $ removeDirectoryRecursive newdir
|
||||
liftIO $ withTmpDirIn topdir "git-annex.upgrade" $ \tmpdir -> do
|
||||
let tarball = tmpdir </> "tar"
|
||||
-- Cannot rely on filename extension, and this also
|
||||
-- avoids problems if tar doesn't support transparent
|
||||
-- decompression.
|
||||
void $ boolSystem "sh"
|
||||
[ Param "-c"
|
||||
, Param $ "zcat < " ++ shellEscape f ++
|
||||
" > " ++ shellEscape tarball
|
||||
]
|
||||
tarok <- boolSystem "tar"
|
||||
[ Param "--directory", File tmpdir
|
||||
, Param "xf"
|
||||
, Param f
|
||||
[ Param "xf"
|
||||
, Param tarball
|
||||
, Param "--directory", File tmpdir
|
||||
]
|
||||
unless tarok $
|
||||
error $ "failed to untar " ++ f
|
||||
|
@ -158,9 +170,6 @@ upgradeToDistribution d cleanup f = do
|
|||
pf <- programFile
|
||||
liftIO $ writeFile pf program
|
||||
|
||||
usingDistribution :: IO Bool
|
||||
usingDistribution = isJust <$> getEnv "GIT_ANNEX_STANDLONE_ENV"
|
||||
|
||||
{- This is a file that the UpgradeWatcher can watch for modifications to
|
||||
- detect when git-annex has been upgraded.
|
||||
-}
|
||||
|
@ -192,3 +201,6 @@ upgradeSanityCheck = ifM usingDistribution
|
|||
. filter (`elem` [Lsof.OpenReadWrite, Lsof.OpenWriteOnly])
|
||||
. map snd3
|
||||
<$> Lsof.query [f]
|
||||
|
||||
usingDistribution :: IO Bool
|
||||
usingDistribution = isJust <$> getEnv "GIT_ANNEX_STANDLONE_ENV"
|
||||
|
|
|
@ -45,6 +45,11 @@ bundledPrograms = catMaybes
|
|||
, SysConfig.sha512
|
||||
, SysConfig.sha224
|
||||
, SysConfig.sha384
|
||||
#ifdef linux_HOST_OS
|
||||
-- used to unpack the tarball when upgrading
|
||||
, Just "gunzip"
|
||||
, Just "tar"
|
||||
#endif
|
||||
-- nice and ionice are not included in the bundle; we rely on the
|
||||
-- system's own version, which may better match its kernel
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue