From 845fb2d60585be5567ac10aa0a53ab45c628648c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 15 Sep 2016 22:49:38 -0400 Subject: Added --backup-server and --restore-server To aid in backing up keysafe servers with minimal information leakage. This commit was sponsored by Andrea Rota. --- Storage/Local.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Storage') diff --git a/Storage/Local.hs b/Storage/Local.hs index 6a952fa..90da7b8 100644 --- a/Storage/Local.hs +++ b/Storage/Local.hs @@ -6,6 +6,7 @@ module Storage.Local ( localStorage , storageDir + , storageTopDir , testStorageDir , localDiskUsage ) where @@ -147,13 +148,14 @@ storageDir Nothing (Section section) = do storageDir (Just (LocalStorageDirectory d)) (Section section) = pure $ d section +storageTopDir :: Maybe LocalStorageDirectory -> IO FilePath +storageTopDir lsd = storageDir lsd (Section ".") + testStorageDir :: FilePath -> GetShareDir testStorageDir tmpdir = storageDir (Just (LocalStorageDirectory tmpdir)) localDiskUsage :: Maybe LocalStorageDirectory -> IO DiskUsage -localDiskUsage lsd = do - dir <- storageDir lsd (Section ".") - getDiskUsage dir +localDiskUsage lsd = getDiskUsage =<< storageTopDir lsd -- | The takeFileName ensures that, if the StorableObjectIdent somehow -- contains a path (eg starts with "../" or "/"), it is not allowed -- cgit v1.2.3