Templates are text files that look similar to the original configuration files but contain special fields; into these special fields the values from the NComputing configuration will be merged, creating the actual configuration files.
Templates are stored in /etc/templates in a custom hierarchy - some important subdirectories:
- ica. all templates regarding Citrix Receiver configuration. If it's about Citrix, you may in some cases also use an alternative, easier method to changing Citrix Receiver configuration files.
- vmview. VMware Horizon View templates.
- connections. Start scripts for the connections.
The Cheetah template engine is used to create the final files. Cheetah allows for including other files and programming-language-like constructs. If you simply want to add some static text or remove lines, you do not need to learn Cheetah at all - it's not different from editing any other text file.
Note: Do not confuse this feature with the "Allow in-application configuration" parameter, notably the ability to create Firefox profiles. Templates are used for almost any aspect of the system, including boot process, services etc, not just the files of one application.
Modify a template/Create custom template
You can modify templates in their original location at /etc/templates, this will work during runtime of the system and your modifications will be gone after a reboot. If you want to store modified templates persistently, you need to store them in /config/templates within the same subpath. That means, /config/templates shadows /etc/templates. If the system searches for template ica/module.ini, it will first look if /config/templates/ica/module.ini exists; if it does exist, the system will use it (your modified template), if not it would use /etc/templates/ica/module.ini
To create your custom template, this is how we suggest to proceed:
- Open a shell prompt/Console/SSH login session
- Use the following commands to create your custom template:
mkdir -p /config/templates/MYPATH cp /etc/templates/MYPATH/MYFILE /config/templates/MYFILE
You can now modify your file at /config/templates/MYFILE/MYPATH (please replace MYPATH/MYFILE with the actual file path and name, such as ica/module.ini or so):
vi is a unix text editor. Press "i" to start "insert mode", then do your modifications. When you're done, press "Esc" to leave "insert mode" again, then save & exit by typing ":wq" (=write and quit).
Whenever you start your connection, the new template will now used. You may also test the file yourself, see below - this is useful to see error messages that otherwise wouldn't be easy to access.
Note: We advise to call the "sync" command on the shell prompt after modifying to make sure the operating system actually writes changes to disk.
Testing a template
One way of testing of course is to simply run the connection or reboot the system and see how things are working out. You can of course manually trigger
- Open a shell prompt/Console/SSH login session
- If working with a connection template: Look up the connection id, e.g. by doing cat /config/config.dat - the value of connection.x.id (with x being the connection sequence number) is the internal connection id
- Use the supplied confTool command (omit the -c clause if you use a system/non-connection template):
confTool -t MYPATH/MYTEMPLATE -o testfile -c CONNECTIONID
After that, you will have a file named testfile in the current directory that was created from your template and the configuration, or you will see a "backtrace" of error messages allowing you to correct the template.
Deleting a template
Then simply delete the file under /config/templates:
If you do not have any more custom templates stored, we recommend to delete the whole directory tree:
rm -rf /config/templates
The original idea of these templates was to provide a powerful, yet easy-to-use mechanisms for NComputing partners and customers to customize the system at lowest level, e.g. to work around Citrix or other vendor's bugs. One should however consider that editing text files and copy them around is not NoTouch-style, as the NoTouch approach favors inheritance, asynchronous distribution, etc etc. You can of course distribute your templates to more or even all of your machines, but if you have such an important modifications, please tell NComputing support about it so that we can consider of adding this to be a stock product feature, i.e. not requiring to make template changes any longer but have comfortable parameters.
You can copy templates from one machine to another by using the scp command. The scp program can copy "from" a remote machine, or "to" a remote machine. The easiest thing is probably to copy to the other machine (this command will copy all modified templates thanks to -r switch):
scp -r /config/templates newmachine:/config
Central distribution / NoTouch Center
NoTouch machines can execute shell commands e.g. on system boot (Eventscripts/Startup 3 for example) or on connection start. This can be used to use the wget command to download files from a central location - also can the Virtual Appliance be used or standalone NoTouch Center to host these central files, or any web server.
So, for example with ica/module.ini, use this or a similar command in Eventscripts/startup 3 to download the template at boot time:
mkdir -p /config/templates/ica ; wget -O /config/templates/ica/module.ini http://MYSERVER/MYPATH/module.ini