diff options
author | Joey Hess <joey@kitenet.net> | 2011-01-19 18:08:50 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-01-19 18:08:50 -0400 |
commit | dbb76c22d0f4f979fe90eeeff233dbbbfcf2346d (patch) | |
tree | 9b0f1bbb4bb4893bd06cde9c01f21dedfc44fa8e /UUID.hs | |
parent | 27325f212bfdf915d16eadfa9fc51b416d4177c0 (diff) |
Support using the uuidgen command if the uuid command is not available.
Diffstat (limited to 'UUID.hs')
-rw-r--r-- | UUID.hs | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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. - |