Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/rc/profile

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


# Example profile
#
# Note we try hard not to define any variables or functions
# here so we don't polute the users enviroment too much.
#
# When this script finishes it execs rio and starts the $user/bin/rcstartup
# script which places the users initial windows; this is mine.
#
#############################
# #!/bin/rc
# 
# auth/fgui &
# if(~ $service terminal)
# 	window -r 0 0 200 120 stats -lmei $sysname $cpu
# if not
# 	window -r 0 0 200 120 stats -lmei
# 
# window -r 201 0 845 120 faces -i 
# window -r 1159 0 1279 120 clock
# window -r 95 212 921 734 logwin
#
##############################
#
# $user/bin/rc/startup then runs the script $user/bin/rc/logwin
# here again is mine:
#
##############################
#
# #!/bin/rc
# fortune
# calendar -y
# news
# echo
# exec rc -i
#
##############################

#my homepage for mothra
url=http://www.quintile.net/index.html

# for cvs
CVS_RSH=ssh
CVS_PASSFILE=$home/lib/cvspass

# BSD indent
INDENT_PROFILE=$home/lib/indent.pro

bind -c $home/tmp /tmp
bind -b $home/bin/rc /bin
bind -b $home/bin/$cputype /bin

# get sysname as set by ip/ipconfig
if (~ $#sysname 0)
	sysname=`{cat /dev/sysname}

# no ether found (ether less laptop)
if (~ $#sysname 0)
	sysname=local


# default printer whilest at home
LPDEST=canonbjc2000

# if we are at work
ndb/ipquery sys $sysname ipnet | grep -s snellwilcox && {
	# use work's printer
	LPDEST=slp_a3

	# tell Active Directory I'am here
	# see /n/sources/contrib/steve/inform.tgz
	ndb/inform
}

switch($service){
case terminal

	# speed up mouse
	echo -n accelerated > '#m/mousectl'
	echo -n 'res 3' > '#m/mousectl'

	# my prefered font
	font=/lib/font/bit/pelm/unicode.9.font
	
	# use a small font on small screens, NB $spec is a local var
	spec=`{cat '#i/dev/new' >[2]/dev/null} {
		if (test $spec(12) -lt 1024) 
			font=/lib/font/bit/pelm/unicode.8.font
	}

	# set a function with the same name as the prompt
	# so you can select a command and prompt and 'send' it
	prompt=($sysname'% ' '	')
	fn $sysname%{ $* }

	# stand alone (disk full) terminal will not
	# have loaded factotum yet.
	if(! grep -s key /mnt/factotum/ctl){

		# chose where secstore data comes from
		echo -n 'secstore from (secstore, floppy, none)[secstore]: '
		switch(`{read}){
		case secstore ''
			# load up factotum from secstore
			auth/secstore -G factotum >> /mnt/factotum/ctl
		case floppy
			# get factotum contents from floppy (if secstore is offline)
			# It is stored AES encrypted on the floppy
			a:
			auth/aescbc -d < /n/a:/factotum | read -m >> /mnt/factotum/ctl
			unmount /n/a:
			eject
		case none
			# no network
			;
		}

	}

	If main work terminal
	if(~ $sysname larch){
		# attach work CIFS server
		9fs dfs
	}

	# for abaco
	webfs

	# start plumber early
	plumber

	# for abaco and hget
	webcookies

	# mail
	upas/fs

	# start rio with scroll off
	exec rio -s -i startup

case cpu
	# if rio is running we have cpu'ed in
	if (test -e /mnt/term/env/wsys){
	
		# use terminal's rio
		wsys = /mnt/term^`{cat /mnt/term/env/wsys}
		bind -a /mnt/term/mnt/wsys /dev

		# tell the terminal's rio our name (used when window hidden)
		if (test -w /dev/label)
			echo -n $sysname > /dev/label

		# use terminal's factotum
		bind /mnt/term/mnt/factotum /mnt/factotum
	}

	# use terminal's console driver
	bind /mnt/term/dev/cons /dev/cons
	bind /mnt/term/dev/consctl /dev/consctl
	bind -a /mnt/term/dev /dev

	# my prefered font
	font=/lib/font/bit/pelm/unicode.9.font
	
	# small font if small screen, NB $spec is a local var
	spec=`{cat /dev/draw/new >[2]/dev/null} {
		if (test $spec(12) -lt 1024) 
			font=/lib/font/bit/pelm/unicode.8.font
	}

	# set a function with the same name as the prompt
	# so you can select a command and prompt and 'send' it
	prompt=($sysname'% ' '	')
	fn $sysname%{ $* }

	# true if the connection is from drawterm
	if (! test -e /mnt/term/mnt/wsys){

		# if its a modern drawterm with a secstore
		if (test -e /mnt/term/dev/secstore){

			# start a factotum
			auth/factotum -n

			# populate factotum from drawterm's secstore copy
			cat /mnt/term/dev/secstore | read -m > /mnt/factotum/ctl

			# destroy dtawterm's secstore copy for security
			echo > /mnt/term/dev/secstore
		}
		# otherwise its an old style drawterm
		if not {
			# factotum will pompt for a secstore password
			# and populate itself from there.
			auth/factotum
		}

		# for abaco
		webfs

		# plumber early
		plumber
	
		# for hget and abaco
		webcookies

		# mail server
		upas/fs

		# start rio with scroll off
		exec rio -s -i startup
	}
case con
	prompt=($sysname'% ' '	')
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].