Support using the uuidgen command if the uuid command is not available.
This commit is contained in:
parent
27325f212b
commit
dbb76c22d0
5 changed files with 82 additions and 38 deletions
10
UUID.hs
10
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.
|
||||
-
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue