Previous: , Up: Invitations   [Contents][Index]


7.3 Writing an invitation-created script

When an invitation is generated, the invitation-created script is called (if it exists) right after the invitation file is written, but before the URL has been written to stdout. This allows one to change the invitation file automatically before the invitation URL is passed to the invitee. Here is an example shell script that approximately recreates the default invitation file:

#!/bin/sh

cat >$INVITATION_FILE <<EOF
Name = $NODE
Netname = $NETNAME
ConnectTo = $NAME
#----------------#
EOF

tinc export >>$INVITATION_FILE

You can add more ConnectTo statements, and change ‘tinc export‘ to ‘tinc export-all‘ for example. But you can also use the script to automatically hand out a Subnet to the invitee. Note that the script doesn’t have to be a shell script, you can use any language, it just has to be executable.