def setup(etcdir, vardir):
    is_root = os.geteuid() == 0
    default_etc = {
            True: '/etc/squadron',
            False: os.path.join(os.path.expanduser('~'),'.squadron')
        }
    default_var = {
            True: '/var/squadron',
            False: os.path.join(os.path.expanduser('~'),'.squadron', 'state')
        }

    if not etcdir:
        result = raw_input("Location for config [{}]: ".format(default_etc[is_root]))
        etcdir = result if result else default_etc[is_root]

    if not vardir:
        result = raw_input("Location for state [{}]: ".format(default_var[is_root]))
        vardir = result if result else default_var[is_root]

    ret = init_system(etcdir, vardir)

    if is_root:
        result = raw_input("Install init script? [N/y] ")
        if result == "Y" or result == "y":
            init_script = resource_string(__name__,
                    os.path.join('init', 'init-script-ubuntu'))
            with open('/etc/init.d/squadron', 'w') as init_file:
                init_file.write(init_script.format(vardir))
                os.fchmod(init_file.fileno(),
                         stat.S_IRWXU |  stat.S_IRGRP | stat.S_IROTH)

    return ret
Prompts the user if necessary to set up directories
dataset/ETHPy150Open gosquadron/squadron/squadron/setup.py/setup