summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Debootstrap.hs
diff options
context:
space:
mode:
authorJoey Hess2014-11-19 21:03:06 -0400
committerJoey Hess2014-11-19 21:03:06 -0400
commit4de7d4295c91b07b1338db2114b9557b5353a978 (patch)
tree5af5185ef29a801120e9fb1f4d9e446b3e3305ed /src/Propellor/Property/Debootstrap.hs
parent025c7c4b8e0b7aa3ba3ff8c077c5fbef3c8fa63d (diff)
propellor spin
Diffstat (limited to 'src/Propellor/Property/Debootstrap.hs')
-rw-r--r--src/Propellor/Property/Debootstrap.hs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/Propellor/Property/Debootstrap.hs b/src/Propellor/Property/Debootstrap.hs
index 70a0dd9c..23dabcf6 100644
--- a/src/Propellor/Property/Debootstrap.hs
+++ b/src/Propellor/Property/Debootstrap.hs
@@ -41,9 +41,9 @@ built target system@(System _ arch) extraparams =
setupprop = property ("debootstrapped " ++ target) $ liftIO $ do
createDirectoryIfMissing True target
- let suite = case extractSuite system of
- Nothing -> error $ "don't know how to debootstrap " ++ show system
- Just s -> s
+ suite <- case extractSuite system of
+ Nothing -> errorMessage $ "don't know how to debootstrap " ++ show system
+ Just s -> pure s
let params = extraparams ++
[ Param suite
, Param target
@@ -63,7 +63,7 @@ built target system@(System _ arch) extraparams =
<$> mountPoints
forM_ submnts $ \mnt ->
unlessM (boolSystem "umount" [ Param "-l", Param mnt ]) $ do
- error $ "failed unmounting " ++ mnt
+ errorMessage $ "failed unmounting " ++ mnt
removeDirectoryRecursive target
return MadeChange
@@ -108,7 +108,7 @@ sourceInstall' :: IO Result
sourceInstall' = withTmpDir "debootstrap" $ \tmpd -> do
let indexfile = tmpd </> "index.html"
unlessM (download baseurl indexfile) $
- error $ "Failed to download " ++ baseurl
+ errorMessage $ "Failed to download " ++ baseurl
urls <- reverse . sort -- highest version first
. filter ("debootstrap_" `isInfixOf`)
. filter (".tar." `isInfixOf`)
@@ -120,15 +120,15 @@ sourceInstall' = withTmpDir "debootstrap" $ \tmpd -> do
(tarurl:_) -> do
let f = tmpd </> takeFileName tarurl
unlessM (download tarurl f) $
- error $ "Failed to download " ++ tarurl
+ errorMessage $ "Failed to download " ++ tarurl
return f
- _ -> error $ "Failed to find any debootstrap tarballs listed on " ++ baseurl
+ _ -> errorMessage $ "Failed to find any debootstrap tarballs listed on " ++ baseurl
createDirectoryIfMissing True localInstallDir
bracket getWorkingDirectory changeWorkingDirectory $ \_ -> do
changeWorkingDirectory localInstallDir
unlessM (boolSystem "tar" [Param "xf", File tarfile]) $
- error "Failed to extract debootstrap tar file"
+ errorMessage "Failed to extract debootstrap tar file"
nukeFile tarfile
l <- dirContents "."
case l of
@@ -137,7 +137,7 @@ sourceInstall' = withTmpDir "debootstrap" $ \tmpd -> do
makeDevicesTarball
makeWrapperScript (localInstallDir </> subdir)
return MadeChange
- _ -> error "debootstrap tar file did not contain exactly one dirctory"
+ _ -> errorMessage "debootstrap tar file did not contain exactly one dirctory"
sourceRemove :: Property
sourceRemove = property "debootstrap not installed from source" $ liftIO $
@@ -183,7 +183,7 @@ makeDevicesTarball = do
ok <- boolSystem "sh" [Param "-c", Param tarcmd]
nukeFile foreignDevFlag
unless ok $
- error "Failed to tar up /dev to generate devices.tar.gz"
+ errorMessage "Failed to tar up /dev to generate devices.tar.gz"
where
tarcmd = "(cd / && tar cf - dev) | gzip > devices.tar.gz"