The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
module Main where
import IO
import System.Cmd
import System.Exit
import System.Directory
import System.Environment

main = do
	let config_path = "__CONFIG_PATH__"
	createInstallPath config_path
	args <- getArgs
	let args' = filter (/= "--global") args
	exitcode <- rawSystem "__GHC_PKG__" ("-f":"__CONFIG_PATH__":args')
	exitWith exitcode

createInstallPath path = do
	config_exists <- doesFileExist path
	if config_exists
		then return ()
		else bracket (openFile path WriteMode) hClose (\h -> do hPutStr h "[]")