Plan 9 Port Scripts

Plan 9 Port, or p9p, is a UNIX port of the Plan 9 userland utilities. The port does not fully replicate the Plan 9 environment, as shortcomings in UNIX either makes the Plan 9 functionality very messy to implement, or down right impossible. In practise using p9p often requires a bit of mix and match between Plan 9 and UNIX utilities.

This reality is reflected in the p9p scripts. Idealy you should be able to just drop original Plan 9 scripts into the p9p environment, and have them work with a minimum of tweaking. In practise however this seldom works. The scripts assume that Plan 9 Port is installed in /usr/local/plan9, if this is not the case, you need to change the shebang line in the scripts (ei. the first #! line).

To install the scripts run the following commands:

tar zxf package.tar.gz
chmod +x plan9/bin/*

By convention the scripts are installed in ~/plan9/bin, the manuals in ~/plan9/man/man[1-9], and some data files in ~/plan9/lib. It is possible to install the scripts directly into ~/bin, which is a more standard location for user scripts, but the purpose of this segregation is to avoid possible conflicts between UNIX and Plan 9 scripts and manuals that may have the same name. It also allows you to have both the UNIX and the Plan 9 Port scripts installed on a UNIX machine, both using different environments. So that you can import/export data files from a true Plan 9 system and work with them on UNIX, while using native UNIX tools to manage the UNIX environment.

You can check the contents of a package before installing it if you want:

tar tzf package.tar.gz

As for configuring the correct executable and manual search paths, it's a little tricky. You basically want to create two distinct environments, one for UNIX and another for Plan 9 Port. You may or may not wish these environments to mesh.

To make the p9p scripts and manuals available from your UNIX environment (but to overwrite these with UNIX commands/manuals if there is a conflict), you can add these lines to your ~/.bashrc, or other appropriate shell configuration file (the last line may not be necessary):

export PATH=$PATH:$HOME/plan9/bin
export MANPATH=$MANPATH:$HOME/plan9/man

To make the UNIX commands available from your Plan 9 Port environment, you can add this line to your ~/lib/profile (this only works if you run 9 rc -l, simply running rc will not set up the correct path):

path=($home/plan9/bin $path)

The only way to access the manuals directly from your Plan 9 Port environment, would be to copy them to the Plan 9 Port system files: sudo cp -r $home/plan9/man $PLAN9. Of course you can read them manually without installing them:

groffer $HOME/plan9/man/man1/script.1