mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-04 14:29:45 +00:00
catches if either file doesn't exist and runs the sync if so (#245)
This commit is contained in:
@@ -602,9 +602,17 @@ syncDropCertificateUniqueness = SyncOp "Eliminate OpenSSL unique_subject=yes" ch
|
|||||||
uni = "unique_subject = no\n"
|
uni = "unique_subject = no\n"
|
||||||
check = do
|
check = do
|
||||||
base <- asks $ appFilesystemBase . appSettings
|
base <- asks $ appFilesystemBase . appSettings
|
||||||
contentsRoot <- liftIO . BS.readFile . toS $ (rootCaDirectory <> "index.txt.attr") `relativeTo` base
|
contentsRoot <-
|
||||||
contentsInt <- liftIO . BS.readFile . toS $ (intermediateCaDirectory <> "index.txt.attr") `relativeTo` base
|
liftIO
|
||||||
pure $ uni /= contentsRoot || uni /= contentsInt
|
$ (fmap Just . BS.readFile . toS $ (rootCaDirectory <> "index.txt.attr") `relativeTo` base)
|
||||||
|
`catch` \(e :: IOException) -> if isDoesNotExistError e then pure Nothing else throwIO e
|
||||||
|
contentsInt <-
|
||||||
|
liftIO
|
||||||
|
$ (fmap Just . BS.readFile . toS $ (intermediateCaDirectory <> "index.txt.attr") `relativeTo` base)
|
||||||
|
`catch` \(e :: IOException) -> if isDoesNotExistError e then pure Nothing else throwIO e
|
||||||
|
case (contentsRoot, contentsInt) of
|
||||||
|
(Just root, Just int) -> pure $ uni /= root || uni /= int
|
||||||
|
_ -> pure True
|
||||||
migrate = do
|
migrate = do
|
||||||
base <- asks $ appFilesystemBase . appSettings
|
base <- asks $ appFilesystemBase . appSettings
|
||||||
liftIO $ BS.writeFile (toS $ (rootCaDirectory <> "index.txt.attr") `relativeTo` base) uni
|
liftIO $ BS.writeFile (toS $ (rootCaDirectory <> "index.txt.attr") `relativeTo` base) uni
|
||||||
|
|||||||
Reference in New Issue
Block a user