propellor spin
This commit is contained in:
parent
1a6a317e64
commit
ca09087caf
|
@ -11,6 +11,8 @@ import "mtl" Control.Monad.Reader
|
||||||
import Control.Exception (bracket)
|
import Control.Exception (bracket)
|
||||||
import System.PosixCompat
|
import System.PosixCompat
|
||||||
import System.Posix.IO
|
import System.Posix.IO
|
||||||
|
import System.FilePath
|
||||||
|
import System.Directory
|
||||||
|
|
||||||
import Propellor.Types
|
import Propellor.Types
|
||||||
import Propellor.Message
|
import Propellor.Message
|
||||||
|
@ -60,6 +62,7 @@ onlyProcess :: FilePath -> IO a -> IO a
|
||||||
onlyProcess lockfile a = bracket lock unlock (const a)
|
onlyProcess lockfile a = bracket lock unlock (const a)
|
||||||
where
|
where
|
||||||
lock = do
|
lock = do
|
||||||
|
createDirectoryIfMissing True (takeDirectory lockfile)
|
||||||
l <- createFile lockfile stdFileMode
|
l <- createFile lockfile stdFileMode
|
||||||
setLock l (WriteLock, AbsoluteSeek, 0, 0)
|
setLock l (WriteLock, AbsoluteSeek, 0, 0)
|
||||||
`catchIO` const alreadyrunning
|
`catchIO` const alreadyrunning
|
||||||
|
|
|
@ -263,10 +263,12 @@ fixForeignDev target = whenM (doesFileExist (target ++ foreignDevFlag)) $ do
|
||||||
, Param "sh"
|
, Param "sh"
|
||||||
, Param "-c"
|
, Param "-c"
|
||||||
, Param $ intercalate " && "
|
, Param $ intercalate " && "
|
||||||
[ "apt-get -y install makedev"
|
[ "apt-get update"
|
||||||
|
, "apt-get -y install makedev"
|
||||||
, "rm -rf /dev"
|
, "rm -rf /dev"
|
||||||
, "mkdir /dev"
|
, "mkdir /dev"
|
||||||
, "cd /dev"
|
, "cd /dev"
|
||||||
|
, "mount -t proc proc /proc"
|
||||||
, "/sbin/MAKEDEV std ptmx fd consoleonly"
|
, "/sbin/MAKEDEV std ptmx fd consoleonly"
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue