2013-08-26 00:18:30 -07:00
|
|
|
import Distribution.Simple
|
2014-01-25 21:22:15 -08:00
|
|
|
|
|
|
|
import Control.Applicative ((<$>))
|
|
|
|
import Data.List (isInfixOf)
|
|
|
|
import Codec.Archive.Tar (create)
|
|
|
|
import System.Directory (getDirectoryContents)
|
|
|
|
|
|
|
|
main = defaultMainWithHooks simpleUserHooks {
|
|
|
|
preBuild = makeProfileTar
|
|
|
|
}
|
|
|
|
|
|
|
|
makeProfileTar args flags = do
|
|
|
|
putStrLn "Building profile.tar."
|
|
|
|
|
|
|
|
let profileDir = "profile"
|
|
|
|
tarFile = profileDir ++ "/profile.tar"
|
|
|
|
files <- filter realFile <$> filter notProfileTar <$> getDirectoryContents profileDir
|
|
|
|
print files
|
|
|
|
create tarFile profileDir files
|
|
|
|
preBuild simpleUserHooks args flags
|
|
|
|
where
|
|
|
|
notProfileTar str = not $ "profile.tar" `isInfixOf` str
|
|
|
|
realFile str = str /= "." && str /= ".."
|