Plan 9 from Bell Labs’s /usr/web/sources/contrib/rog/lib-sh-profile

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


load std
autoload=std
if{! ftest -f /net/cs}{
	ndb/cs
}
mount -a {mntgen} /n
auth/factotum
>[2] /dev/null {
	for(i in a b c d e f g h i j k l m n o p q r s t u v w x y z){bind '#U'^$i^':' /n/$i}
	bind '#U*' /n/local
}
bind -a '#C' /

fn yes {
	~ $1 y Y yes Yes
}

fn startserver {
	yes $'manage keys' || pctl forkns
	@{
		pctl forkns
		ilisten -k 'dom=gsoc' 'tcp!*!styx' {if{~ $user rog} {export /&}} > /dev/cons >[2=1]
	}
	memfs -b /keydb > /dev/cons >[2] /dev/cons &&
	auth/keyfs -n ${pipe from {echo -n $password}} > /dev/cons >[2=1] &&
	crypt -d -k $password < /keydb/signerkey.cr > /keydb/signerkey &&
	svc/auth -n > /dev/cons >[2=1]
	send sync $status
}

wm/wm wm/genlogon -Q password  -q 'start server' no -q 'manage keys'  no {
	load tk
	chan sync
	crypt -d -k $password < /keyring/factotum.cr | getlines {echo $line} > /mnt/factotum/ctl && {
		if {yes $'start server'} {
			startserver &
			status=${recv sync}
		}else {
			status=''
		}
	}
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.