NAME
     attune, tunein - attach a data crystal to the namespace

SYNOPSIS
     attune [-c | -b | -t]
     tunein dialstring

DESCRIPTION
     Attune is the one command that turns a standalone deck into a connected
     one.  It finds a data crystal, mounts it, and puts each of its parts
     where the deck's commands expect to find them, so that afterwards the
     board, the clock and the outside network are all simply there.  On a deck
     that has never been connected it also walks you through getting an
     identity.  Run it with no argument and it does the right thing for the
     machine you are on.

     It is two pieces.  Attune, an rc script in /n/local/rc, is the transport
     menu: it decides what to dial, which is all the flags below do.  The
     graft itself is tunein, a built-in command that takes a dial string -- see
     dial(1) for the forms -- and does everything else.  You would type tunein
     directly only to reach a crystal attune has no flag for.

     Splitting them is not tidiness.  The graft is a long series of 9P walks,
     and over a radio link each one is slow and deep; driven from a script,
     where every if adds a frame, it overflows the shell's stack.  One C frame
     above the walks is what makes it reliable.

     What tunein does, printing as it goes.

     1.   Releases any crystal already attached, so tuning in twice on one
          boot reconnects cleanly rather than colliding with itself.

     2.   Dials, and posts the connection as /srv/dc.

     3.   Mounts it on /n/dc.

     4.   Binds the crystal's /net/tcp over the deck's, on builds whose own
          uplink cannot serve one -- over Bluetooth, in the browser, on the
          simulator.  A deck on WiFi keeps its own.  Only /net/tcp is taken,
          never the whole of /net, so local services such as /net/wifi still
          answer locally.

     5.   Binds the board on /n/bbs, from /n/dc/srv/bbs or /n/dc/rooms
          depending on which shape the crystal exports, so the bbs(1) commands
          work either way.

     6.   Prints the crystal's message of the day and sets the clock from it.

     7.   Walks a new caller through identity.  Without a key on this deck it
          offers to mint one and redials with it -- the crystal authenticates
          at attach, so a key counts only from the next connection.  With a
          key and no name it asks for a handle.  Both may be declined.

     8.   Prints where you stand: identity, whether the board is there,
          whether outbound network came with it.

OPTIONS
     With none, attune uses the transport the build was seeded with: TCP in
     the browser and on WiFi decks, a Bluetooth scan on a deck without one.
     The flags override that and are mutually exclusive.

     -c   The public crystal over TCP, at $dc_host and $dc_port.

     -b   Scan over Bluetooth for a crystal or gateway in the room.

     -t   A crystal on the same host as the simulator, localhost!9999.

EXAMPLES
     The usual thing:

          attune

     Somewhere else:

          dc_host=crystal.example.org
          dc_port=9777
          attune -c

     By hand, to a crystal that attune has no flag for:

          tunein tcp!192.168.1.40!9777

     See what it did:

          ns
          ls /n/bbs

     Let go:

          unmount /n/bbs
          unmount /n/dc
          hangup dc

FILES
     /srv/dc
          The crystal's connection.

     /n/dc
          The crystal's file tree.

     /n/bbs
          Its board, wherever the crystal keeps it.

     /n/bbs/etc/motd
          Printed on arrival.

     /dev/factotum/key
          This deck's identity.  Its absence is what makes the offer to mint
          one.

     /n/local/rc/attune
          The transport menu; read it to see exactly which dial string a flag
          means.

SEE ALSO
     dial(1), bind(1), ns(1), bbs(1), id(1), handle(1), factotum(3)

NOTES
     A guest -- a deck with no key -- may read the board and gets a metered
     allowance of outbound network.  Minting a key costs nothing and takes no
     email address; run attune again and answer yes, or id gen at any time.

     Not every crystal exports outbound TCP to everyone.  If the summary says
     the board only, gopher and telnet have nowhere to dial until the sysop
     grants it.

FRST Computer                                                        ATTUNE(1)
