Shut down interface and handle groups correctly.

When shutting down, all items in the state file are put down in reverse
order.  However, it is possible that an item in the state file may be a
group and put down other items in the state file, which will cause an
error when trying to put them down twice.  So instead, each iteration
checks the last item in the state file to prevent this.
Use per-phase script directory.

The code has been changed to use a per-phase script directory.  However,
main files are still under iface.d and proto.d, just symlinked in the
correct directory.  Down directorys are still executed backwards, that
is 10-blah will get exected AFTER 99-blah in a down directory.

During script execution, the directory is changed to the directory being
executed.  In addition, a utility functions file exists that can be
included as ". ../functions.sh'