def finish_init(environment, start_web, create_sysadmin, log_syslog=False,<EOL>do_install=True, quiet=False, site_url=None, interactive=False,<EOL>init_db=True):
if not init_db:<EOL><INDENT>start_web = False<EOL>create_sysadmin = False<EOL><DEDENT>if do_install:<EOL><INDENT>install_all(environment, False, verbose=False, quiet=quiet)<EOL><DEDENT>if init_db:<EOL><INDENT>if not quiet:<EOL><INDENT>write('<STR_LIT>')<EOL><DEDENT>environment.install_postgis_sql()<EOL>environment.ckan_db_init()<EOL><DEDENT>if not quiet:<EOL><INDENT>write('<STR_LIT:\n>')<EOL><DEDENT>if site_url:<EOL><INDENT>try:<EOL><INDENT>site_url = site_url.format(address=environment.address, port=environment.port)<EOL>environment.site_url = site_url<EOL>environment.save_site(False)<EOL><DEDENT>except (KeyError, IndexError, ValueError) as e:<EOL><INDENT>raise DatacatsError('<STR_LIT>'.format(e))<EOL><DEDENT><DEDENT>if start_web:<EOL><INDENT>environment.start_ckan(log_syslog=log_syslog)<EOL>if not quiet and not interactive:<EOL><INDENT>write('<STR_LIT>'.format(<EOL>environment.web_address()))<EOL><DEDENT><DEDENT>if create_sysadmin:<EOL><INDENT>try:<EOL><INDENT>adminpw = confirm_password()<EOL>environment.create_admin_set_password(adminpw)<EOL><DEDENT>except KeyboardInterrupt:<EOL><INDENT>print()<EOL><DEDENT><DEDENT>if not start_web:<EOL><INDENT>environment.stop_supporting_containers()<EOL><DEDENT>
Common parts of create and init: Install, init db, start site, sysadmin