With OpenVZ you assign a VE's hostname (among other things) from the host node (HN) using vzctl set CTID --hostname myhost --save. It then sets this in /etc/vz/conf/CTID.conf. During startup of the VE, a distribution-specific file in /etc/vz/dists is consulted containing pointers to files in /etc/vz/dists/scripts. Those are distribution-specific scripts for editing the VE's config files, for instance if the VE uses Debian or Ubuntu, the hostname is written to /etc/hostname. The same happens with the IP address, for example.
My question now is: How does OpenVZ know which file in /etc/vz/dists to use? Does it somehow derive the distribution name from the template's name?