summaryrefslogtreecommitdiff
path: root/UUID.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-01-19 18:08:50 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-01-19 18:08:50 -0400
commitdbb76c22d0f4f979fe90eeeff233dbbbfcf2346d (patch)
tree9b0f1bbb4bb4893bd06cde9c01f21dedfc44fa8e /UUID.hs
parent27325f212bfdf915d16eadfa9fc51b416d4177c0 (diff)
Support using the uuidgen command if the uuid command is not available.
Diffstat (limited to 'UUID.hs')
-rw-r--r--UUID.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/UUID.hs b/UUID.hs
index 67695d310..26a64523f 100644
--- a/UUID.hs
+++ b/UUID.hs
@@ -33,6 +33,7 @@ import Types
import Locations
import qualified Annex
import Utility
+import qualified SysConfig
type UUID = String
@@ -42,7 +43,14 @@ configkey="annex.uuid"
{- Generates a UUID. There is a library for this, but it's not packaged,
- so use the command line tool. -}
genUUID :: IO UUID
-genUUID = liftIO $ pOpen ReadFromPipe "uuid" ["-m"] $ \h -> hGetLine h
+genUUID = liftIO $ pOpen ReadFromPipe command params $ \h -> hGetLine h
+ where
+ command = SysConfig.uuid
+ params = if (command == "uuid")
+ -- request a random uuid be generated
+ then ["-m"]
+ -- uuidgen generates random uuid by default
+ else []
{- Looks up a repo's UUID. May return "" if none is known.
-