-- | Remove a package with the package manager found.
removePackage :: (MonadCric m, Package p) => p -> m (Either PkgManagerError BS.ByteString)
removePackage pkg = do
  logMsg Info $ "Removing " ++ show pkg ++ " ..."
  pkgMgr <- getPackageManager
  os <- getOS
  result <- case pkgMgr of
    Yum    -> removeWithYum    os pkg
    APT    -> removeWithAPT    os pkg
    RPM    -> removeWithRPM    os pkg
    PkgAdd -> removeWithPkgAdd os pkg
    UnknownPackageManager -> return $ Left NoPackageManagerFound
  case result of
    Left err -> logMsg Error $ "Error removing " ++ show pkg ++ " (" ++ show err ++ ")"
    Right _  -> logMsg Info  $ "Package " ++ show pkg ++ " removed successfully."
  return result
removePackage :: (MonadCric m, Package p) => p -> m (Either PkgManagerError BS.ByteString)
removePackage pkg = do
  logMsg Info $ "Removing " ++ show pkg ++ " ..."
  pkgMgr <- getPackageManager
  os <- getOS
  result <- case pkgMgr of
    Yum    -> removeWithYum    os pkg
    APT    -> removeWithAPT    os pkg
    RPM    -> removeWithRPM    os pkg
    PkgAdd -> removeWithPkgAdd os pkg
    UnknownPackageManager -> return $ Left NoPackageManagerFound
  case result of
    Left err -> logMsg Error $ "Error removing " ++ show pkg ++ " (" ++ show err ++ ")"
    Right _  -> logMsg Info  $ "Package " ++ show pkg ++ " removed successfully."
  return result
removePackage pkg = do
  logMsg Info $ "Removing " ++ show pkg ++ " ..."
  pkgMgr <- getPackageManager
  os <- getOS
  result <- case pkgMgr of
    Yum    -> removeWithYum    os pkg
    APT    -> removeWithAPT    os pkg
    RPM    -> removeWithRPM    os pkg
    PkgAdd -> removeWithPkgAdd os pkg
    UnknownPackageManager -> return $ Left NoPackageManagerFound
  case result of
    Left err -> logMsg Error $ "Error removing " ++ show pkg ++ " (" ++ show err ++ ")"
    Right _  -> logMsg Info  $ "Package " ++ show pkg ++ " removed successfully."
  return result