[buildout]
parts =
  switch_softwaretype
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}

[switch_softwaretype]
recipe = slapos.cookbook:softwaretype
default = $${instance-proview-r:rendered}

[template-base]
recipe = slapos.recipe.template:jinja2
rendered = $${buildout:directory}/$${:filename}
extensions = jinja2.ext.do
mode = 0644
extra-context =
context =
  key develop_eggs_directory buildout:develop-eggs-directory
  key eggs_directory buildout:eggs-directory
  key ipv4 slap-configuration:ipv4
  key ipv6 slap-configuration:ipv6
  key global_ipv4_prefix network-information:global-ipv4-network
  key slapparameter_dict slap-configuration:configuration
  key computer_id slap-configuration:computer
  raw openssl_executable_location ${openssl:location}/bin/openssl
  raw shellinabox_bin ${shellinabox:location}/bin/shellinaboxd
  raw nginx_bin ${nginx:location}/sbin/nginx
  raw apache_htpasswd_bin ${apache:location}/bin/htpasswd
  raw template_logrotate ${template-logrotate-base:rendered}
  raw template_monitor ${monitor2-template:rendered}
  $${:extra-context}

[instance-proview-r]
<= template-base
template = ${template-proview-r:location}/${template-proview-r:filename}
rendered = $${buildout:directory}/template-proview-r.cfg
extensions = jinja2.ext.do
extra-context =
  raw bash_location ${bash:location}/bin/bash
  raw novnc_location ${noVNC:location}
  raw x11vnc_bin ${x11vnc:location}/bin/x11vnc
  raw websockify_executable_location ${buildout:directory}/bin/websockify
  raw xorg_font_util ${xorg-font-util:location}
  raw xvfb_bin ${xserver:location}/bin/Xvfb
  raw java_location ${java-openjdk:location}
  raw proview_directory ${pwr:location}
  raw proview_compile_dir ${pwr:compile-dir}
  raw ld_library_path ${pwr:ld-library-path}
  raw pwrp_profile ${template-pwrp-profile:location}/${template-pwrp-profile:filename}
  raw template_pwrrt ${template-pwrrt:location}/${template-pwrrt:filename}
  raw template_nginx ${template-nginx-conf:location}/${template-nginx-conf:filename}
mode = 0644

[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
computer = $${slap-connection:computer-id}
partition = $${slap-connection:partition-id}
url = $${slap-connection:server-url}
key = $${slap-connection:key-file}
cert = $${slap-connection:cert-file}

