The master logs in into the slave, starts pppd, and redirects this all thing into a local pty. It consists of the following steps:
There are (not very tight) timing considerations involved, this is why that 'sleep 10s'.