ФЭНДОМ


Автор: Russ Cox

In general there is no configuration of plan9port other than what you are told at the end of the install: set $PLAN9 in your profile along with adding $PLAN9/bin to your path. That is, the programs themselves require almost no configuration. What little is needed is mentioned in intro(1).

You might find it useful to customize the Unix startup scripts to run your favorite programs, but that's different. Here's what I do.

First of all, when you log in your shell typically runs $HOME/.profile. If you use bash then it looks for $HOME/.bash_profile first. I work around this:

$ cat $HOME/.bash_profile
. ~/.profile
$

And then my .profile says:

$ cat $HOME/.profile
OS="`uname | tr A-Z a-z`"
ARCH="`uname -m | sed 's;i.86;x86;'`"
BIN=$HOME/bin:$HOME/bin/$OS:$HOME/bin/$OS/$ARCH
PLAN9=/usr/local/plan9
PATH=.:$BIN:$PATH:$PLAN9/bin:/usr/bin/mh

# Browser used by web(1) and thus plumber.
BROWSER=firefox

# This is still needed on OS X, which is about a decade behind.
CVS_RSH=ssh

# Plumb files instead of starting new editor.
EDITOR=E
unset FCEDIT VISUAL

# Let gs find the plan9port document fonts.
GS_FONTPATH=$PLAN9/postscript/font
 
# Make sure mpage prints in letter mode.
MPAGE="-t -bLetter"

# Get rid of backspace characters in Unix man output.
PAGER=nobs

# Prompt (is almost a no-op in bash)
H=`hostname | sed 's/\..*//'`
PS1=$H'=; '

# Default font for Plan 9 programs.
font=$PLAN9/font/lucm/unicode.9.font

# Equivalent variables for rc(1).

home=$HOME
prompt="$H=;  "
user=$USER

export \
BROWSER\
CVS_RSH\
EDITOR\
FCEDIT\
GS_FONTPATH\
H\
MPAGE\
PAGER\
PATH\
PLAN9\
PS1\
VISUAL\
font\
home\
prompt\
user\

# Dump core files by default.
ulimit -c unlimited

# Tell core(1) where to find core files.

if [ -d /core/rsc ]; then
COREDIR=/core/rsc; export COREDIR
fi

. $HOME/.bashrc

autostartx
$

I'm using bash as my default shell (sorry rc fans) so some things need to be done at the start of every bash instance, not just the first one. These things are in my .bashrc, included by the profile for good measure:

$ cat $HOME/.bashrc
_cd () {
\cd "$@" &&
case "$TERM!$-" in
linux!*)
;;
*!*i*)
awd
esac
}
alias cd=_cd
set +o emacs
set +o vi
set -a	# autoexport
[ -z "$PLAN9" ] && . $HOME/.profile
$

The cd alias sets the current window label using awd (see label(1)) unless the window is on the Linux console. This also helps 9term send correct plumbing messages.

The meaning of the "set" commands is the reverse of what you'd expect: the three above turn *off* emacs and vi line editing and turn *on* autoexport of environment variables (like in rc). Turning off the line editing keeps GNU readline out of the picture so that editing the command line in 9term works (see 9term(1)).

The last line invokes .profile if $PLAN9 is not set; explained below.

After running .bashrc, .profile runs autostartx, which starts X11 if the current terminal is tty1 (virtual terminal 1 on Linux):

$ cat $HOME/bin/autostartx
#!/bin/sh
if [ "`/bin/ls -l /proc/self/fd/0 2>/dev/null | awk '{print $NF}'`" = '/dev/tty1' ]
then
# echo
# echo Console login.
NAMESPACE=/tmp/ns.`hostname`
export NAMESPACE
rm -rf $NAMESPACE; mkdir $NAMESPACE
# echo ' name' space $NAMESPACE
# echo Starting factotum.
9 factotum -n
echo -n secstore
aescbc -d < $HOME/lib/secstore.aes | 9p write -l factotum/ctl
# echo Starting SSH agent.
eval `9 ssh-agent -e`
startx
fi
$

I override $NAMESPACE (see intro(4)) because X11 is not running yet (that makes sense if you read intro(4)) but I want to start factotum. I load factotum's keys from an AES-encrypted file in my home directory and then start the Plan 9 ssh agent, which mediates between Unix ssh and Plan 9 factotum (see factotum(4) and ssh-agent(1)).

Startx starts X11, runs .xinitrc, and then stops X11. To run rio as my window manager, I put it in .xinitrc:

$ cat $HOME/.xinitrc
plumber
riostart
rio &
sleeper
$

Running plumber first makes sure it is available to all the programs I'm about to start.

Riostart is a shell script that starts my stats and acme windows where I want them to be, and also starts firefox:

$ cat $HOME/bin/riostart
#!/usr/local/plan9/bin/rc
stats -W 100x100@0,0 -lmisce
switch(`{hostname}){
case tux
acme -a -W 1592x1092@0,104 -l lib/acme.dump &
case x40
acme -a -W 1016x660@0,104 -l lib/acme.dump.small &
case t23 *
acme -a -W 1392x942@0,104 -l lib/acme.dump &
}
firefox &
$

When .xinitrc exits, startx makes X exit. Typically the window system is the last thing .xinitrc runs, but then when it exits, X does. I run "sleeper" so that I can kill and restart rio (or other window managers) without losing my X session.

$ cat $HOME/bin/sleeper
#!/bin/sh
while true
do
sleep 1000
done
$

So that's everything from me logging in to having some programs up and running.

There is one other situation worth mentioning. On typical Linux systems these days, X gets started before you log in. You get a nice gui login screen instead of logging in on tty1 and running startx by hand (or by script).

In that case, after you've logged in, X runs $HOME/.xsession to start your X session, not .xinitrc. My .xsession makes sure the existing plan9port apps really exited (useful if you just logged out of an X session) and then runs factotum and .xinitrc:

$ cat $HOME/.xsession
killall -9 factotum plumber devdraw auxstats 9pserve stats
9 factotum -n
xterm -e 'aescbc -d < $HOME/lib/secstore.aes | 9p write -l factotum/ctl'
eval `9 ssh-agent -e`
. .xinitrc
$

When run this way, .profile never runs, so the first instance of bash in each new 9term sees an empty $PLAN9 during .bashrc and invokes .profile manually (the odd line above). I suppose I might get away with running .profile in .xsession before ..xinitrc, but I haven't tried that, and this is working well enough for now that I'm not going to mess with it. All of this is subtle and quick to anger.

All the man pages I mentioned are plan9port man pages. They are on the web at http://swtch.com/plan9port/man/.

Russ


Добавим rio в список оконных окружений (DE)

Создадим файл /usr/share/xsessions/plan9.desktop

[Desktop Entry]
Version=1.0
Type=Application
Name=RIO
Comment=
Exec=/usr/local/plan9/bin/9.rc rio
Icon=/usr/share/icons/hicolor/48x48/apps/plan9-glenda.png
DesktopNames=RIO
https://forums.freebsd.org/threads/29736/

Обнаружено использование расширения AdBlock.


Викия — это свободный ресурс, который существует и развивается за счёт рекламы. Для блокирующих рекламу пользователей мы предоставляем модифицированную версию сайта.

Викия не будет доступна для последующих модификаций. Если вы желаете продолжать работать со страницей, то, пожалуйста, отключите расширение для блокировки рекламы.

Также на ФЭНДОМЕ

Случайная вики